Skip to main content

hedron

PyPI Python CI License: MIT

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.18.0"
# or
uv add "hedron>=0.18.0"

Optional data and charts:

pip install "hedron[data]"
pip install "hedron[charts]"

Development Explorer:

pip install "hedron[dev]"

Optional Gradio interop (Alpha):

pip install "hedron[gradio]"

Optional browser testing extras:

pip install "hedron[browser]"

Requires Python 3.11, 3.12, 3.13, or 3.14. Current train: 0.18.0 (Beta).

Quick start

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")

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

hedron-0.18.0.tar.gz (111.2 kB view details)

Uploaded Source

Built Distribution

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

hedron-0.18.0-py3-none-any.whl (132.9 kB view details)

Uploaded Python 3

File details

Details for the file hedron-0.18.0.tar.gz.

File metadata

  • Download URL: hedron-0.18.0.tar.gz
  • Upload date:
  • Size: 111.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for hedron-0.18.0.tar.gz
Algorithm Hash digest
SHA256 41d0e9ef2dcd333a37bf3c4de8b7ebe059917275eb1f2f776ceb4ef5f5934d5a
MD5 782a00f5b2ee958e5ef0ac0e655b45c8
BLAKE2b-256 e3a52a50f48772d61833db1998f0754448ad29a706ce913c98086d9866b14e5d

See more details on using hashes here.

File details

Details for the file hedron-0.18.0-py3-none-any.whl.

File metadata

  • Download URL: hedron-0.18.0-py3-none-any.whl
  • Upload date:
  • Size: 132.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for hedron-0.18.0-py3-none-any.whl
Algorithm Hash digest
SHA256 faa913086d5616caca819876cd55892da215915af80b6fb31320c67dab82ae18
MD5 cf66cff48e36cb58d2a569372f37b82e
BLAKE2b-256 f3a3e8360fc13cf244f4f39a1f0e5508862f12655515be37e008b28d85faddeb

See more details on using hashes here.

Supported by

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