Skip to content

Conversation

@randomseed42
Copy link

Summary

Regarding below warning

.venv\Lib\site-packages\websockets\legacy\server.py:1178: DeprecationWarning: remove second argument of ws_handler
  warnings.warn("remove second argument of ws_handler", DeprecationWarning)

just simply remove path: str argument

# protocols/websockets/websockets_impl.py

## before
async def ws_handler(self, protocol: WebSocketServerProtocol, path: str) -> Any:  # type: ignore[override]

## after
async def ws_handler(self, protocol: WebSocketServerProtocol) -> Any:  # type: ignore[override]

Simple replicate the scenario using flet:

uv run flet create
uv run flet run --web

Before:

❯ uv run flet run --web
flet_app\.venv\Lib\site-packages\websockets\legacy\__init__.py:6: DeprecationWarning: websockets.legacy is deprecated; see https://websockets.readthedocs.io/en/stable/howto/upgrade.html for upgrade instructions
  warnings.warn(  # deprecated in 14.0 - 2024-11-09
flet_app\.venv\Lib\site-packages\uvicorn\protocols\websockets\websockets_impl.py:17: DeprecationWarning: websockets.server.WebSocketServerProtocol is deprecated
  from websockets.server import WebSocketServerProtocol
http://127.0.0.1:57004
flet_app\.venv\Lib\site-packages\websockets\legacy\server.py:1178: DeprecationWarning: remove second argument of ws_handler
  warnings.warn("remove second argument of ws_handler", DeprecationWarning)

After

❯ uv run flet run --web
flet_app\.venv\Lib\site-packages\websockets\legacy\__init__.py:6: DeprecationWarning: websockets.legacy is deprecated; see https://websockets.readthedocs.io/en/stable/howto/upgrade.html for upgrade instructions
  warnings.warn(  # deprecated in 14.0 - 2024-11-09
http://127.0.0.1:53402

Since it seems more complicate to replace WebSocketServerProtocol with ServerConnection per upgrade instruction in https://websockets.readthedocs.io/en/stable/howto/upgrade.html, I'd like to propose this tiny change just for now. Thanks!

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant