Add HTTPX2 transports - #3195
Merged
Merged
Conversation
Add HTTPX2Transport and AsyncHTTPX2Transport, which make requests with httpx2, the continuation of httpx maintained by Pydantic. httpx and httpx2 are separate packages with separate client, request, response, timeout and exception classes. The new transports use only httpx2 objects, so they raise httpx2 exceptions, and the existing requests and httpx transports are unchanged. The transports are covered by unit tests against an httpx2 mock transport, and by tests which drive the VWS, Cloud Reco, VuMark and Model Target clients through them against VWS Python Mock, which gained httpx2 interception in 2026.9.6. Closes #3174. Co-Authored-By: Claude Fable 5.1 <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.
Closes #3174.
Adds
HTTPX2TransportandAsyncHTTPX2Transporttovws.transports, which make requests withhttpx2, alongside the unchangedrequestsandhttpxtransports;httpx2becomes a runtime dependency. The new transports use onlyhttpx2objects, so they raisehttpx2exceptions and never mix withhttpx, and the module docstring plus a new "HTTP transports" docs section explain the distinction. Timeout conversion, response conversion, closing and exception behaviour are covered by unit tests, and the VWS, Cloud Reco, VuMark and Model Target clients are driven through the new transports against VWS Python Mock, which is bumped to 2026.9.6 (released for this) as it is the first version to intercepthttpx2.🤖 Generated with Claude Code
Note
Low Risk
Additive public API and dependency with broad test coverage; default transports unchanged, though callers choosing HTTPX2 must handle httpx2 exception types.
Overview
Adds optional
HTTPX2TransportandAsyncHTTPX2Transportinvws.transportsso VWS clients can use Pydantic’shttpx2stack instead of defaultrequests/httpx.httpx2>=2.12is a new runtime dependency; existingrequestsandhttpxtransports are unchanged.The new transports mirror the httpx ones (shared client pooling, context managers, timeout mapping,
Responseconversion) and surfacehttpx2exceptions only—no mixing withhttpxtypes. Docs gain an HTTP transports section with anHTTPX2Transportexample; a towncrier fragment records the change.Tests cover unit behaviour (timeouts, empty body, close, exception type) and end-to-end flows against vws-python-mock
2026.9.6(bumped in dev deps forhttpx2interception) for VWS, Cloud Reco, VuMark, and Model Target sync/async clients.Reviewed by Cursor Bugbot for commit 84c3ac0. Bugbot is set up for automated code reviews on this repo. Configure here.