Skip to main content

A tool designed to execute all cells in a Jupyter Notebook using nbconvert’s ExecutePreprocessor, capturing outputs for testing and reporting.

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_tool_jupyterexecutenotebook


Swarmauri Tool Jupyter Execute Notebook

Executes all cells of a Jupyter notebook using nbclient and returns the executed NotebookNode with captured outputs.

Features

  • Runs notebooks programmatically via the Swarmauri tool interface.
  • Accepts optional per-cell timeout (default 30 seconds) and continues on cell errors.
  • Returns the executed notebook object so downstream tools can inspect outputs or save it.

Prerequisites

  • Python 3.10 or newer.
  • Jupyter/nbconvert stack available (nbclient, nbformat, ipykernel, etc.—installed automatically).
  • Notebook dependencies must be installed in the environment where the tool runs.

Installation

# pip
pip install swarmauri_tool_jupyterexecutenotebook

# poetry
poetry add swarmauri_tool_jupyterexecutenotebook

# uv (pyproject-based projects)
uv add swarmauri_tool_jupyterexecutenotebook

Quickstart

from swarmauri_tool_jupyterexecutenotebook import JupyterExecuteNotebookTool

executor = JupyterExecuteNotebookTool()
executed_nb = executor(
    notebook_path="notebooks/example.ipynb",
    timeout=120,
)

# Save the executed notebook
import nbformat, json
from pathlib import Path

Path("notebooks/example-executed.ipynb").write_text(
    nbformat.writes(executed_nb),
    encoding="utf-8",
)

Tips

  • Increase timeout for notebooks with long-running cells to avoid CellTimeoutError.
  • Set allow_errors=True (default in the tool) so execution continues after a failing cell while error traces are still recorded.
  • Combine with JupyterClearOutputTool or conversion tools to build end-to-end notebook pipelines.

Want to help?

If you want to contribute to swarmauri-sdk, read up on our guidelines for contributing that will help you get started.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file swarmauri_tool_jupyterexecutenotebook-0.9.0.dev21.tar.gz.

File metadata

  • Download URL: swarmauri_tool_jupyterexecutenotebook-0.9.0.dev21.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_tool_jupyterexecutenotebook-0.9.0.dev21.tar.gz
Algorithm Hash digest
SHA256 390dda2959d9a9f27ed10de686229a51d766283bddb4f51a49a78842a110c406
MD5 d1eab42201c11f0ef3e1719f881e4e8e
BLAKE2b-256 5e01bcb8628bf40fc5a27800d4713b752528f4bd254e98405afaf25cc529bb5b

See more details on using hashes here.

File details

Details for the file swarmauri_tool_jupyterexecutenotebook-0.9.0.dev21-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_tool_jupyterexecutenotebook-0.9.0.dev21-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_tool_jupyterexecutenotebook-0.9.0.dev21-py3-none-any.whl
Algorithm Hash digest
SHA256 ebee66090adf8adc635c7a179cf0960aa0cee6a43fd509a8c4b91b4ae06c1af8
MD5 4807c28888c7845e77d3318fa2ed5b9d
BLAKE2b-256 6253488bc0d7506dbb4203d3c84bb8c7e654ec87a8c34ce94b970b12adb7906e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page