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

File metadata

  • Download URL: swarmauri_tool_jupyterexporthtml-0.8.3.dev10.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","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.dev10.tar.gz
Algorithm Hash digest
SHA256 2c61f378a897553a53cc6ecb7f9258aed94138a36b0023f3b0332f2adf10467d
MD5 a0304d8ffb5f219ad96562b8e7953291
BLAKE2b-256 7e00044dbeed1dd6c0f74716cbf789a02380d82a17c9f7af0338493c3ceccbec

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_tool_jupyterexporthtml-0.8.3.dev10-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","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.dev10-py3-none-any.whl
Algorithm Hash digest
SHA256 14e3b8f5d4058647a61896665e4abdd9dae46dd0f1b1c22b2eedc09f12d69511
MD5 f3b30d13dad2bf396fc7cf8f641621ef
BLAKE2b-256 7665dbb981a451b7f51347e7bc900128b7413c9227bf341a2e727456b18e30fa

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