Skip to content

Commit 3aeaae8

Browse files
authored
Treat deprecations seriously - deprecation in websockets (zauberzeug#5256)
### Motivation https://websockets.readthedocs.io/en/stable/howto/upgrade.html, and we have 5 years to migrate. The deadline is 2030 so we're 5 years early, but I guess that's better than being late (🤡). ### Implementation WebSocket protocol configuration: * Sets the `ws` parameter to `'wsproto'` when configuring the Uvicorn server in `nicegui/ui_run.py` * We can choose anything but `auto` (defaults to the websockets legacy) and `websockets` * **Personally believe** that by using `wsproto`, which is more low-level, we may have performance increase. * But we may use `websockets-sansio` as well. Test configuration cleanup: * Removes deprecated warning filters related to the `websockets.legacy` and `uvicorn.protocols.websockets` modules from the `filterwarnings` section in `pyproject.toml`, as these are no longer needed. ### Progress - [x] I chose a meaningful title that completes the sentence: "If applied, this PR will..." - [x] The implementation is complete. - [x] Pytests have been added (or are not necessary). - [x] Documentation has been added (or is not necessary).
1 parent e84e376 commit 3aeaae8

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

nicegui/ui_run.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ def split_args(args: str) -> list[str]:
250250
reload_excludes=split_args(uvicorn_reload_excludes) if reload else None,
251251
reload_dirs=split_args(uvicorn_reload_dirs) if reload else None,
252252
log_level=uvicorn_logging_level,
253+
ws='wsproto',
253254
**kwargs,
254255
)
255256
config.storage_secret = storage_secret

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ main_file = ""
9595
testpaths = ["tests"]
9696
filterwarnings = [
9797
'error',
98-
'ignore::DeprecationWarning:^websockets\.legacy(\.|$)',
99-
'ignore::DeprecationWarning:^uvicorn\.protocols\.websockets(\.|$)',
10098
"ignore:'asyncio\\.iscoroutinefunction' is deprecated and slated for removal:DeprecationWarning",
10199
]
102100

0 commit comments

Comments
 (0)