Require websockets>=13.0 for the default sansio implementation
Merged
KL
4mo ago+1+1+0123456789-1-1-0123456789
Summary
Since 0.50.0, --ws auto selects the websockets-sansio implementation whenever websockets is importable (#2985). That implementation imports from websockets.server import ServerProtocol, which only exists in websockets>=13.0. The [standard] extra, however, still allows websockets>=11.0.
So a user with websockets 11.x or 12.x installed and the default --ws auto now crashes at startup with:
ImportError: cannot import name 'ServerProtocol' from 'websockets.server'
where 0.49 fell back to the legacy implementation and worked. This bumps the floor to match what the default implementation actually requires.
Notes
websockets.server.ServerProtocol(the sans-I/O API) was introduced in websockets 13.0.- This only pins the
[standard]extra. A follow-up could also add a version guard inuvicorn/protocols/websockets/auto.pysoautodegrades towsproto/legacy instead of importing a sansio module that will fail, but the pin is the minimal fix.