Starlette
Backend & InfraThe little ASGI framework that shines. 🌟
Release History
1.0.0rc1Breaking1 fix1 featureThe first release candidate for Starlette 1.0 is available, removing all features previously marked for deprecation in preparation for the final 1.0 release.
0.52.1This patch release refactors dependency usage, specifically limiting the use of typing_extensions to older Python versions.
0.52.01 featureThis release introduces dictionary-style access for State, enhancing type safety when retrieving state variables. It also provides a link to the full changelog for version 0.52.0.
0.51.01 featureThis release introduces the `allow_private_network` option for CORS middleware and adjusts the stacklevel for DeprecationWarnings related to the wsgi module.
0.50.0BreakingVersion 0.50.0 drops Python 3.9 support, requiring Python 3.10+.
0.49.31 fixStarlette 0.49.3 relaxes the strictness of the Middleware type, fixing issue #3059.
0.49.21 fixStarlette 0.49.2 fixes handling of conditional headers in StaticFiles by ignoring `if-modified-since` when `if-none-match` is present.
0.49.11 fixStarlette 0.49.1 patches a security issue in FileResponse's Range header parsing.
0.49.03 featuresStarlette 0.49.0 adds an `encoding` option to Config, improves cookie handling, and tightens WebSocketEndpoint typing, while refining Middleware exception handling.
0.48.02 featuresVersion 0.48.0 adds official Python 3.14 support and updates HTTP status names to follow RFC9110.
0.47.31 fixStarlette 0.47.3 fixes coroutine detection on Python 3.12 and earlier.
0.47.21 fixFixed an issue where UploadFile did not correctly check for future rollover.
0.47.12 fixesStarlette 0.47.1 fixes type‑hinting issues by using Self in TestClient.__enter__ and adds proper type checking for async exception handlers.
0.47.01 fix2 featuresStarlette 0.47.0 adds ASGI pathsend support and a `partitioned` flag for cookies, updates the `methods` parameter type, and makes `ExceptionMiddleware.http_exception` async.
0.46.22 fixesStarlette 0.46.2 fixes TemplateResponse indexing and stops BaseHTTPMiddleware from reraising exceptions.
0.46.11 fixStarlette 0.46.1 fixes an issue allowing relative directory paths with follow_symlinks=True.
0.46.0Breaking2 fixes1 featureStarlette 0.46.0 adds a Vary header to GZipMiddleware, renames MultiPartParser’s `max_file_size` to `spool_max_size`, and deprecates `TestClient(timeout=…)`, while fixing background task exception handling and SSE compression.
0.45.31 fixStarlette 0.45.3 fixes a bug where the directory argument in `lookup_path` was not converted to a string before commonpath comparison.
Common Errors
BrokenResourceError2 reportsBrokenResourceError in Starlette often arises when attempting to use a request or websocket object after the connection has been closed or finalized, typically in background tasks or middleware. To fix this, ensure you're not accessing request/websocket properties after the response has been sent or the connection is closed; copy needed data from the request/websocket *before* starting background tasks, or use lifespan events to manage resources tied to the request lifecycle.
RuntimeError1 reportThe "RuntimeError" during response handling in Starlette often arises when attempting to use response methods like `send_denial_response` (meant for ASGI) with streaming responses. Ensure that you're using the correct response type and using applicable functions with it. If you intend to stream data, avoid response methods designed for regular ASGI responses and construct a proper `StreamingResponse`.
HTTPException1 reportHTTPException in Starlette usually arises from improper handling of WebSocket lifecycle events, particularly when a connection is unexpectedly closed or denied after the initial handshake. The fix involves ensuring your WebSocket endpoint correctly acknowledges and handles `WebSocketDisconnect` exceptions or implementing a denial mechanism that aligns with WebSocket protocol requirements. Specifically, verify you aren't trying to send responses after the connection has closed/before it has opened or using outdated denial functions like `websockets.send_denial_response`.
ClosedResourceError1 report"ClosedResourceError" in Starlette often arises when attempting to use a response (like a StreamingResponse) after it has already been closed, typically due to exiting the function or generator that originally created it. Ensure you're not accessing or iterating over the response's content after the initial function or generator has completed execution, such as trying to read the request body multiple times without proper handling of the stream. If using a generator, make sure it yields all necessary data before the function returns to prevent premature closure.
Related Backend & Infra Packages
Production-Grade Container Scheduling and Management
Node.js JavaScript runtime ✨🐢🚀✨
Promise based HTTP client for the browser and node.js
A modern runtime for JavaScript and TypeScript.
Deliver web apps with confidence 🚀
Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
Subscribe to Updates
Get notified when new versions are released