[HTTPXodus] migrate httpx to httpx2 (hard switch; closes #470) - #471
Open
ProgrammerPlus1998 wants to merge 2 commits into
Open
[HTTPXodus] migrate httpx to httpx2 (hard switch; closes #470)#471ProgrammerPlus1998 wants to merge 2 commits into
ProgrammerPlus1998 wants to merge 2 commits into
Conversation
Refs: HTTPXodus campaign
Remove the try/except dual-import blocks; direct 'import httpx2' everywhere. pyproject: httpx2>=2.12.0 as the only runtime HTTP dep; requires-python bumped to >=3.10 (httpx2's floor; 3.8/3.9 are EOL). Test infra: vcrpy and respx only patch/validate httpx 0.x, so add tests/_vcr_httpx2_stubs.py (vcr send-stubs adapted for httpx2, wired via a conftest autouse fixture) and tests/_mock_router.py (a minimal respx-compatible Router, natively typed for httpx2, replacing respx). Full suite: 158 passed, 6 skipped (skips need a real API token). Refs: replicate#470
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 #470
What this PR does
Complete hard switch from
httpxtohttpx2:import httpx2inreplicate/client.py,exceptions.py,prediction.py,stream.py,webhook.py,helpers.py— no dual-import shimpyproject.toml:httpx2>=2.12.0is the only runtime HTTP dependencyrequires-pythonbumped to>=3.10(httpx2's floor; Python 3.8 and 3.9 are both EOL)Test infrastructure
The suite's mocking stack was built on httpx 0.x internals, so it was re-pointed at httpx2:
tests/_vcr_httpx2_stubs.py— vcrpy's httpx send-stubs adapted for httpx2, wired via an autouse conftest fixture that patcheshttpx2.Client/AsyncClient._send_single_requestwhile a cassette is active (mirrors what vcr does for httpx)tests/_mock_router.py— a minimal respx-compatibleRouter(route/mock/pass_through/call assertions), natively typed for httpx2, replacing respx. One subtlety handled: each mock call returns a freshResponse, because httpx2 rebinds.streamto sync/async wrappers per send and reusing one instance breaks mixed sync/async suitesrespxdropped from dev dependenciesTest results
REPLICATE_API_TOKEN) with httpx2 2.12.0Notes for reviewer
3.8/3.9jobs will fail at install — both are EOL; suggest dropping them from the matrix (I haven't touched workflow files).httpx2verifies TLS against the OS trust store (viatruststore) instead of the bundledcertifi. Deployments relying on certifi's CA bundle may needSSL_CERT_FILE/SSL_CERT_DIR. Worth a line in the changelog.Happy to revise per review — and equally happy to close this PR if the maintainers would rather wait for
httpx1.0 stable. 🙏