Skip to content

Migrate SDK HTTP stack to httpx2 - #256

Merged
goncalossilva merged 2 commits into
mainfrom
goncalossilva/httpx2
Sep 4, 2026
Merged

Migrate SDK HTTP stack to httpx2#256
goncalossilva merged 2 commits into
mainfrom
goncalossilva/httpx2

Conversation

@goncalossilva

@goncalossilva goncalossilva commented Aug 29, 2026

Copy link
Copy Markdown
Member

Replace httpx with httpx2 to improve maintenance and supply chain posture.

httpx2 is a fork of httpx 0.28.1 with essentially the same public API, now under active Pydantic stewardship. Pydantic explicitly says (see the top of the README) it took over because httpx had seen limited activity and a critical-path HTTP library needs timely security updates.

httpx is not archived, and the author is promising a from-scratch rewrite, but they're working in private and with no ETA in sight. Plus, the maintainer closed access to issues and discussions around February 2026. Overall, a terrible look and a supply chain risk, even if httpx works well today.

Changes

  • replace the direct httpx runtime dependency with httpx2>=2.0.0,<3
  • migrate sync, async, authentication, response, timeout, and public injected-client types to httpx2
  • route the existing RESPX-backed tests through the maintained pytest-httpx2 plugin
  • update the lockfile, README, API docs, and changelog

Compatibility

This is a breaking change for callers that pass an httpx.Client or httpx.AsyncClient or catch httpx exceptions: httpx and httpx2 expose distinct classes, so those objects and exception handlers must move to httpx2 too.

That said, we have yet to officially release any version with httpx, so there is no breaking change per se. The first release with true async support would just use httpx2.

In other words, no compatibility issues—we should ship a new major soon.

@goncalossilva
goncalossilva requested a review from a team as a code owner August 29, 2026 03:36
@goncalossilva
goncalossilva requested review from modasserbillah and removed request for a team August 29, 2026 03:36

@doistbot doistbot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR updates Migrate SDK HTTP stack to httpx2. No issues were flagged in the reviewed diff.

Share FeedbackReview Logs

@goncalossilva
goncalossilva marked this pull request as draft August 30, 2026 02:32

@doistbot doistbot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR updates Migrate SDK HTTP stack to httpx2. No issues were flagged in the reviewed diff.

Share FeedbackReview Logs

@PotHix PotHix left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me. The fact that it's under pydantic now is a plus 👍

@goncalossilva
goncalossilva marked this pull request as ready for review September 4, 2026 14:26
Copilot AI lite review requested due to automatic review settings September 4, 2026 14:26
@goncalossilva
goncalossilva merged commit 5e86a4a into main Sep 4, 2026
6 checks passed
@goncalossilva
goncalossilva deleted the goncalossilva/httpx2 branch September 4, 2026 14:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It changes a core dependency and the HTTP/test stack end-to-end, and correctness depends on external package/API compatibility that can’t be fully verified from the diff alone.

Pull request overview

This PR migrates the SDK’s HTTP layer from httpx to httpx2, updating both the public injected-client types and the test harness so the codebase depends on the actively maintained fork.

Changes:

  • Swapped runtime dependency from httpx>=0.28.1,<1 to httpx2>=2.0.0,<3 and refreshed the lockfile.
  • Updated sync/async client injection points, request helpers, and raised-exception documentation to reference httpx2 types.
  • Routed RESPX-backed tests through the pytest-httpx2 plugin and updated docs/changelog to match.
File summaries
File Description
uv.lock Updates resolved dependency graph to include httpx2/httpcore2 and adds pytest-httpx2 to dev dependencies.
todoist_api_python/authentication.py Switches optional injected clients and managed client factories to httpx2 sync/async clients.
todoist_api_python/api.py Migrates the sync API client’s injected-client type and docstrings to httpx2.
todoist_api_python/api_async.py Migrates the async API client’s injected-client type and docstrings to httpx2.
todoist_api_python/_core/http_requests.py Moves request helpers and TIMEOUT configuration to httpx2 types.
tests/test_http_requests.py Updates request-helper tests to use httpx2 and catch httpx2.HTTPStatusError.
tests/conftest.py Adds a respx_mock fixture that aliases the pytest-httpx2 provided mock fixture.
README.md Updates migration guidance to reference httpx2 client types and exceptions.
pyproject.toml Replaces httpx dependency with httpx2 and adds pytest-httpx2 to dev dependencies.
docs/index.md Updates documentation to reference httpx2.AsyncClient.
CHANGELOG.md Documents the breaking change and updates httpx references to httpx2.
Review details
  • Files reviewed: 10/11 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

4 participants