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_htmlorerrorwhen 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
.tplfile totemplate_file. - Keep
extra_css/extra_jslightweight 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.
Metadata
Release files for swarmauri_tool_jupyterexporthtml 0.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| swarmauri_tool_jupyterexporthtml-0.9.0.tar.gz | 8.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| swarmauri_tool_jupyterexporthtml-0.9.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.7 kB
Release files / swarmauri_tool_jupyterexporthtml-0.9.0.tar.gz
| Download URL | swarmauri_tool_jupyterexporthtml-0.9.0.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8b7792ab658344f4bcc401f8bba0474af6e11e40b4dc68a712ccd4cbeaa1859b
|
|
BLAKE2b-256 checksum How to use checksums |
40b8f0aa3a9dc59d711ba0fb153b685c0ad5e33df1d0d7d0c2c7c413228bb4dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","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}
|
Release files / swarmauri_tool_jupyterexporthtml-0.9.0-py3-none-any.whl
| Download URL | swarmauri_tool_jupyterexporthtml-0.9.0-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d9e5af289b950db5435ff6afc6dd03e47b3f6d836fd711cfea9cdf79f90fca39
|
|
BLAKE2b-256 checksum How to use checksums |
42cf4f709f32d451a91496127d96e1265bd9138a58d5842dfa5fd6940a4c9b10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","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}
|