Skip to main content

Hedron

PyPI Python CI License: MIT

Build admin tools, CRUD apps, and dashboards in Python—without building a separate frontend.

Hedron is a server-rendered UI framework for FastAPI. Routes return Python components, Hedron renders safe HTML, and HTMX updates just the part of the page that changed. You keep FastAPI's routing, dependency injection, middleware, and JSON APIs; you do not need a Node.js toolchain or a full-script rerun model.

A Hedron app with a status panel updated by HTMX

Requires Python 3.11–3.14. The latest public PyPI release is hedron>=0.64.0,<0.65 (v0.64.0). The fastest path uses uv:

uvx --from "hedron>=0.64.0,<0.65" hedron new my-hedron-app
cd my-hedron-app
uv sync
uv run uvicorn app:app --reload

Open http://127.0.0.1:8000, then click Refresh status. Only the status region is returned and swapped into the page.

The generated app (from hedron new) is ordinary Python:

import os
from datetime import UTC, datetime

from hedron import Hedron, Stack, Text, html

app = Hedron(
    title="Hedron App",
    security="standard",
    explorer="off",
    session_secret=os.environ.get("HEDRON_SESSION_SECRET", "replace-in-production"),
)


@app.refreshable("/status")
def status():
    stamp = datetime.now(UTC).strftime("%H:%M:%S UTC")
    return html.div(
        Text(f"All systems operational · refreshed {stamp}"),
        role="status",
        aria={"live": "polite"},
    )


@app.command(fallback="/")
def ping():
    from hedron import refresh

    return refresh(status).toast("Refreshed")


@app.screen("/", title="Home")
def home():
    return Stack(
        Text("Hello from hedron new"),
        status(),
        status.refresh_button("Refresh status"),
        ping.button("Ping"),
    )

Prefer @app.screen for new apps. Use explicit Page + @app.page only when you need full Page constructor control (docs).

Undeclared HTMX targets fail closed.

Follow the first-app walkthrough or browse the single-file examples.

What Hedron gives you

Need Hedron provides
Server-rendered UI Pages, layouts, forms, tables, dialogs, status views, and media components
Partial-page interaction Declared HTMX fragments, out-of-band updates, progressive-enhancement paths, and target allowlists
FastAPI integration Normal routes, dependencies, middleware, lifespan hooks, responses, and OpenAPI alongside UI routes
Safer defaults Contextual escaping, explicit URL/HTML trust boundaries, CSRF profiles, and conservative caching
Production building blocks Polling jobs, diagnostics, testing helpers, build manifests, deployment guidance, and Flask/Django adapters

Your application still owns authentication, authorization, persistence, tenancy, and deployment. Hedron is not an ORM, identity provider, hosted service, or client-side SPA runtime.

When it fits

Choose Hedron when you want to build forms, internal tools, admin surfaces, or dashboards as a conventional web application while keeping most UI code in Python components. It is especially useful when raw FastAPI plus Jinja plus HTMX would leave you assembling the same rendering, fragment, CSRF, asset, and component conventions yourself.

Choose Streamlit for notebook-style, full-script-rerun data apps. Choose raw FastAPI and templates when you do not want a component framework. Choose a client-side framework when the product genuinely needs a large browser-side state model.

Coming from Streamlit? Start with the migration center.

Install

The latest installable PyPI release is hedron>=0.64.0,<0.65. The repository checkout provides the verified 0.64.x release candidate. Use uv sync when working from a checkout.

uv add "hedron>=0.64.0,<0.65" "uvicorn[standard]"
# or
python -m pip install "hedron>=0.64.0,<0.65" "uvicorn[standard]"

Package maturity: Beta · Repository train: 0.64.x · Repository tip: 0.64.0 · Latest PyPI release: 0.64.0 · Application pin: >=0.64.0,<0.65

Before deploying, read What's ready today and the shipping guide. Polling is the supported production status-update path; SSE and WebSocket helpers remain experimental.

Add only what you need

The base package includes the FastAPI application, Python UI components, HTML renderer, HTMX interactions, security profiles, and CLI. Integrations are optional:

