Skip to content

LITE-33583: Runtime floor to Python 3.10 and modernize http toolchain#86

Open
pcaro wants to merge 3 commits into
masterfrom
cr/LITE-deps-bump-py310
Open

LITE-33583: Runtime floor to Python 3.10 and modernize http toolchain#86
pcaro wants to merge 3 commits into
masterfrom
cr/LITE-deps-bump-py310

Conversation

@pcaro

@pcaro pcaro commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

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 >=7
  • dev: pytest >=8,<9, pytest-asyncio >=0.24,<2, pytest-cov <7
  • poetry.lock re-resolved → httpx 0.28.1, pytest-httpx 0.35.0, pytest 8.4.2, pytest-asyncio 1.4.0

Why 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 with assert_all_requests_were_expected=False + can_send_already_matched_responses=True to 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 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.
  • test_execute_error_with_reason (native httpx_mock fixture, 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.

@pcaro pcaro force-pushed the cr/LITE-deps-bump-py310 branch from b52dfd0 to 27c6c0b Compare June 30, 2026 13:53
@pcaro pcaro changed the base branch from cr/LITE-34447-drop-importlib-metadata to master June 30, 2026 13:53
@pcaro pcaro force-pushed the cr/LITE-deps-bump-py310 branch from 820ce32 to c0afad9 Compare July 1, 2026 09:36
…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.
@pcaro pcaro force-pushed the cr/LITE-deps-bump-py310 branch 2 times, most recently from dd2d0c6 to 925d1d0 Compare July 1, 2026 09:49
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.
@pcaro pcaro force-pushed the cr/LITE-deps-bump-py310 branch from 925d1d0 to 22e568f Compare July 1, 2026 10:01
@sonarqubecloud

sonarqubecloud Bot commented Jul 1, 2026

Copy link
Copy Markdown

@pcaro pcaro changed the title build(deps): drop Python 3.9, bump httpx/pytest-httpx, adapt async mocker build(deps): Runtime floor to Python 3.10 and modernize http toolchain Jul 1, 2026
@pcaro pcaro changed the title build(deps): Runtime floor to Python 3.10 and modernize http toolchain LITE-33583: Runtime floor to Python 3.10 and modernize http toolchain Jul 1, 2026
@pcaro pcaro marked this pull request as ready for review July 1, 2026 10:22
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.
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