This project needs your help! Let's make this project sustainable together
๐ Python 3.15 in, Python 3.10 out
uvicorn 0.55.0 supports Python 3.15 and drops Python 3.10. It also removes a 40 ms delay on keep-alive requests with --workers or --reload on the asyncio loop, and fixes several HTTP and WebSocket edge cases.
uv add uvicorn==0.55.0- Python 3.10 is no longer supported (#3152). The minimum version is now Python 3.11.
- Python 3.15 is supported (#3198). Python 3.15 and the free-threaded 3.15t build are tested in CI. 3.15t is not tested on Windows yet.
- The version now comes from the Git tag (#3261). This only matters if you build
uvicornyourself. The build needsuv-dynamic-versioning, and a build from a GitHub source tarball gets version0.0.0. Build from the sdist on PyPI, or setUV_DYNAMIC_VERSIONING_BYPASSto the version.
โก Faster keep-alive requests and startup
- Keep-alive requests no longer wait about 40 ms with
--workersor--reloadon the asyncio loop (#3199). The listening socket is now created withIPPROTO_TCP, so asyncio enablesTCP_NODELAYon accepted connections. With 2 workers on Linux, the keep-alive p50 went from 41.01 ms to 0.14 ms.uvloopandzuvloopwere not affected. - Startup is fast when reload patterns match many directories (#3184). A pattern such as
--reload-exclude '.venv/**/*'could take minutes to resolve. With 2,000 matching directories, resolving the patterns went from 120 s to 0.39 s.
๐ WebSocket handshakes that fail are closed cleanly
- A handshake request that
websocketscannot parse closes the connection (#3236). Withwebsockets-sansio, a request such as one with a header line over 8 KiB got no response and the connection stayed open. The client now gets a414or431fromwebsockets17 or later, or a400otherwise, and the connection is closed. - Denial responses behave the same on
websockets-sansioandwsproto(#3138). Rejecting a connection through thewebsocket.http.responseextension no longer logsASGI callable returned without completing handshake.onwebsockets-sansio. A server shutdown while a denial body is still streaming no longer raisesLocalProtocolErroronwsproto. A client that disconnects during a denial response is reported with code1006on both. - Connection teardown reaches the WebSocket protocol when the upgrade request fails (#3194). The transport is handed to the WebSocket protocol before it processes the upgrade request.
๐งน Stricter and more accurate request handling
- HTTP/2 requests without a body no longer hang (#3265). With
--http zttp --http2, an application that calledreceive()before responding never got an answer when the client ended the stream on the HEADERS frame, as curl does. - Access logs show the request target as the client sent it (#3195). This is a behavior change.
GET /one%2Ftwowas logged as/one/two, andGET /%41as/A. The access log now usesraw_path. - Non-ASCII request targets are rejected on the
zttpprotocols (#3197). They used to raiseUnicodeDecodeError. HTTP/1.1 now answers400 Bad Request, and HTTP/2 resets only the offending stream. --http httptoolsstrips trailing whitespace from request header values (#3214).X-Test: helloreached the application asb"hello ".h11andzttpalready stripped it.--headerwithout a colon is a usage error (#3200).--header X-Fooused to crash with aValueErrorwhile loading the config.- A negative
--limit-max-requests-jitteris rejected by the CLI (#3092). Uvicorn used to start and then raise aValueErrorfrom inside the server loop.
Full changelog: 0.54.0...0.55.0