Skip to main content

inguitive

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 uvicorn

inguitive depends on FastAPI but does not install an ASGI server — pick one yourself. uvicorn is the lightest option; uvicorn[standard] adds performant extras like uvloop and httptools. fastapi dev also works once fastapi[standard] is installed, but it's a thin wrapper around uvicorn.

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) and SessionState (per-session). state.set() triggers automatic partial page updates via HTMX out-of-band (OOB) swaps to components that listen_to that 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=increment on a component resolves to the handler's URL; listen_to=counter resolves 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 — MemoryBackend for development (default), RedisBackend for production via the optional inguitive[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.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for inguitive 2.1.0
File Size Uploaded Provenance
inguitive-2.1.0.tar.gz 194.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for inguitive 2.1.0
File Interpreter ABI Platform
inguitive-2.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 356.9 kB

Release files / inguitive-2.1.0.tar.gz

Download URL inguitive-2.1.0.tar.gz
Size 194.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d9d0dbc12e5801fec2682b7e17e81a0d95df9dff3faf6cab88092790d10f8899
BLAKE2b-256 checksum
How to use checksums
028b1e0a843b2db028ac68b969cfb245979ad7d66d79e021668339cf1022aaff
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.1.0-py3-none-any.whl

Download URL inguitive-2.1.0-py3-none-any.whl
Size 162.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a6b5dd9117886f8b2c54d3fd9554849645b2d9fc4bd7632982c863412231f23d
BLAKE2b-256 checksum
How to use checksums
c08bc6862cc9325258032e1045a433b2661959ec560cfe812b13cd057c7e5b81
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.1.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page