Skip to main content

A tool that exports a Jupyter Notebook to HTML format using nbconvert’s HTMLExporter, enabling web-based presentation of notebooks.

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_tool_jupyterexporthtml


Swarmauri Tool Jupyter Export HTML

Converts a Jupyter notebook (passed in as JSON) to HTML using nbconvert’s HTMLExporter with optional custom templates, CSS, and JavaScript.

Features

  • Accepts notebook data as a JSON string (e.g., from json.dumps(nbformat.read(...))).
  • Supports optional template, inline CSS, and inline JS injection.
  • Returns a dict containing exported_html or error when conversion fails.

Prerequisites

  • Python 3.10 or newer.
  • nbconvert, nbformat, and Swarmauri base/core packages (installed automatically).

Installation

# pip
pip install swarmauri_tool_jupyterexporthtml

# poetry
poetry add swarmauri_tool_jupyterexporthtml

# uv (pyproject-based projects)
uv add swarmauri_tool_jupyterexporthtml

Quickstart

import json
import nbformat
from swarmauri_tool_jupyterexporthtml import JupyterExportHTMLTool

notebook = nbformat.read("notebooks/example.ipynb", as_version=4)
notebook_json = json.dumps(notebook)

exporter = JupyterExportHTMLTool()
response = exporter(
    notebook_json=notebook_json,
    template_file=None,
    extra_css="body { font-family: Arial; }",
    extra_js="console.log('Export complete');",
)

if "exported_html" in response:
    Path("notebooks/example.html").write_text(response["exported_html"], encoding="utf-8")
else:
    print("Error:", response["error"])

Tips

  • nbconvert templates let you customize the layout; pass a .tpl file to template_file.
  • Keep extra_css/extra_js lightweight to avoid bloating the HTML output.
  • Combine with notebook execution tools (execute → export → publish) for end-to-end pipelines.

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_jupyterexporthtml-0.8.3.dev9.tar.gz.

File metadata

  • Download URL: swarmauri_tool_jupyterexporthtml-0.8.3.dev9.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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_jupyterexporthtml-0.8.3.dev9.tar.gz
Algorithm Hash digest
SHA256 50cfb16424f3fd7c76415eb08c98f339f453eaba32adf43eda16626c4777bf9f
MD5 372f18c6a89b26ed14f1da490df3c5ac
BLAKE2b-256 bc673e05f56e350ac0d8b1053b3c53cbd440e3cf4c8e2f697fea7ee9dd3f661b

See more details on using hashes here.

File details

Details for the file swarmauri_tool_jupyterexporthtml-0.8.3.dev9-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_tool_jupyterexporthtml-0.8.3.dev9-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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_jupyterexporthtml-0.8.3.dev9-py3-none-any.whl
Algorithm Hash digest
SHA256 44afa83fd079c84464434fa0f30da97784c84ee7df878e9a61f843db4199cf3b
MD5 544ee6d9cd68160564ea2f1be9d3f3ad
BLAKE2b-256 b24d21d33c1cb879b0ef34cf169f242f30c875cf2dbd26e9abea8b09e3d20b79

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