--- id: sse-starlette version: "3.4.8" license: BSD-3-Clause license_treatment: permissive maintenance: active --- # sse-starlette — SSE plugin for Starlette License: permissive · Maintenance: active · Popularity: top 1,000 on PyPI ## Install pip install sse-starlette uv add sse-starlette poetry add sse-starlette ## Description # Server-Sent Events for [Starlette](https://github.com/encode/starlette) and [FastAPI](https://fastapi.tiangolo.com/) [![Downloads](https://static.pepy.tech/badge/sse-starlette/week)](https://pepy.tech/project/sse-starlette) [![PyPI Version][pypi-image]][pypi-url] [![Build Status][build-image]][build-url] > Background: https://sysid.github.io/server-sent-events/ Production ready Server-Sent Events implementation for Starlette and FastAPI following the [W3C SSE specification](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events). ## Installation ```bash pip install sse-starlette uv add sse-starlette # To run the examples (fastapi, uvicorn, pydantic) uv add sse-starlette[examples] # Example 03 also needs the DB extras (sqlalchemy, aiosqlite) uv add sse-starlette[examples,examples-db] # Recommended ASGI server uv add sse-starlette[uvicorn,granian,daphne] ``` ## Quick Start ```python import asyncio from starlette.applications import Starlette from starlette.routing import Route from sse_starlette import EventSourceResponse async def generate_events(): for i in range(10): yield {"data": f"Event {i}"} await asyncio.sleep(1) async def... ## AI interpretation — verify before relying Provides Server-Sent Events (SSE) streaming for Starlette and FastAPI applications, following the W3C SSE specification with async/await support, automatic client disconnect detection, and graceful shutdown handling. Verdict: sse-starlette is a production-ready, actively maintained SSE implementation for Starlette and FastAPI with no known vulnerabilities. Low install friction, permissive licensing, and comprehensive async features (graceful shutdown, multi-threaded support, memory channels) make it a solid choice for real-time streaming in modern Python web applications. [View on SkillFed](https://skillfed.io/packages/sse-starlette) · [View on PyPI](https://pypi.org/project/sse-starlette/)