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

License

MIT. See the repository license.

Release files for hedron-notebook 0.2.5

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.5
File Size Uploaded
hedron_notebook-0.2.5.tar.gz 13.7 kB Details

Built distribution (wheel)

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

Total release size: 29.5 kB

Release files / hedron_notebook-0.2.5.tar.gz

Download URL hedron_notebook-0.2.5.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
fdae6bddbc22b1d9f606c4edcc3278e3293458f3cba9140c03855d9bd6ce7dc5
BLAKE2b-256 checksum
How to use checksums
e200eb89ee00693f3ad3dd9ff9079dbbeadfc25be849a43f11bbfbb2e65d2dbe
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.5-py3-none-any.whl

Download URL hedron_notebook-0.2.5-py3-none-any.whl
Size 15.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
643b70520725e4567922254073ae2d47bd7c2cbe9487db9f11851350796a95ea
BLAKE2b-256 checksum
How to use checksums
0e438dbf856af5b84fc9a99e1e9a84f7806a8dc8eb5b5b5837d9414fa03e8142
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

This release

0.2.5 This release

2 release files

0.2.4

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