DeprecationWarning with websockets>=14: runtime import of WebSocketClientProtocol
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- python
- 領域
- networking
調査の方向性
binance/ws/websocket_api.py の WebSocketClientProtocol の実行時インポートから始め、型付けのためにクラスがどのように使用されているかを確認します。影響を受ける pytest の実行で警告を再現し、その後、WebSocket の動作を変更せずに、インポートによって websockets 14+ の非推奨警告が発生しなくなったことを確認します。
索引モデルが issue の本文から書いたものです。
説明
Hi 👋
With python-binance==1.0.34 and websockets>=14, importing the websocket client triggers deprecation warnings:
--- Start ---
.venv/lib/python3.14t/site-packages/binance/ws/websocket_api.py:4
/home/ubuntu/nnf_beta/.venv/lib/python3.14t/site-packages/binance/ws/websocket_api.py:4: DeprecationWarning: websockets.WebSocketClientProtocol is deprecated
from websockets import WebSocketClientProtocol # type: ignore
.venv/lib/python3.14t/site-packages/websockets/legacy/init.py:6
/home/ubuntu/nnf_beta/.venv/lib/python3.14t/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
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
--- End ---
This comes from a runtime import in:
binance/ws/websocket_api.py
from websockets import WebSocketClientProtocol
According to the websockets 14+ upgrade notes, WebSocketClientProtocol and
websockets.legacy are deprecated and scheduled for removal.
The warning is triggered on import, even when the class is only used for typing.
This shows up clearly during pytest runs.
A short-term fix could be to guard the import behind typing.TYPE_CHECKING
(or similar), which would remove the runtime warning without changing behavior.
Longer-term, a migration to the new websockets asyncio API may be needed,
but I wanted to report this early since it will eventually become a hard failure.
Environment:
- python-binance==1.0.34
- websockets>=14
- Python 3.12 / 3.13 / 3.14-dev (reproduces across versions)
Happy to open a PR for a minimal fix if this approach is acceptable.
- 主要言語
- Python
- スター
- 7.2k
- フォーク
- 2.3k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
sammchardy/python-binance のほかの issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 65/100
sammchardy/python-binance#864 ·
-
Would you be interested in trying out picows as a websocket client?再び着手できるかも @pcriadoperez が 228 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンenhancement
sammchardy/python-binance#1671 · コメント 2 件 · 担当者 2 名 ·
-
Signature Issue再び着手できるかも @carlosmiei が 228 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
sammchardy/python-binance#1669 · コメント 1 件 · 担当者 1 名 ·
-
Binance Testnet DNS Resolution Failure (testnet.binance.vision) Causes “Exchange not connected”再び着手できるかも @carlosmiei が 248 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
sammchardy/python-binance#1667 · コメント 1 件 · 担当者 1 名 ·
-
Activation pricing in future new order api再び着手できるかも @carlosmiei が 259 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
sammchardy/python-binance#1658 · コメント 1 件 · 担当者 1 名 ·
sammchardy/python-binance の issue をすべて見る
似ている issue
-
repo-audit
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
scverse/repo-health#20 ·
メンテナーはふだん 1 日以内に返信
-
/context/prime scope override double-prefixes an entity-ref project and drops its scoped memoriesオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
phasespace-labs/palinode#232 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
collective/icalendar#1858 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
langflow-ai/langflow#15496 ·
メンテナーはふだん 1 日以内に返信