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

File metadata

  • Download URL: swarmauri_tool_jupyterexecuteandconvert-0.10.0.dev4.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.dev4.tar.gz
Algorithm Hash digest
SHA256 d6d01206d8fc16401f29bbe71c4789442b3fc88fc4586f131612693d7b09fff1
MD5 f9b93a441ad5641eb146598656c8b5c9
BLAKE2b-256 602c9169a8235d848cdac502e02f8a5dad61568b8f4b815c6994e6711101faed

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_tool_jupyterexecuteandconvert-0.10.0.dev4-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.dev4-py3-none-any.whl
Algorithm Hash digest
SHA256 fdfc21a91212fc5cc88b7cce5db6acb278252324c532d17f4a3965b8382262c9
MD5 97173ae223431199874fe12cb3995310
BLAKE2b-256 7a5a7931ab79d17c9a7c0f6eea95194e8532e5347a385d579817566f13332bf8

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