Repository navigation
Allow websockets 16 and 17 - #141
Merged
Merged
Conversation
The sandbox file-watch and terminal connections use only connect(), send(), recv(), close() and ConnectionClosed, which websockets 16 and 17 leave unchanged; websockets 16 only dropped Python 3.9. The <16 bound kept the SDK from installing next to anything that needs websockets 16 or later, such as Anthropic's browser toolset quickstart. websockets 17.1 deprecates calling the synchronous connect() outside a with block, so the sync file-watch and terminal connections pass legacy=True where connect() accepts it, and keep working the same way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
websockets = ">=13,<16"(from #58) kept the SDK from installing next to anything that needs websockets 16 or later. Anthropic's browser toolset quickstart (anthropics/claude-quickstarts,browser-toolset/python/requirements.txt) needswebsockets>=16.1, sopip install hyperbrowserthere fails:That also blocks
hyperbrowser-claude-toolsets, which depends on this SDK.Changes
websockets = ">=13,<18": every release through 17.2, the newest.connect(url, additional_headers=, open_timeout=, sock=),send(str),recv(),close()andConnectionClosed, all unchanged through 17.2.ClientConnection(socket=)renamedsock, removed 9.0 aliases, header encoding) touch none of those calls.connect()outside awithblock, unlesslegacy=Trueis passed. So the sync file-watch and terminal connections passlegacy=Truewhereconnect()accepts it (SYNC_WEBSOCKET_CONNECT_OPTIONS). Behaviour is the same, without theDeprecationWarning. The async client is unaffected.poetry.lock: only the content hash changes. The locked websockets stays 13.1, which is valid for the whole Python range. Relocking from scratch with Poetry 2.4.1 also rewrites unrelatedcryptography/cffientries, the same onmain, so that's left out.Tests
Non-E2E suite (as
quality.ymlruns it), with the websockets pip resolves for each Python:New tests in
test_sandbox_wire_contract.py:connect()withDeprecationWarningas an error (it fails on 17.2 withoutlegacy=True);Sandbox E2E against production (
test_terminal_smoke,test_async_terminal_smoke,test_files,test_async_files, which cover the websocket file-watch and PTY paths): 4/4 passed on websockets 15.0.1, 16.1.1 and 17.2, with websocketsDeprecationWarnings as errors.Typing and packaging: typing tests (mypy 1.14.1, Pyright 1.1.411) pass;
ruff check(0.3.7) passes;poetry check --lockpasses; the build passestwine check; the wheel declareswebsockets (>=13,<18).Next to the quickstart: the 1.12.0 wheel installs next to its
requirements.txt(websockets 17.2, anthropic 1.13.0). 1.11.1 does not.🤖 Generated with Claude Code