Metadata-Version: 2.4
Name: starhtml
Version: 0.1.2
Summary: Modern HTML generation in Python, inspired by FastHTML
License-File: LICENSE
License-File: NOTICE
Requires-Python: >=3.12
Requires-Dist: beautifulsoup4
Requires-Dist: fastcore
Requires-Dist: fastlite
Requires-Dist: httpx
Requires-Dist: itsdangerous
Requires-Dist: oauthlib
Requires-Dist: pytest-cov>=6.1.1
Requires-Dist: python-dateutil
Requires-Dist: python-multipart>=0.0.20
Requires-Dist: requests>=2.32.4
Requires-Dist: starlette
Requires-Dist: uvicorn[standard]
Provides-Extra: dev
Requires-Dist: brotli>=1.1.0; extra == 'dev'
Requires-Dist: ipykernel; extra == 'dev'
Requires-Dist: pip-tools; extra == 'dev'
Requires-Dist: psutil; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Provides-Extra: doc
Requires-Dist: mdx-include; extra == 'doc'
Requires-Dist: mkdocs; extra == 'doc'
Requires-Dist: mkdocs-material; extra == 'doc'
Provides-Extra: test
Requires-Dist: pytest; extra == 'test'
Requires-Dist: pytest-asyncio; extra == 'test'
Requires-Dist: pytest-cov; extra == 'test'
Requires-Dist: pytest-timeout; extra == 'test'
Requires-Dist: pytest-watch; extra == 'test'
Requires-Dist: pytest-xdist; extra == 'test'
Requires-Dist: python-multipart; extra == 'test'
Description-Content-Type: text/markdown

# StarHTML

A Python-first hypermedia framework, forked from FastHTML. Uses [Datastar](https://data-star.dev/) instead of HTMX for the same hypermedia-driven approach with a different flavor.

## Installation

```bash
pip install starhtml
```

## Quick Start

```python
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

```bash
git clone https://github.com/banditburai/starhtml.git
cd starhtml
uv sync  # or pip install -e ".[dev]"
pytest && ruff check .
```

## Links

- [Repository](https://github.com/banditburai/starhtml) • [Issues](https://github.com/banditburai/starhtml/issues) • [Discussions](https://github.com/banditburai/starhtml/discussions)
- [Original FastHTML](https://github.com/AnswerDotAI/fasthtml) • [Datastar](https://data-star.dev/)

---

*StarHTML is a respectful fork of [FastHTML](https://github.com/AnswerDotAI/fasthtml). We're grateful to the FastHTML team for the excellent foundation.*
