hedron-notebook
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,<1.1"
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.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hedron_notebook-0.2.3.tar.gz | 13.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hedron_notebook-0.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.3 kB
Release files / hedron_notebook-0.2.3.tar.gz
| Download URL | hedron_notebook-0.2.3.tar.gz |
|---|---|
| Size | 13.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b43cdb6851acaaeec09b0692f197d350f5ea898ded2787db5a5a23cee1fda574
|
|
BLAKE2b-256 checksum How to use checksums |
75bf2589159433ef365b0ab6125191767b732c8c012a7f022ff1c4a7c8217bdb
|
| 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.3-py3-none-any.whl
| Download URL | hedron_notebook-0.2.3-py3-none-any.whl |
|---|---|
| Size | 15.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
21d0d7dc63f9e89164208d1be64206b644683af0cae05ffc11176872f9b82b1f
|
|
BLAKE2b-256 checksum How to use checksums |
e86df86a85b17e46ac6790f7aa0a9eae6169068a47c30bdfcd39eb9607fc75ec
|
| 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}
|