Modern HTML generation in Python, inspired by FastHTML
Project description
StarHTML
A Python-first hypermedia framework, forked from FastHTML. Uses Datastar instead of HTMX for the same hypermedia-driven approach with a different flavor.
Installation
pip install starhtml
Quick Start
from starhtml import *
from starhtml.datastar import ds_text, ds_on_click, ds_signals
app, rt = star_app()
@rt('/')
def home():
return Div(
H1("StarHTML Demo"),
# Client-side reactivity with signals
Div(
P("Count: ", Span(ds_text("$count"))),
Button("++", ds_on_click("$count++")),
Button("Reset", ds_on_click("$count = 0")),
ds_signals(count=0)
),
# Server-side interactions
Button("Load Data", ds_on_click("@get('/api/data')")),
Div(id="content")
)
@rt('/api/data')
def get():
return Div("Data loaded from server!", id="content")
serve()
Run with python main.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 .
Links
StarHTML is a respectful fork of FastHTML. We're grateful to the FastHTML team for the excellent foundation.
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.1.8.tar.gz.
File metadata
- Download URL: starhtml-0.1.8.tar.gz
- Upload date:
- Size: 372.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db7f4bee7a237edbf5e2a8ca37e2d2f23f0b13787309a4eb1df12f1d3dfc009b
|
|
| MD5 |
46597a07d67f2913dde98565a27dcf0e
|
|
| BLAKE2b-256 |
b5900e46562d8ea03b08fca4695cd8e8f52f56aaf6fb75d038382e7247d4be57
|
Provenance
The following attestation bundles were made for starhtml-0.1.8.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.1.8.tar.gz -
Subject digest:
db7f4bee7a237edbf5e2a8ca37e2d2f23f0b13787309a4eb1df12f1d3dfc009b - Sigstore transparency entry: 435593083
- Sigstore integration time:
-
Permalink:
banditburai/starHTML@91a80624b789deb089b3b37d457d459ea59361b1 -
Branch / Tag:
refs/tags/v0.1.8 - Owner: https://github.com/banditburai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@91a80624b789deb089b3b37d457d459ea59361b1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file starhtml-0.1.8-py3-none-any.whl.
File metadata
- Download URL: starhtml-0.1.8-py3-none-any.whl
- Upload date:
- Size: 75.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e473e2984d1b677df2a324108c3d099609e720c96084286c91f4d5ed6180f5d1
|
|
| MD5 |
cb55f5b1c384107602cda22d9f59bef7
|
|
| BLAKE2b-256 |
3d7473a5d0c4bd2d20dc552f1983fd0c7971feac7fc953b853bf51ce71bfe2db
|
Provenance
The following attestation bundles were made for starhtml-0.1.8-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.1.8-py3-none-any.whl -
Subject digest:
e473e2984d1b677df2a324108c3d099609e720c96084286c91f4d5ed6180f5d1 - Sigstore transparency entry: 435593085
- Sigstore integration time:
-
Permalink:
banditburai/starHTML@91a80624b789deb089b3b37d457d459ea59361b1 -
Branch / Tag:
refs/tags/v0.1.8 - Owner: https://github.com/banditburai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@91a80624b789deb089b3b37d457d459ea59361b1 -
Trigger Event:
push
-
Statement type: