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.9.2.dev6.tar.gz.

File metadata

  • Download URL: swarmauri_tool_jupyterexecuteandconvert-0.9.2.dev6.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","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.9.2.dev6.tar.gz
Algorithm Hash digest
SHA256 2698ffb27f7e1a51d78796e7e61874b98cfd0ffa8bba546ac2c6b1d85ed95398
MD5 668f81f63e4362bf0b8fcfc6b5a161fc
BLAKE2b-256 9270364d35b4e27b84300d36d8f85c3f8ce180326283db3a423cee6bb0f4c010

See more details on using hashes here.

File details

Details for the file swarmauri_tool_jupyterexecuteandconvert-0.9.2.dev6-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_tool_jupyterexecuteandconvert-0.9.2.dev6-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","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.9.2.dev6-py3-none-any.whl
Algorithm Hash digest
SHA256 4f92b4d5ab45c0eb9e7aec37652bbab70d8fc0d0c62a9393036d9708da864c43
MD5 4e61e848691a4f2a594eadde636be577
BLAKE2b-256 aacffbf320394eb8d39bd83d1ac32c5bb409e112f7494ced717336f527255a59

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