Starlette
Backend & InfraThe little ASGI framework that shines. π
Release History
View all versions β1.6.02 featuresThis release introduces `max_body_size` to Starlette and route classes, and exposes HTTP response debug information via response extensions.
1.5.12 fixesThis release addresses security vulnerabilities by rejecting inverted byte ranges and limiting the number of ranges supported by FileResponse.
1.5.04 featuresThis release focuses on enhancing the `GZipMiddleware` with new configuration options and improved handling of streamed and partial responses.
1.4.11 fixThis release updates the default `thread_minimum_size` in `GZipResponder`.
1.4.03 featuresThis release introduces improvements to GZipMiddleware by lazily allocating resources and offloading large compression tasks. It also updates the internal implementation to use `zlib.compressobj` for potentially better performance.
1.3.12 fixesThis patch release focuses on enforcing limits within the FormParser to improve robustness and switches the type of deprecation warning used.
1.3.04 fixes1 featureThis release focuses on stability and correctness, introducing fixes for file handling, URL manipulation, and exception group processing, alongside adding an optional dependency extra.
1.2.11 featureThis release updates type checking dependencies in testclient and adds an assertion error for incorrect usage of requires() in request handling.
1.2.01 featureThis release introduces support for httpx2 within the test client functionality.
1.1.01 fix2 featuresThis release introduces minor improvements to file handling and endpoint dispatching, along with a security fix in path resolution for StaticFiles.
1.0.11 fixThis minor release fixes an issue where malformed Host headers could cause problems when constructing the request URL.
1.0.01 featureStarlette has officially reached its first stable release, version 1.0, concluding nearly eight years of development.
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.
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