pypi uvicorn 0.55.0
Version 0.55.0

one hour ago

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 uvicorn yourself. The build needs uv-dynamic-versioning, and a build from a GitHub source tarball gets version 0.0.0. Build from the sdist on PyPI, or set UV_DYNAMIC_VERSIONING_BYPASS to the version.

โšก Faster keep-alive requests and startup

  • Keep-alive requests no longer wait about 40 ms with --workers or --reload on the asyncio loop (#3199). The listening socket is now created with IPPROTO_TCP, so asyncio enables TCP_NODELAY on accepted connections. With 2 workers on Linux, the keep-alive p50 went from 41.01 ms to 0.14 ms. uvloop and zuvloop were 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 websockets cannot parse closes the connection (#3236). With websockets-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 a 414 or 431 from websockets 17 or later, or a 400 otherwise, and the connection is closed.
  • Denial responses behave the same on websockets-sansio and wsproto (#3138). Rejecting a connection through the websocket.http.response extension no longer logs ASGI callable returned without completing handshake. on websockets-sansio. A server shutdown while a denial body is still streaming no longer raises LocalProtocolError on wsproto. A client that disconnects during a denial response is reported with code 1006 on 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 called receive() 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%2Ftwo was logged as /one/two, and GET /%41 as /A. The access log now uses raw_path.
  • Non-ASCII request targets are rejected on the zttp protocols (#3197). They used to raise UnicodeDecodeError. HTTP/1.1 now answers 400 Bad Request, and HTTP/2 resets only the offending stream.
  • --http httptools strips trailing whitespace from request header values (#3214). X-Test: hello reached the application as b"hello ". h11 and zttp already stripped it.
  • --header without a colon is a usage error (#3200). --header X-Foo used to crash with a ValueError while loading the config.
  • A negative --limit-max-requests-jitter is rejected by the CLI (#3092). Uvicorn used to start and then raise a ValueError from inside the server loop.

Full changelog: 0.54.0...0.55.0

Don't miss a new uvicorn release

NewReleases is sending notifications on new releases.