chore: migrate HTTP client dependency from httpx to httpx2 - #143
Open
frostming wants to merge 1 commit into
Open
chore: migrate HTTP client dependency from httpx to httpx2#143frostming wants to merge 1 commit into
frostming wants to merge 1 commit into
Conversation
The Streamable HTTP transport now builds on `httpx2` instead of `httpx`. httpx2 keeps the same public surface for the pieces we rely on (`AsyncClient`, `ASGITransport`, `MockTransport`, `Request`, `Response`, `AsyncByteStream`, `Timeout`), so the transport logic is unchanged — only the module name and the dependency move. - pyproject.toml: `httpx[http2]>=0.27` -> `httpx2[http2]>=2.12` in both the dev group and the `http` extra - src/acp/http/client.py: import and type/annotation references now point at httpx2 - src/acp/_cookies.py, src/acp/http/__init__.py: docstring references updated - tests/http/*: updated to httpx2 - docs/web-transport.md: dependency note updated - uv.lock: drop httpx 0.28.1 + httpcore 1.0.9, add httpx2 2.12.0 + httpcore2 2.12.0 (+ truststore) Note: starlette.testclient prefers httpx2 and only falls back to httpx with a deprecation warning, so this also removes that warning path. Verified: `uv lock --locked`, `prek run -a`, `ty check`, `deptry src`, and `pytest --doctest-modules` (256 passed, 1 skipped).
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
Migrate the Streamable HTTP transport from
httpxtohttpx2.httpx2keeps the same public surface for everything this SDK touches —AsyncClient,ASGITransport,MockTransport,Request,Response,AsyncByteStream,Timeout— so the transport logic is unchanged and this isessentially a module-name + dependency swap in both
pyproject.tomland thecode.
Changes:
pyproject.toml:httpx[http2]>=0.27→httpx2[http2]>=2.12in both thedevgroup and thehttpextra.src/acp/http/client.py: import switched tohttpx2; type annotations andruntime calls (
AsyncClient,Response,HTTPError,Timeout) updated.src/acp/_cookies.py,src/acp/http/__init__.py: docstring references.tests/http/*: switched tohttpx2.docs/web-transport.md: dependency note for the[http]extra.uv.lock: drophttpx 0.28.1+httpcore 1.0.9; addhttpx2 2.12.0+httpcore2 2.12.0(+truststore).Note:
starlette.testclientprefershttpx2and only falls back tohttpxwith a
StarletteDeprecationWarning, so this also removes that warning path.Related issues
Testing
Ran the full local gauntlet on this branch:
The HTTP/WS transport suites (
tests/http/test_asgi.py,test_http_client.py,test_fixes.py,test_loopback.py,test_cookies.py,test_sse.py,test_http_server.py,test_websocket.py,test_ws_cookies.py) all pass,confirming SSE streaming, cookie-jar session affinity, and the in-memory
MockTransport/ASGITransportpaths work unchanged onhttpx2.Docs & screenshots
docs/web-transport.mdupdated to document that the[http]extra now pulls inhttpx2[http2]. No UX change, so no screenshots.Checklist
chore:).client surface end-to-end).
make gen-all) are called out if applicable(not applicable — no schema changes).