Modern HTML generation in Python, inspired by FastHTML
Project description
A Python-first hypermedia framework, forked from FastHTML. Uses Datastar instead of HTMX for the same hypermedia-driven approach with a different flavor.
Documentation · UI Components · Quick Start · Community · Issues
Key Features
- Python-First — Write reactive UIs using Python syntax with type safety and IDE support
- Reactive Signals — Hypermedia approach with data-attribute-powered client-side reactivity where needed
- Server-Sent Events — Built-in SSE support for real-time server interactions
- Framework Agnostic — Works with any CSS framework (Tailwind, DaisyUI)
- JavaScript Escape Hatch — Drop into raw JavaScript when needed for complex interactions
Quick Start
pip install starhtml
from starhtml import *
app, rt = star_app()
@rt('/')
def home():
return Div(
H1("StarHTML Demo"),
# Define reactive state with signals
Div(
(counter := Signal("counter", 0)), # Python-first signal definition
# Reactive UI that updates automatically
P("Count: ", Span(data_text=counter)),
Button("+", data_on_click=counter.add(1)),
Button("Reset", data_on_click=counter.set(0)),
# Conditional styling
data_class_active=counter > 0
),
# Server-side interactions
Button("Load Data", data_on_click=get("/api/data")),
Div(id="content")
)
@rt('/api/data')
def api_data():
return Div("Data loaded from server!", id="content")
serve()
Run with python app.py and visit http://localhost:5001.
What's Different?
| FastHTML | StarHTML |
|---|---|
| HTMX for server interactions | Datastar for reactive UI |
| Built with nbdev notebooks | Standard Python modules |
| Multiple JS extensions | Single reactive framework |
| WebSockets for real-time | SSE for real-time |
Development
git clone https://github.com/banditburai/starhtml.git
cd starhtml
uv sync # or pip install -e ".[dev]"
pytest && ruff check .
Contributions welcome — see CONTRIBUTING.md.
Acknowledgments
StarHTML is a fork of FastHTML. Built on Datastar for client-side reactivity.
Project details
Release history Release notifications | RSS feed
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 starhtml-0.5.12.tar.gz.
File metadata
- Download URL: starhtml-0.5.12.tar.gz
- Upload date:
- Size: 767.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b457de26df106224b2cfa4dbdae810ea5c19f9c2607da76b01f43422b8bec615
|
|
| MD5 |
aea6515eab12442cce7ed7d0f4dc8fa0
|
|
| BLAKE2b-256 |
f47b3e863654371b8189b67d328ea66c2a7745e1b5ad35054dfb463cbcb9d2dc
|
Provenance
The following attestation bundles were made for starhtml-0.5.12.tar.gz:
Publisher:
release.yml on banditburai/starHTML
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
starhtml-0.5.12.tar.gz -
Subject digest:
b457de26df106224b2cfa4dbdae810ea5c19f9c2607da76b01f43422b8bec615 - Sigstore transparency entry: 1006566764
- Sigstore integration time:
-
Permalink:
banditburai/starHTML@795d2ed0afe795799f2da76d872392d4fe8ee243 -
Branch / Tag:
refs/tags/v0.5.12 - Owner: https://github.com/banditburai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@795d2ed0afe795799f2da76d872392d4fe8ee243 -
Trigger Event:
push
-
Statement type:
File details
Details for the file starhtml-0.5.12-py3-none-any.whl.
File metadata
- Download URL: starhtml-0.5.12-py3-none-any.whl
- Upload date:
- Size: 146.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0309d1bad9dfbcfa66ce539939a759db83b46b7166e6e8f728721d2820aede6
|
|
| MD5 |
cbdac6c125960322f6bfe497cb948487
|
|
| BLAKE2b-256 |
037d8650ddae68cbb79c64e63dcb6148c62d20607583095007aed972b45994a6
|
Provenance
The following attestation bundles were made for starhtml-0.5.12-py3-none-any.whl:
Publisher:
release.yml on banditburai/starHTML
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
starhtml-0.5.12-py3-none-any.whl -
Subject digest:
e0309d1bad9dfbcfa66ce539939a759db83b46b7166e6e8f728721d2820aede6 - Sigstore transparency entry: 1006566766
- Sigstore integration time:
-
Permalink:
banditburai/starHTML@795d2ed0afe795799f2da76d872392d4fe8ee243 -
Branch / Tag:
refs/tags/v0.5.12 - Owner: https://github.com/banditburai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@795d2ed0afe795799f2da76d872392d4fe8ee243 -
Trigger Event:
push
-
Statement type: