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 typed, 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.

Package identity: PyPI releases older than 0.1.0 belong to an unrelated, retired geolocation package. This web framework begins at 0.1.0; there is no API or migration continuity with the legacy project.

A Hedron app with a status panel updated by HTMX

Try it in five minutes

Requires Python 3.11–3.14. The fastest path uses uv:

uvx --from "hedron>=0.28.1,<0.29" 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 is ordinary Python:

import os
from datetime import UTC, datetime

from hedron import Hedron, Page, RefreshButton, Stack, Text, html, swap

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

status = app.region("service-status", description="Live status panel")


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


@app.page("/")
def home() -> Page:
    return Page(
        Stack(
            Text("Hello from Hedron"),
            status_panel(),
            RefreshButton.for_region(status, href="/status", label="Refresh status"),
        ),
        title="Home",
    )


@app.fragment("/status", region=status)
def refresh_status():
    return swap(status_panel())

The declared region is both the browser swap target and a server-side allowlist. Requests aimed at undeclared targets fail closed.

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

What Hedron gives you

Need Hedron provides
Server-rendered UI Typed 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, typed 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 typed Python. 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

Pin the current Beta train so upgrades are intentional:

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

Package maturity: Beta · Train: 0.28.x · last published 0.28.1 · pin >=0.28.1,<0.29

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, typed UI, 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[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[notebook], hedron[mcp], hedron[gradio] Experimental Alpha integrations

For example:

uv add "hedron[data,dev]>=0.28.1,<0.29"

Charts require the fixed compatible floor:

uv add "hedron[charts]>=0.28.1,<0.29"

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.

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.28.1.tar.gz (127.9 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.28.1-py3-none-any.whl (147.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hedron-0.28.1.tar.gz
  • Upload date:
  • Size: 127.9 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-0.28.1.tar.gz
Algorithm Hash digest
SHA256 f3f7ad9a72cf4939323c0e58a4ebf5e58ee046f7ffefd530983b5e09de90e242
MD5 e4ce3220d00dc9731de0c9cc21bc7397
BLAKE2b-256 9583274cc137a8178e7cbcf11fa1a041cf67d0043c20de95928c5e9a9a24385a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hedron-0.28.1-py3-none-any.whl
  • Upload date:
  • Size: 147.4 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-0.28.1-py3-none-any.whl
Algorithm Hash digest
SHA256 635714bcf405534a3ce7317962590d04d16e85e47b36342cf75f440a482406a5
MD5 c4fb0b0ed510fa58cbcb1fd7717e4d4b
BLAKE2b-256 b60f3b005121d84cae5f8d4a457cd743c00c54a483ce4e11d1355dfbbfd5e73a

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