larzsse
Server-Sent Events — server and client. Pure Python, no async, zero deps.
SSE is the simplest way to push a live stream of events from server to browser
(or any client) over plain HTTP — one long-lived text/event-stream response.
larzsse gives you both ends: a thread-safe Broadcaster that fans events out to
every connected client, and a client that connects and iterates parsed events.
from larzsse import Broadcaster, connect
bus = Broadcaster()
server = bus.serve("127.0.0.1", 8080) # streams at /events
bus.publish("hello", event="greeting") # every client receives it
for ev in connect("http://127.0.0.1:8080/events"):
print(ev.event, ev.data)
Why
- Both ends included. A
Broadcaster(subscribe/publish/unsubscribe, with keepalives and a built-in threaded server) and aconnect()client that parses the stream intoEvent(event, data, id)objects. - No async, no dependency. Plain sockets and threads — a lightweight complement to WebSockets (larzws) when you only need server → client push (live dashboards, progress, notifications, log tailing).
- Correct wire format.
format_event/parse_eventshandledata:/event:/id:/retry:, multiline data, and comment keepalives — round-trip clean.
Install
pip install larzsse
Usage
from larzsse import Broadcaster, connect, format_event
bus = Broadcaster()
bus.serve("0.0.0.0", 8080, path="/events")
bus.publish("payload", event="update", id="42")
bus.client_count
# embed in your own server: stream a subscribed client's events()
client = bus.subscribe()
for chunk in client.events(): # SSE strings; write to the response
...
# client
for ev in connect("http://host/events"):
ev.event, ev.data, ev.id
Tests
python -m unittest discover -s tests -v # 13 tests incl. live SSE over HTTP
The Larz stack
One of 30+ pure-Python, zero-dependency libraries at github.com/larz-scripter.
License
MIT © larz-scripter
Metadata
Release files for larzsse 0.1.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 | |
|---|---|---|---|---|
| larzsse-0.1.0.tar.gz | 6.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| larzsse-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.4 kB
Release files / larzsse-0.1.0.tar.gz
| Download URL | larzsse-0.1.0.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fde2fbaf8cd40c793a7f2059188cfc28bdcf6f045683233a5df6ef984a19ffe7
|
|
BLAKE2b-256 checksum How to use checksums |
bd37f68328faeb9f802a593d3d6ff2a34228cc970ec860066047cb05f7ea55c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / larzsse-0.1.0-py3-none-any.whl
| Download URL | larzsse-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
722e414db45113692e56f43e46b25e4428fad8550ab060dac57011fdb5e82806
|
|
BLAKE2b-256 checksum How to use checksums |
45da32951dbae1a8ba00a23ca5d365166b99074f19316662b9ba1c26b5fe06e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Security for larzsse 0.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.