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

swarmauri_tool_jupyterexporthtml-0.8.2.tar.gz (8.3 kB view details)

Uploaded Source

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

File metadata

  • Download URL: swarmauri_tool_jupyterexporthtml-0.8.2.tar.gz
  • Upload date:
  • Size: 8.3 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_jupyterexporthtml-0.8.2.tar.gz
Algorithm Hash digest
SHA256 6200905f8ce76ce10f9550ba4f77f435bce23b69d60c556fc3e745f9549a5ff4
MD5 5d210aa2acc25ae952858e371e99a3e9
BLAKE2b-256 e4c83efb4d7fa464fdb3e7e7b3d0c13b94e0298ce45e1ab3f59744962c15366d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_tool_jupyterexporthtml-0.8.2-py3-none-any.whl
  • Upload date:
  • Size: 9.4 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_jupyterexporthtml-0.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c7c6154778278f1c137fb67d6c069882188816e96fc7df166bafa5b65ef05369
MD5 088df3174710edc1063c950783b77f10
BLAKE2b-256 e2defafb3df1281e014bd1b150e80bb7c1793410b0fe6dd67a8a59d000277fbb

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