Repository navigation
Conversation
thodson-usgs
approved these changes
Nov 20, 2026
thodson-usgs
left a comment
Collaborator
There was a problem hiding this comment.
lgtm, but let's hold this until we're ready for the 2.0 release
pytest-httpx has no httpx2 support yet (Colin-b/pytest_httpx#239), so this branch had replaced it with an in-house httpx_mock fixture. Keep the released plugin instead: tests/conftest.py calls httpx2.alias_httpx(), so the plugin's 'import httpx' resolves to httpx2, then imports its fixture and pytest_configure hook. addopts disables the plugin's autoload (-p no:pytest_httpx), which would import httpx before the alias. The full suite passes unchanged against the plugin, and the test files return to main's wording. Drop the alias and the -p flag once pytest-httpx supports httpx2. Also, after the Python 3.11 and httpx2 moves: - Type BaseConfiguration.load with typing.Self and delete the _C TypeVar. - Inline the lazy tomllib import and delete the one-caller _toml_parser(). - Drop the duplicate 3.11 classifier and the sys.version_info coverage exclusion, and the non_mocked_hosts fixture pytest-httpx no longer reads. - Finish the rename: httpcore2.ConnectError in interruptions, httpx2 in the queryables regeneration snippet. - ADR 0009 Compliance: the leaf test now allows no third-party package. - Rewrap paragraphs left ragged by the tomli removal.
thodson-usgs
force-pushed
the
update-httpx2
branch
from
November 23, 2026 14:11
9fa2e84 to
233cb60
Compare
NEWS.md: kept both entries (11/21 ratings bug fix above the 11/18 httpx2 entry). ratings.py auto-merged.
This branch has not been deployed
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.
Did not realize this was not on my fork...
Summary
This PR replaces httpx with httpx2 (https://pypi.org/project/httpx2/), Pydantic's maintained fork of httpx 0.28.1.
httpx hasn't had a stable release since 0.28.1, and httpx2 is maintained and gets security fixes. The public API is
the same, so the code change is mostly the rename. httpx2 requires Python 3.11, so this PR also raises the minimum
supported Python from 3.10 to 3.11. Python 3.10 reached end of life in October 2026.
Changes
Dependency: httpx is replaced by httpx2 in pyproject.toml and the pre-commit mypy hook. import httpx and httpx.X
become httpx2 throughout dataretrieval/ and tests/.
Python 3.11 minimum:
library.
Test mocking:
parts of pytest-httpx this suite uses: add_response, add_exception, get_requests and reset. It follows pytest-httpx's
URL matching and response-reuse rules with strict mode off.
deleted and pytest-httpx added back.
Docs:
Lint: lines that exceeded 88 characters are wrapped, and ruff's py311 rules replaced timezone.utc with
datetime.UTC.
Breaking changes for users
SSL_CERT_FILE, SSL_CERT_DIR and ssl_check=False still work. This should help on networks that inspect TLS traffic.
Testing
depends on the old package.
Follow-up
back to the test extra.
Co-authored by Claude Opus 5.5