--- id: datastar-py version: "1.0.2" license: MIT license_treatment: permissive maintenance: active --- # datastar-py — Helper functions and classes for the Datastar library (https://data-star.dev/) License: permissive · Maintenance: active · Downloads: 170.2K/mo ## What it is and what it does Datastar-py is a Python SDK that enables real-time, bidirectional communication between backend applications and browsers via server-sent events. Instead of the traditional request-response cycle, a single HTTP request can trigger a stream of events from the backend to the browser, allowing the server to push updates at any time. The package provides low-level event generation primitives (patch_elements, patch_signals) that work with any framework, plus framework-specific decorators and response classes for Django, FastAPI, FastHTML, Litestar, Quart, Sanic, and Starlette. The SDK handles three main concerns: generating SSE-formatted events, wrapping those events in framework-appropriate response objects, and reading signal state (frontend data) sent with each request. It also includes an attribute generator for building data-* HTML attributes with IDE completion and type checking. The package has no external runtime dependencies and supports Python 3.10 through 3.14. Use it for: - Real-time dashboard updates: push live metrics or status changes to a browser without polling. - Live form validation: send validation feedback to the browser as the user types, using signals to track state. - Streaming data visualization: continuously update charts or tables with new data from a long-lived SSE connection. - Collaborative editing: broadcast changes made by one user to all connected clients in real time. - Progress tracking: stream progress updates from a long-running backend task to show live status. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Datastar-py provides a Python SDK for building server-sent event (SSE) responses that allow backends to push real-time updates to browsers, with built-in helpers for multiple web frameworks. Yes. Datastar-py is actively maintained, has no external dependencies, and provides a clean abstraction for SSE-based real-time communication across multiple popular frameworks. It's suitable for production use if you're building applications that need server-to-browser push updates. The MIT license imposes no restrictions. ## Install pip install datastar-py uv add datastar-py poetry add datastar-py ## Installing datastar-py Before you install: Low friction to install—pure Python wheel with no runtime dependencies. The package is actively maintained with a recent release (73 days ago) and has accumulated 172 stars on its repository. License in practice: MIT license is permissive; you can use this package freely in commercial and private projects without restriction. Quickstart: pip install datastar-py from datastar_py import ServerSentEventGenerator as SSE, attribute_generator as data # Generate SSE events event = SSE.patch_elements("