hedron-sim
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fb03ea956ea2affaf1c8ddeb67aa73757a60f81d05818cc35c43005f0eae805
|
|
| MD5 |
f870ea4c3f2219ba18928c8255507543
|
|
| BLAKE2b-256 |
9daa488436256da00eefb8d6695b6912b4eb79b95756c41dbb5e6905f4b5165d
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2ba857ed3a7bd8b089ed136f812aec4cb6fc103f348bd10128fadc8841fb0bb
|
|
| MD5 |
962e1b3eac5820c6a8fe90f08c2aeb68
|
|
| BLAKE2b-256 |
4d3bc1fa84ed4552207db320c5e20d218b5e9aa2e3ed614c1ca4db33cf6a43c5
|