inguitive
A pure Python UI layer for FastAPI — an alternative to template engines like Jinja2. Compose pages from Python components instead of templates, with reactive state and SSE-driven partial updates via HTMX. Styled with Tailwind CSS.
Components automatically re-render when state changes, eliminating the need for manual DOM manipulation or JavaScript. inguitive complements FastAPI rather than replacing it: routing, path parameters, form handling, and lifespan events stay FastAPI's job; inguitive owns the UI.
Quick Start
pip install inguitive
from fastapi import FastAPI
from inguitive import UI, Div, Button, Text, SessionState
app = FastAPI()
ui = UI(app, title="Counter") # attaches middleware, the /_sse route, and /static
counter = SessionState(0, "counter")
@ui.trigger_handler
def increment():
counter.set(counter.get() + 1) # listening components re-render automatically
@app.get("/")
def home():
return ui.page(
Div(
Text(lambda: f"Count: {counter.get()}", listen_to=counter),
Button("+1", trigger=increment),
),
)
Run it with uvicorn app:app --reload and open http://localhost:8000.
Features
- Components — composable UI primitives (
Div,Text,Button, ...). All attributes can be static strings or callables. - State system —
State(global, shared across sessions) andSessionState(per-session).state.set()triggers automatic partial page updates via HTMX out-of-band (OOB) swaps to components thatlisten_tothat state. - SSE workflow — server-initiated updates, both global (broadcast to all sessions) and session-scoped (pushed to one session's open connections).
- Trigger handlers — Python functions wired to HTMX POST actions via
@ui.trigger_handler.trigger=incrementon a component resolves to the handler's URL;listen_to=counterresolves to the state object. ui.page()— renders the full HTML document shell (<!DOCTYPE html>,<head>, HTMX/Tailwind CDN scripts, the hidden SSE auto-connect div). You compose only the body content with components.- Session backends —
MemoryBackendfor development (default),RedisBackendfor production via the optionalinguitive[redis]extra.
Documentation
For the full component reference, guides, and API docs, see docs/index.md.
License
MIT License — see LICENSE for details.
Contact: GitHub · Issues · info@stork-software.de
Metadata
Release files for inguitive 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| inguitive-2.0.0.tar.gz | 192.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| inguitive-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 353.1 kB
Release files / inguitive-2.0.0.tar.gz
| Download URL | inguitive-2.0.0.tar.gz |
|---|---|
| Size | 192.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e04c00f925c55a4f961c2a8b1c3f35594e1dabaa16c92e575efd6a5ffb978d4
|
|
BLAKE2b-256 checksum How to use checksums |
09b0388d97dc8455b5ed02809c9a4f48f5d6ea33aee74a8bc32219cfdff8b8c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / inguitive-2.0.0-py3-none-any.whl
| Download URL | inguitive-2.0.0-py3-none-any.whl |
|---|---|
| Size | 160.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f72bef6ee162d9ebcede8601790cf617db7371756b1ffa6056da66b3853dc6f3
|
|
BLAKE2b-256 checksum How to use checksums |
b07982ead582cb570f610141e85bb16ebff68855d0d2fda6fa3251470d5bd352
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for inguitive 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.