Install Adds
hedron[data] DataTable and DataEditor
hedron[charts] Charts with a compatible satellite floor
hedron[maps] First-class maps (hedron-maps)
hedron[jinja] Optional .hdj templates
hedron[dev] Component Explorer
hedron[extras] Curated workbenches
hedron[auth] Authlib OIDC helpers
hedron[markdown] Markdown rendering and sanitization
hedron[native] Optional Beta native acceleration
hedron[mcp] Beta MCP projection (Supported inventory; mutations Experimental)
hedron[notebook] Beta tooling-grade localhost preview; not a production server
hedron[gradio] Beta allowlisted Gradio/Hugging Face client interoperability
hedron[elements] Beta Web Component ABI (Supported inventory only)

For example:

uv add "hedron[data,dev]>=0.64.0,<0.65"

Charts require the fixed compatible floor:

uv add "hedron[charts]>=0.64.0,<0.65"

See the full installation and extras guide and the compatibility matrix.

Already have a FastAPI app?

You can mount Hedron's router and static assets without replacing your application:

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)

ui = HedronRouter()


@ui.get("/hello", **hedron_response())
def hello():
    return HTML(Text("Hello from Hedron"))


app.include_router(ui)

Read the existing-FastAPI guide. Flask and Django hosts are available through hedron-flask and hedron-django; both share the framework-neutral hedron-core renderer.

CLI

python -m hedron new demoapp
python -m hedron --app app:app routes
python -m hedron --app app:app components
python -m hedron --app app:app preview home
python -m hedron --app app:app check
python -m hedron --app app:app graph

Learn more

License

MIT. See the license.

Release files for hedron 0.65.0

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 0.65.0
File Size Uploaded
hedron-0.65.0.tar.gz 296.6 kB Details

Built distribution (wheel)

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

Total release size: 659.5 kB

Release files / hedron-0.65.0.tar.gz

Download URL hedron-0.65.0.tar.gz
Size 296.6 kB
Tags Source
SHA-256 checksum
How to use checksums
302ed4931da3e1809d2647f8d707c4d648fc349e8ffb2fa8fd90d1caddc21817
BLAKE2b-256 checksum
How to use checksums
c0596999dd65caeb950188ce98d982dfd67e383a5267d2aa048a0e16edfb934f
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-0.65.0-py3-none-any.whl

Download URL hedron-0.65.0-py3-none-any.whl
Size 362.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8c08e2b5689dba9d05a034b8cfbbc21e873563d2377dc5b61b645924e8187886
BLAKE2b-256 checksum
How to use checksums
159429e0b226df0fd1f069950ecbffe2cdd2e85b2b90c97a1131509a06d808d3
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

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.18

2 release files

1.0.17

2 release files

1.0.16

2 release files

1.0.15

2 release files

1.0.14

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.67.0

2 release files

0.66.2

2 release files

0.66.1

2 release files

0.66.0

2 release files

This release

0.65.0 This release

2 release files

0.64.1

2 release files

0.64.0

2 release files

0.63.0

2 release files

0.62.0

2 release files

0.61.0

2 release files

0.60.2

2 release files

0.60.1

2 release files

0.60.0

2 release files

0.59.0

2 release files

0.58.1

2 release files

0.58.0

2 release files

0.57.0

2 release files

0.56.0

2 release files

0.55.0

2 release files

0.54.0

2 release files

0.53.0

2 release files

0.52.0

2 release files

0.51.2

2 release files

0.51.1

2 release files

0.51.0

2 release files

0.50.3

2 release files

0.50.2

2 release files

0.50.1

2 release files

0.50.0

2 release files

0.49.1

2 release files

0.49.0

2 release files

0.48.0

2 release files

0.47.0

2 release files

0.46.0

2 release files

0.45.0

2 release files

0.44.0

2 release files

0.43.0

2 release files

0.42.0

2 release files

0.41.0

2 release files

0.40.0

2 release files

0.39.0

2 release files

0.38.0

2 release files

0.37.0

2 release files

0.36.0

2 release files

0.35.0

2 release files

0.34.0

2 release files

0.33.0

2 release files

0.32.0

2 release files

0.31.0

2 release files

0.30.0

2 release files

0.29.0

2 release files

0.28.2

2 release files

0.28.1

2 release files

0.28.0

2 release files

0.27.0

2 release files

0.26.1

2 release files

0.26.0

2 release files

0.25.2

2 release files

0.25.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

1 release file

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.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