Skip to main content

hedron-flask

PyPI Python CI License: MIT

Flask adapter for Hedron component rendering and HTMX interactions.

Render Page / fragment components with the same hedron-core renderer used by FastAPI, map portable InteractionResult values to native Flask responses, and integrate CSRF double-submit cookies with Flask sessions. Does not install FastAPI.

Package maturity: Beta · Train: 0.25.x (last published 0.25.1; workspace 0.25.2 candidate) · pin >=0.25.0,<0.26

Adapter capability readiness is Supported when pinned — see What’s ready.

Install

pip install "hedron-flask>=0.25.0,<0.26"
# or
uv add "hedron-flask>=0.25.0,<0.26"

Requires Python 3.11–3.14, hedron-core, and Flask 3.x.

Scaffold a new Flask app:

uvx --from "hedron>=0.25.0,<0.26" hedron new --flask my-flask-app

Quick start

from flask import Flask
from hedron_core import Heading, Page, Text
from hedron_core.interaction import FragmentRegion, InteractionResult
from hedron_flask import HedronBlueprint, HedronFlask

hedron = HedronFlask()
ui = HedronBlueprint("ui", __name__)
PANEL = FragmentRegion(id="panel", selector="#panel")


@ui.page("/")
def home():
    return Page(
        Heading("Hello Flask", level=1),
        Text("Native Flask routing with Hedron components."),
        title="Home",
    )


@ui.component("/fragment", fragment_regions=(PANEL,))
def fragment():
    return InteractionResult(content=Text("Fragment ok"), explanation="demo")


def create_app() -> Flask:
    app = Flask(__name__)
    app.secret_key = "replace-in-production"
    hedron.init_app(app)
    app.register_blueprint(ui)
    return app
flask --app app:create_app run --reload

What this package includes

  • HedronFlask / init_app application integration
  • HedronBlueprint with @page / @component / @action style routing
  • component_response / interaction_response helpers
  • Fragment region authorization and approved HTMX header merging
  • Portable SecurityPolicy headers and Flask-Login AuthSignal bridge
  • Job status polling helpers (poll_status_response)

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_flask-0.25.2.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

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

hedron_flask-0.25.2-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file hedron_flask-0.25.2.tar.gz.

File metadata

  • Download URL: hedron_flask-0.25.2.tar.gz
  • Upload date:
  • Size: 17.5 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_flask-0.25.2.tar.gz
Algorithm Hash digest
SHA256 943c99d9f94a36b8216345bbf3cf737199376f9b3709652ba005f030c4d3cf05
MD5 0015eadd9fa7d638f31595fe868041b7
BLAKE2b-256 4b838a359990779f079db8f1f5f39cd30a676e73dee6cd7e59fe80e6e1edb0cf

See more details on using hashes here.

File details

Details for the file hedron_flask-0.25.2-py3-none-any.whl.

File metadata

  • Download URL: hedron_flask-0.25.2-py3-none-any.whl
  • Upload date:
  • Size: 20.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_flask-0.25.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9362b82c4ce463a37370d48f6d00bf6fdebdaa54ecee8b5ec1f84798ea643767
MD5 e22d8b29bc6c0a4c6b5954ae4f89d0d0
BLAKE2b-256 a174e558225cb2cfc24dfa42d1006f60c6cb18fc4068dcd925ddaa6d5c550c74

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