hedron
FastAPI-native typed component framework for HTML and HTMX.
Builds on framework-neutral hedron-core
with pages, addressable components, typed actions, CSRF-aware forms, OpenAPI
text/html metadata, interaction built-ins (Lazy, Poll, Pagination, …),
caching (cache_data / cache_component), utility UI, ColorMode persistence,
a thin Hedron() application facade, CLI (new/check/graph/build/…),
plugin loader, and public hedron.testing helpers.
Install
pip install "hedron>=0.19.0,<0.20"
# or
uv add "hedron>=0.19.0,<0.20"
Optional extras (pin the train):
pip install "hedron[data]>=0.19.0,<0.20"
pip install "hedron[charts]>=0.1.0,<0.2" # Alpha
pip install "hedron[dev]>=0.19.0,<0.20"
pip install "hedron[gradio]>=0.1.0,<0.2" # Alpha
pip install "hedron[browser]>=0.19.0,<0.20"
Requires Python 3.11, 3.12, 3.13, or 3.14. Current train: 0.19.0 (Beta; Ready to cut
on main; last published PyPI/git = v0.18.0).
Quick start
Prefer the scaffold so you get Hello from hedron new and a working Refresh status click (HTMX swaps a small HTML fragment into a declared region):
# Need uv? https://docs.astral.sh/uv/getting-started/installation/
uvx --from "hedron>=0.19.0,<0.20" hedron new my-hedron-app
cd my-hedron-app && uv sync && uv run uvicorn app:app --reload
Open http://127.0.0.1:8000 — click Refresh status; the timestamp should update.
Full walkthrough: Build your first app.
Alternate — static Hello (no Refresh)
This snippet is a static page only (no HTMX Refresh). Prefer the scaffold above for the interactive first-hour experience.
from hedron import Hedron, Page, Text
app = Hedron(
title="Demo",
security="standard",
session_secret="replace-in-production",
explorer="off",
)
@app.page("/")
def home() -> Page:
return Page(Text("Hello, Hedron"), title="Demo")
pip install "hedron>=0.19.0,<0.20" "uvicorn[standard]"
uvicorn app:app --reload
Plain FastAPI without the Hedron subclass:
from fastapi import FastAPI
from hedron import HTML, HedronRouter, Text, hedron_response, mount_hedron_static
from hedron.security.policy import SecurityPolicy
app = FastAPI()
app.state.hedron_security = SecurityPolicy.from_name("standard")
mount_hedron_static(app)
router = HedronRouter()
@router.get("/card", **hedron_response())
def card():
return HTML(Text("plain"))
app.include_router(router)
CLI inspection (optionally load an app module first):
hedron new demoapp
cd demoapp
hedron --app app:app routes
hedron --app app:app components
hedron --app app:app preview home
hedron check --format json --severity error
hedron graph
hedron audit-components
Links
License
MIT. See LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hedron-0.19.0.tar.gz.
File metadata
- Download URL: hedron-0.19.0.tar.gz
- Upload date:
- Size: 113.6 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fc35ec94cdb4e3e5b479d80ce5fc4c3ce4ad50b094e863f8ddaaadfcd248b48
|
|
| MD5 |
f35f2177534034390ef9d0aba3d9aa0e
|
|
| BLAKE2b-256 |
a6fc0cb0672eb45e13026189d45fe4de91a7b7f7a7622f632f501ebdddea6678
|
File details
Details for the file hedron-0.19.0-py3-none-any.whl.
File metadata
- Download URL: hedron-0.19.0-py3-none-any.whl
- Upload date:
- Size: 135.2 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07546b68d7e23104fd91d54b1cb5046a2c73746c23f1d2dd93becd685b538d51
|
|
| MD5 |
6fa950944e9aa7bb9390b2d7681adb46
|
|
| BLAKE2b-256 |
2b33498b69eb9ad844102adea8b435bdc62ba9a016cd2981d95718dc5e0d634d
|