flet-dev / flet

Flet enables developers to easily build realtime web, mobile and desktop apps in Python. No frontend experience required.
https://flet.dev
Apache License 2.0
11.38k stars 446 forks source link

Websocket `ws_handler` Deprecation Warning #3995

Open itopaloglu83 opened 1 month ago

itopaloglu83 commented 1 month ago

Duplicate Check

Describe the bug

Running the default empty app in web version results in a deprecation warning.

Code sample

Code ```python import flet as ft def main(page: ft.Page): page.add(ft.SafeArea(ft.Text("Hello, Flet!"))) ft.app(main) ```

To reproduce

  1. Create an empty Flat app.
  2. Run the app with flet run --web
  3. Terminal shows the deprecation warning.

Expected behavior

Clear terminal output.

Screenshots / Videos

Captures ``` flet-tut % flet run --web http://127.0.0.1:57765 /Users//Downloads/flet-tut/.venv/lib/python3.10/site-packages/websockets/legacy/server.py:1185: DeprecationWarning: remove second argument of ws_handler warnings.warn("remove second argument of ws_handler", DeprecationWarning) ```

Operating System

macOS

Operating system details

Sonoma 14.6.1

Flet version

0.24.1

Regression

I'm not sure / I don't know

Suggestions

No response

Logs

No response

Additional details

No response

ndonkoHenri commented 1 month ago

Explanation: https://websockets.readthedocs.io/en/stable/project/changelog.html#backwards-incompatible-changes:~:text=second%20parameter%20of-,connection,-handlers%20is%20deprecated

My first thought is that this happens through a package on which we depend (which in turn depends on websockets) - possibly FastAPI. In that case, I think an upgrade of that package might solve the issue.

FeodorFitsner commented 1 month ago

This is being discussed in upstream: https://github.com/encode/uvicorn/discussions/2476