Skip to main content

A tool that programmatically executes and converts a Jupyter Notebook using nbconvert's CLI functionality, enabling automated notebook execution and format conversion.

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_tool_jupyterexecuteandconvert


Swarmauri Tool Jupyter Execute & Convert

Executes a Jupyter notebook and converts the output to HTML or PDF using nbconvert—packaged as a Swarmauri tool.

Features

  • Runs notebooks with configurable execution timeout.
  • Converts executed notebooks to html or pdf via nbconvert.
  • Returns a status dictionary with the converted file path or error details.

Prerequisites

  • Python 3.10 or newer.
  • nbconvert, nbformat, and Jupyter runtime (installed automatically).
  • Notebook dependencies must be available in the execution environment.

Installation

# pip
pip install swarmauri_tool_jupyterexecuteandconvert

# poetry
poetry add swarmauri_tool_jupyterexecuteandconvert

# uv (pyproject-based projects)
uv add swarmauri_tool_jupyterexecuteandconvert

Quickstart

from swarmauri_tool_jupyterexecuteandconvert import JupyterExecuteAndConvertTool

tool = JupyterExecuteAndConvertTool()
response = tool(
    notebook_path="notebooks/analysis.ipynb",
    output_format="pdf",
    execution_timeout=600,
)

if response.get("status") == "success":
    print("Converted file:", response["converted_file"])
else:
    print("Error:", response.get("error"))
    print("Message:", response.get("message"))

Tips

  • Set execution_timeout high enough for long-running notebooks; nbconvert defaults to 600 seconds.
  • Ensure notebooks run headlessly: avoid widgets or interactive inputs that pause execution.
  • Install LaTeX (tectonic, texlive) if exporting to PDF on systems where nbconvert requires it.
  • Combine with JupyterClearOutputTool to strip outputs after conversion if you want clean notebooks and rich artifacts.

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_jupyterexecuteandconvert-0.10.0.dev1.tar.gz.

File metadata

  • Download URL: swarmauri_tool_jupyterexecuteandconvert-0.10.0.dev1.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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_jupyterexecuteandconvert-0.10.0.dev1.tar.gz
Algorithm Hash digest
SHA256 24e96ed347fe7c5a11b1e3cf99a2d08ff1c4a40ea3002c5afbe9ee9e9eb7caa2
MD5 101bb4306533a5ec4827b5652548dcf4
BLAKE2b-256 a47cee04dd434d75940699533f5f5ca549ee6687d05b03355237fe1a2a834637

See more details on using hashes here.

File details

Details for the file swarmauri_tool_jupyterexecuteandconvert-0.10.0.dev1-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_tool_jupyterexecuteandconvert-0.10.0.dev1-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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_jupyterexecuteandconvert-0.10.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 fe4b84d199c9b4424c90a1a6e1ea1f257bf9140270321381b95ef2c1473b1a34
MD5 25861611fd29eb91983194ca447a755b
BLAKE2b-256 7ad61fd73bb26841e8eb21e2a48795ee162c442a8265e6c9630349eded339371

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