fix: correct WebSocket dependency compatibility - #10
Merged
Merged
Conversation
poly-william
approved these changes
Sep 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Use the explicit asyncio WebSocket connector and require
websockets>=13.0. The previous dependency range allowed version 12, which cannot initialize the WebSocket clients, and version 13, whose top-level connector rejects the SDK's authentication headers.Add real local connection tests for markets and private streams, including signed headers, heartbeat delivery and cleanup. Keep the existing Python 3.10–3.13 CI matrix and add a Python 3.10 job pinned to websockets 13.0. Set the package version to
1.0.1for the existing publish workflow. Applications constrained to websockets 12 must upgrade that dependency.Testing
pytest— 150 tests pass on Python 3.10–3.13 with current compatible dependencies, and on Python 3.10 with websockets 13.0. The two new connection cases fail against the original connector on 13.0.ruff check .,ruff format --check .andmypy polymarket_us tests/typespass.uv buildpasses; wheel and sdist metadata declare version1.0.1, Python>=3.10and websockets>=13.0.Checklist
pytest)ruff check .)mypy polymarket_us)Note
Medium Risk
Raises the minimum websockets version and changes how connections are established, which can break apps still on 12.x but reduces risk of broken or mis-authenticated live WebSocket sessions.
Overview
Fixes WebSocket client compatibility with websockets 13 by connecting through
websockets.asyncio.client.connectinstead of the top-levelwebsockets.connect, so auth headers are passed correctly. The package now requireswebsockets>=13.0(drops 12.x) and bumps the release to1.0.1.Adds local integration tests for markets and private streams that assert signed
X-PM-*headers, heartbeat handling, and clean disconnect. CI gains a Python 3.10 job that pinswebsockets==13.0and runs the full test suite to guard the minimum supported version.Reviewed by Cursor Bugbot for commit d141027. Bugbot is set up for automated code reviews on this repo. Configure here.