Skip to content

chore: migrate HTTP client dependency from httpx to httpx2 - #143

Open
frostming wants to merge 1 commit into
mainfrom
chore/migrate-to-httpx2
Open

chore: migrate HTTP client dependency from httpx to httpx2#143
frostming wants to merge 1 commit into
mainfrom
chore/migrate-to-httpx2

Conversation

@frostming

Copy link
Copy Markdown
Contributor

Summary

Migrate the Streamable HTTP transport from httpx to httpx2.

httpx2 keeps the same public surface for everything this SDK touches —
AsyncClient, ASGITransport, MockTransport, Request, Response,
AsyncByteStream, Timeout — so the transport logic is unchanged and this is
essentially a module-name + dependency swap in both pyproject.toml and the
code.

Changes:

  • pyproject.toml: httpx[http2]>=0.27httpx2[http2]>=2.12 in both the
    dev group and the http extra.
  • src/acp/http/client.py: import switched to httpx2; type annotations and
    runtime calls (AsyncClient, Response, HTTPError, Timeout) updated.
  • src/acp/_cookies.py, src/acp/http/__init__.py: docstring references.
  • tests/http/*: switched to httpx2.
  • docs/web-transport.md: dependency note for the [http] extra.
  • 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 StarletteDeprecationWarning, so this also removes that warning path.

Related issues

Testing

Ran the full local gauntlet on this branch:

$ uv lock --locked
All checks passed!

$ uv run prek run -a          # ruff check + ruff format + hygiene hooks
ruff check .............................................................. Passed
ruff format ............................................................. Passed

$ uv run ty check --exclude "src/acp/meta.py" --exclude "src/acp/schema.py" \
    --exclude "src/acp/experimental/v2/meta.py" \
    --exclude "src/acp/experimental/v2/schema.py" --exclude "examples/*.py"
All checks passed!

$ uv run deptry src
Success! No dependency issues found.

$ uv run python -m pytest --doctest-modules
256 passed, 1 skipped in 9.45s

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/ASGITransport paths work unchanged on httpx2.

Docs & screenshots

docs/web-transport.md updated to document that the [http] extra now pulls in
httpx2[http2]. No UX change, so no screenshots.

Checklist

  • Conventional Commit title (chore:).
  • Tests cover the change (existing HTTP/WS suites exercise the swapped
    client surface end-to-end).
  • Docs/examples updated when behaviour is user-facing.
  • Schema regenerations (make gen-all) are called out if applicable
    (not applicable — no schema changes).

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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant