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

File metadata

  • Download URL: swarmauri_tool_jupyterexporthtml-0.8.2.dev6.tar.gz
  • Upload date:
  • Size: 8.4 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_jupyterexporthtml-0.8.2.dev6.tar.gz
Algorithm Hash digest
SHA256 d5b0c2f86cca6ec542a2812386999dbc3a9c29863e929f7d1fce5c31f755635e
MD5 89a4b606979ede8f4b830472a11c5bd2
BLAKE2b-256 3516611dbb538b4163139eec3e8ec663523b58bc793c482437223c612e2d6c02

See more details on using hashes here.

File details

Details for the file swarmauri_tool_jupyterexporthtml-0.8.2.dev6-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_tool_jupyterexporthtml-0.8.2.dev6-py3-none-any.whl
  • Upload date:
  • Size: 9.5 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_jupyterexporthtml-0.8.2.dev6-py3-none-any.whl
Algorithm Hash digest
SHA256 ef6dad844f2f374d155ec1c4989ab2490105b6834757c39d44cc60a44717181d
MD5 e5ff50fa4ca2e85cf0491b4d96636ef0
BLAKE2b-256 e86869edeef14661d4a91878e2ab140f0b6821396268541ed475d2100bfbbe21

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