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.0.dev22.tar.gz.

File metadata

  • Download URL: swarmauri_tool_jupyterexecuteandconvert-0.9.0.dev22.tar.gz
  • Upload date:
  • Size: 8.8 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_jupyterexecuteandconvert-0.9.0.dev22.tar.gz
Algorithm Hash digest
SHA256 5c98b9c9f565285b6089abb88db625cd2711ca37cded37328c3e28eff3fd2bf3
MD5 c4e52d1837bf851db762ba472c352cd4
BLAKE2b-256 b88baa672db5b99d1d642b0db4ef4ff690139bc7f0b7ab1a20d03257b802c5ca

See more details on using hashes here.

File details

Details for the file swarmauri_tool_jupyterexecuteandconvert-0.9.0.dev22-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_tool_jupyterexecuteandconvert-0.9.0.dev22-py3-none-any.whl
  • Upload date:
  • Size: 10.0 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_jupyterexecuteandconvert-0.9.0.dev22-py3-none-any.whl
Algorithm Hash digest
SHA256 cc5b0db49a5d8574ba83f18c99b37932bed31c53f89d2f093de496bfd81af6ac
MD5 5a9ac473aa6d1cfb73979360d3c514d9
BLAKE2b-256 d261dda52b8f2af03b3835bc5bf04d7ecb4b677919337d4d3fb8c677fb594ab2

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