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: Alpha (0.1.x) · pin >=0.1.0,<0.2 and expect churn

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 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.1.0.tar.gz (17.2 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.1.0-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hedron_sim-0.1.0.tar.gz
  • Upload date:
  • Size: 17.2 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.1.0.tar.gz
Algorithm Hash digest
SHA256 b386a4283e7968f80b7f45ab965a09e8636271d443a80137e13f697abb58d10a
MD5 0676cc98f303311f3b2cf3049ac8740c
BLAKE2b-256 8265a29be494099580b2328d905d3748ca2c15ff3caad4468cf7e1ae56b5cf1d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hedron_sim-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.0 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a0e7c42d00b9f05fb255e8ae54e105368bf7fd67f9b95c638be8115988137f14
MD5 6b156c92c96483ede048f392518711d5
BLAKE2b-256 1e29519bd841d4c666f964f9394f83a315b73f71f3d0042cf6ebf7a1fcef9b1d

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.0

2 files

This release

0.1.0 This release

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