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.52.0,<0.53"

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

Links

License

MIT. See the repository license.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hedron_notebook-0.2.0.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hedron_notebook-0.2.0-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file hedron_notebook-0.2.0.tar.gz.

File metadata

  • Download URL: hedron_notebook-0.2.0.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for hedron_notebook-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d9f8c7743f1bc56bd95e034aefdfa73a7f457539bbdd36a887e251daeaaca4bf
MD5 1772fbb8975b715395783a423344f528
BLAKE2b-256 add91e1555eefaced28187a8f15f4baf11b24a744ed9729e6fb36c749018c047

See more details on using hashes here.

File details

Details for the file hedron_notebook-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: hedron_notebook-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for hedron_notebook-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e2c4baaba944f039a186e91c4de41bf9e0067c43218fdc173e9a222f697c6c50
MD5 d1880c94741e778ebd22bc4c0d79281a
BLAKE2b-256 c8f8308d9225ce6603d0c08e1e8dee284c8e8cbbb70080d519e31eb379958bcd

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page