LITE-33583: Runtime floor to Python 3.10 and modernize http toolchain#86
Open
pcaro wants to merge 3 commits into
Open
LITE-33583: Runtime floor to Python 3.10 and modernize http toolchain#86pcaro wants to merge 3 commits into
pcaro wants to merge 3 commits into
Conversation
b52dfd0 to
27c6c0b
Compare
820ce32 to
c0afad9
Compare
…cker
Raise the runtime floor to Python 3.10 (verified on 3.10 and 3.12) and
modernize the HTTP toolchain:
- python >=3.10,<4 (drop 3.9 from deps and CI matrix)
- httpx >=0.28, pytest-httpx >=0.35, inflect >=7
- dev: pytest >=8,<9, pytest-asyncio >=0.24,<2, pytest-cov <7
pytest-httpx >=0.35 (which pulls httpx 0.28) is the only path to httpx
0.28, and it forces the pytest/pytest-asyncio bumps transitively. Its
0.31+ API changes break the async mocker, so adapt it:
- HTTPXMock now requires _HTTPXMockOptions; construct it with
can_send_already_matched_responses=True so a single registered
response answers the ConnectClient's retried requests. The strict
assert_all_requests_were_expected default is kept, so an unmocked
request fails the test.
- reset() no longer performs assertions; call _assert_options()
explicitly, gated by success, to keep failing on unrequested mocks.
- match_content now serializes JSON with compact separators to match
httpx 0.28's compact request-body serialization.
Mark test_execute_error_with_reason (native httpx_mock fixture, retries
on 500) with the matching httpx_mock options. All tests pass.
dd2d0c6 to
925d1d0
Compare
connect/client/fluent.py imported `Proxy` from httpx._config and `get_environment_proxies` from httpx._utils. Both are private httpx APIs that can change or vanish on any minor release, and the import happens at module load, so a break would take down the whole client, not just proxy support. Reimplement the environment proxy discovery locally as _get_environment_proxies() on top of stdlib urllib.request.getproxies() and ipaddress, faithfully porting httpx 0.28's algorithm: http/https/all schemes (normalizing bare host:port to a http:// URL) and NO_PROXY handling for domains, IPv4, IPv6, localhost, explicit-scheme hosts, and the NO_PROXY=* global bypass. Use the public httpx.Proxy instead of the private one. Add tests for this previously untested logic (scheme normalization, each NO_PROXY host form, and the wildcard bypass). All 407 tests pass.
925d1d0 to
22e568f
Compare
|
The install section still stated Python 3.9 as the minimum. Python 3.9 support was dropped on this branch (pyproject.toml now requires >=3.10), so align the README with the actual requirement.
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.



What
Raise the runtime floor to Python 3.10 (verified on 3.10 and 3.12) and modernize the HTTP toolchain.
python >=3.10,<4(drop 3.9 from deps + CI matrix)httpx >=0.28,pytest-httpx >=0.35,inflect >=7pytest >=8,<9,pytest-asyncio >=0.24,<2,pytest-cov <7poetry.lockre-resolved → httpx 0.28.1, pytest-httpx 0.35.0, pytest 8.4.2, pytest-asyncio 1.4.0Why this is one change
We like to keep "updated" (now we support even 3.10 ) connect-cli and this dependency had pinned oudated versions.
API changes absorbed (pytest-httpx 0.31+ / httpx 0.28)
Adapted
connect/client/testing/fluent.py:HTTPXMock()now requires_HTTPXMockOptions. Constructed withassert_all_requests_were_expected=False+can_send_already_matched_responses=Trueto preserve the previous mocker semantics (one registered response answers retried requests — the client retries on 5xx).reset()no longer asserts; call_assert_options()explicitly, gated bysuccess, to keep failing on unrequested mocks.match_contentnow serializes JSON with compact separators to match httpx 0.28's compact request-body serialization.test_execute_error_with_reason(nativehttpx_mockfixture, retries on 500) marked with matching@pytest.mark.httpx_mock(...)options.Verification
All 399 tests pass on Python 3.10 and 3.12. flake8 clean on changed files.