Skip to main content

hedron-notebook

PyPI Python CI License: MIT

Server-side notebook preview helper for Hedron.

Run a normal Hedron ASGI app from an authoring notebook with inline iframe and external-link modes. Distinct from the browser-Python / JupyterLite sandbox in hedron-extras. Install as hedron-notebook or via hedron[notebook].

Package maturity: Beta tooling-grade (0.1.x) · pin >=0.1.0,<0.2 (localhost preview only)

Default guidance is localhost-only development. Hosted or publicly reachable hosts raise an explicit warning. Preview URLs include an unguessable session token (hedron_preview_token query parameter). The first successful request seeds an HttpOnly cookie so iframe follow-up requests (assets, HTMX, WebSockets) stay authorized; X-Hedron-Preview-Token is also accepted. Requests without a matching token are rejected. This package is not a Supported production server.

Install

pip install "hedron-notebook>=0.1.0,<0.2"
# or
uv add "hedron-notebook>=0.1.0,<0.2"
# via flagship extra:
pip install "hedron[notebook]>=0.61.0,<0.62"

Requires Python 3.11–3.14.

Optional server extra (uvicorn):

pip install "hedron-notebook[server]>=0.1.0,<0.2"

Quick start

from hedron import Hedron, Page, Text
from hedron_notebook import start_preview

app = Hedron(
    title="Notebook demo",
    security="standard",
    session_secret="dev-only",
    explorer="off",
)


@app.page("/")
def home() -> Page:
    return Page(Text("Hello from a notebook preview"), title="Demo")


preview = start_preview(app)
print(preview.url)
# In a Jupyter cell:
# display HTML with preview.iframe_html()
preview.shutdown()

Public API

Symbol Role
start_preview(app) Start a local preview server for an ASGI app (token-gated)
NotebookPreview Handle with .url, .iframe_html(), .shutdown()
wrap_preview_app(app, token) ASGI wrapper requiring the preview session token
PreviewTokenGate Pure-ASGI middleware used by start_preview

License

MIT. See the repository license.

Release files for hedron-notebook 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hedron-notebook 0.2.1
File Size Uploaded
hedron_notebook-0.2.1.tar.gz 13.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hedron-notebook 0.2.1
File Interpreter ABI Platform
hedron_notebook-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 29.0 kB

Release files / hedron_notebook-0.2.1.tar.gz

Download URL hedron_notebook-0.2.1.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
37bac4af87c585cef3f5acdc237f6c6437d47ba1c3106e594d092edbc1be0a6c
BLAKE2b-256 checksum
How to use checksums
25017bf51f3db19f47d6deb5f4f0bd0aad13b57c6dcabd727053caf64fd83733
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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 / hedron_notebook-0.2.1-py3-none-any.whl

Download URL hedron_notebook-0.2.1-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
58ac8de0f142eaf44fb07ccf00897a5d0147ac821f429c9f0599b9b45555fca4
BLAKE2b-256 checksum
How to use checksums
e128f0736a0a6f275061a7e9c52d076ee1674f80f6f6b13629e2698b9d6496ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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 history Release notifications | RSS feed

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page