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.dev7.tar.gz.

File metadata

  • Download URL: swarmauri_tool_jupyterexecuteandconvert-0.9.2.dev7.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","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.dev7.tar.gz
Algorithm Hash digest
SHA256 7479bda08f5536d7558f10174d563fa8a74832c4cbc4c439440ea21afcdda764
MD5 1cf5665b04c8649840991d11a035a82b
BLAKE2b-256 6f97a5c833e24bdeb2c5893ea0f604cc181bba0bc2dc3f3a1e6f19ff4cc0b3af

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_tool_jupyterexecuteandconvert-0.9.2.dev7-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","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.dev7-py3-none-any.whl
Algorithm Hash digest
SHA256 53385d08adf31e47b889b11766bdaa696b758a04ab0d0da08f0fc402c5e030ec
MD5 6867e8b6ab193bb17c0232e13661f68f
BLAKE2b-256 c3fb3316f881cc60d90d43d59cc7bc661d3b7e67c1cae819b65e6a560d4cf36f

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