Jupyter笔记本执行器Skill jupyter-notebook-executor

Jupyter笔记本执行器是一个用于自动化执行、参数化管理和结果提取的编程工具。它支持机器学习工作流中的探索性数据分析(EDA)、模型解释性分析和实验自动化。主要功能包括参数化笔记本运行、输出提取验证、格式转换(HTML/PDF)、单元格执行控制、错误处理和超时管理。适用于数据科学、量化金融和AI开发中的自动化分析流程。

数据分析 0 次安装 2 次浏览 更新于 2/23/2026

name: jupyter-notebook-executor description: 用于以编程方式运行Jupyter笔记本、参数化输入并提取输出以支持机器学习工作流的技能。 allowed-tools:

  • Read
  • Write
  • Bash
  • Glob
  • Grep

jupyter-notebook-executor

概述

用于以编程方式运行Jupyter笔记本、参数化输入并提取输出以支持机器学习工作流的技能。

能力

  • 参数化笔记本执行
  • 输出提取与验证
  • 笔记本格式转换(转为HTML/PDF)
  • 单元格执行控制
  • 错误处理与报告
  • 环境管理
  • 内核指定
  • 超时管理

目标流程

  • 探索性数据分析(EDA)流程
  • 模型可解释性与可说明性分析
  • 实验规划与假设检验

工具与库

  • papermill
  • nbconvert
  • jupyter
  • nbformat

输入模式

{
  "type": "object",
  "required": ["action", "notebookPath"],
  "properties": {
    "action": {
      "type": "string",
      "enum": ["execute", "convert", "extract", "validate"],
      "description": "对笔记本执行的操作"
    },
    "notebookPath": {
      "type": "string",
      "description": "Jupyter笔记本的路径"
    },
    "executeConfig": {
      "type": "object",
      "properties": {
        "parameters": { "type": "object" },
        "outputPath": { "type": "string" },
        "kernel": { "type": "string" },
        "timeout": { "type": "integer" },
        "cwd": { "type": "string" }
      }
    },
    "convertConfig": {
      "type": "object",
      "properties": {
        "format": { "type": "string", "enum": ["html", "pdf", "markdown", "script"] },
        "outputPath": { "type": "string" },
        "template": { "type": "string" },
        "excludeInput": { "type": "boolean" },
        "excludeOutput": { "type": "boolean" }
      }
    },
    "extractConfig": {
      "type": "object",
      "properties": {
        "cellTags": { "type": "array", "items": { "type": "string" } },
        "outputTypes": { "type": "array", "items": { "type": "string" } },
        "variableNames": { "type": "array", "items": { "type": "string" } }
      }
    }
  }
}

输出模式

{
  "type": "object",
  "required": ["status", "action"],
  "properties": {
    "status": {
      "type": "string",
      "enum": ["success", "error", "timeout"]
    },
    "action": {
      "type": "string"
    },
    "executionResult": {
      "type": "object",
      "properties": {
        "outputPath": { "type": "string" },
        "executionTime": { "type": "number" },
        "cellsExecuted": { "type": "integer" },
        "errors": { "type": "array" }
      }
    },
    "conversionResult": {
      "type": "object",
      "properties": {
        "outputPath": { "type": "string" },
        "format": { "type": "string" }
      }
    },
    "extractedData": {
      "type": "object",
      "properties": {
        "variables": { "type": "object" },
        "outputs": { "type": "array" },
        "figures": { "type": "array", "items": { "type": "string" } }
      }
    }
  }
}

使用示例

{
  kind: 'skill',
  title: '使用参数执行EDA笔记本',
  skill: {
    name: 'jupyter-notebook-executor',
    context: {
      action: 'execute',
      notebookPath: 'notebooks/eda_template.ipynb',
      executeConfig: {
        parameters: {
          data_path: 'data/train.csv',
          output_dir: 'results/eda/',
          sample_size: 10000
        },
        outputPath: 'notebooks/eda_results.ipynb',
        kernel: 'python3',
        timeout: 3600
      }
    }
  }
}