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.2.3,<0.3"  # requires Hedron and core >=1.0.0,<2.0
# or
uv add "hedron-notebook>=0.1.0,<0.2"
# via flagship extra:
pip install "hedron[notebook]>=1.0.0"

Requires Python 3.10–3.14.

Optional server extra (uvicorn):

pip install "hedron-notebook[server]>=0.2.3,<0.3"

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

Links

License

MIT. See the repository license.

Release files for hedron-notebook 0.2.4

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.4
File Size Uploaded
hedron_notebook-0.2.4.tar.gz 13.6 kB Details

Built distribution (wheel)

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

Total release size: 29.3 kB

Release files / hedron_notebook-0.2.4.tar.gz

Download URL hedron_notebook-0.2.4.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0c5a26767439fcec385373912d6fefe09159b435358eb86ba47bf22bbd40b714
BLAKE2b-256 checksum
How to use checksums
45e4d2fb40861eb3c9d67e269055d911ef17869f8b2c41092dc56ab190d353cf
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.4-py3-none-any.whl

Download URL hedron_notebook-0.2.4-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3cf88250c3427c7c9feed493cf9491b1a44e2a62cf5d8077cb346f0664602195
BLAKE2b-256 checksum
How to use checksums
cd7d9b97090574848e0aed2081d1d991685e825c907b23d968b7e2a032d1661a
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

This release

0.2.4 This release

2 release files

0.2.3

2 release files

0.2.1

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