Skip to main content

hedron-sim

PyPI Python CI License: MIT

Offline HTMX simulation for Hedron docs and demos.

Author demos with ordinary Hedron components (Page, RefreshButton, swap, regions), then embed them in static docs. A small JavaScript runtime intercepts hx-* attributes and serves pre-rendered fragment HTML — no FastAPI process required.

Package maturity: Beta tooling-grade (0.1.x) · pin >=0.1.0,<0.2

Install

pip install "hedron-sim>=0.1.0,<0.2"
# or
uv add "hedron-sim>=0.1.0,<0.2"

Requires Python 3.11–3.14 and hedron (for component imports used in demos).

Quick start

from hedron import Page, RefreshButton, Stack, Text, html, swap
from hedron_sim import SimApp, embed_demo, sim_utc

app = SimApp(demo_id="hello-status")
status = app.region("service-status")


def status_panel():
    return html.div(
        Text(f"All systems operational · refreshed {sim_utc()}"),
        id=status.id,
        role="status",
        aria={"live": "polite"},
    )


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


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


print(embed_demo(app))

Ship static assets

from pathlib import Path
from hedron_sim.assets import copy_assets

copy_assets(Path("docs/javascript"), Path("docs/stylesheets"))

Then load hedron-sim.js (and optionally hedron-sim.css) from MkDocs extra_javascript / extra_css.

Public API

Symbol Role
SimApp Offline app with @page / @fragment and regions
embed_demo(app) HTML snippet for static docs
sim_utc / sim_local_time Deterministic clock helpers for demos
hedron_sim.assets.copy_assets Copy JS/CSS into a docs tree

Links

License

MIT. See the repository 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_sim-0.2.0.tar.gz (26.1 kB view details)

Uploaded Source

Built Distribution

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

hedron_sim-0.2.0-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

File details

Details for the file hedron_sim-0.2.0.tar.gz.

File metadata

  • Download URL: hedron_sim-0.2.0.tar.gz
  • Upload date:
  • Size: 26.1 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_sim-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3fb03ea956ea2affaf1c8ddeb67aa73757a60f81d05818cc35c43005f0eae805
MD5 f870ea4c3f2219ba18928c8255507543
BLAKE2b-256 9daa488436256da00eefb8d6695b6912b4eb79b95756c41dbb5e6905f4b5165d

See more details on using hashes here.

File details

Details for the file hedron_sim-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: hedron_sim-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 29.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

Hashes for hedron_sim-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c2ba857ed3a7bd8b089ed136f812aec4cb6fc103f348bd10128fadc8841fb0bb
MD5 962e1b3eac5820c6a8fe90f08c2aeb68
BLAKE2b-256 4d3bc1fa84ed4552207db320c5e20d218b5e9aa2e3ed614c1ca4db33cf6a43c5

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.0

2 files

Supported by

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