respx is a utility for mocking HTTPX and HTTP Core in Python tests, letting you patch HTTPX and define request routes with mock responses. It is useful for pytest-based testing, including a respx_mock fixture and optional marker to configure mock settings.
Project status
- Actively maintained, with very recent activity (last upstream push 2026-04-23) and back-to-back updates in April 2026 (0.23.0 on 2026-04-07, 0.23.1 on 2026-04-08).
- Apparent updates cadence is bursty: a longer gap from 0.22.0 (2024-12-19) to 0.23.0 (2026-04-07), then rapid follow-up with a regression fix one day later (0.23.1).
AI summary generated 2 weeks ago
Recent updates
0.23.1
1 month agoVersion 0.23.1 mainly fixes a regression where `params` patterns could stop matching correctly in some multi-item pattern scenarios. The code change refactors how `ANY` is detected/converted inside multi-item patterns and adds a regression test reproducing the issue.
0.23.0
1 month agoVersion 0.23.0 focuses on fixes around pattern matching (including list values and ANY handling) plus documentation and CI/test improvements. The release notes also claim a URL path handling change to preserve multiple slashes by avoiding urljoin.
0.22.0
12/19/2024respx 0.22.0 updates compatibility to newer HTTPX versions and expands the CI matrix to include Python 3.12 and 3.13, while dropping Python 3.7 support. The code changes include adjustments for HTTPX request method handling and stricter validation around exception-type side effects.
Breaking0.21.1
3/27/2024Version 0.21.1 documents two updates: a fix for the `files` pattern to properly handle `str` and `BytesIO` values, and an added capability for the `data` pattern to accept `None` values. The code changes show additional behavioral normalization beyond what is explicitly described, especially around how `data` and file objects are cleaned for comparisons.
Features0.21.0
3/19/2024Respx 0.21.0 adds new request matching capabilities for multipart form data, specifically a new `files` pattern and the `data__contains` lookup. It also introduces `respx.SetCookie` and extends the response mocking API to make it easier to mock `Set-Cookie` headers.
Features0.20.2
7/20/2023Release 0.20.2 focuses on assertion output improvements and adding quoted path pattern matching and the new `content__contains` pattern. The code changes include behavior updates around URL path normalization, and a notable change in how `Router.assert_all_called()` fails.
BreakingFeatures0.20.1
11/18/2022Release 0.20.1 mainly updates compatibility and tooling: it adds official support for Python 3.11 and HTTPX 0.23.1, and it modernizes CI by running pre-commit in the workflow. It also drops Python 3.6 support and bumps autoflake as part of formatting/linting updates.
BreakingFeatures0.20.0
9/16/2022Version 0.20.0 introduces several type-level and runtime behavior changes centered around making previously-optional values non-optional at the API boundary. In particular, call-related helpers now raise when a response is missing, and pattern construction avoids returning None by introducing a Noop pattern.
BreakingFeatures0.19.3
9/14/2022Version 0.19.3 focuses on typing and test/lint improvements, plus a specific fix around how pattern lookups handle empty values. The code diff also shows a few subtle behavioral and API-surface changes (mostly around how inputs are interpreted and how wrappers are built), which are not fully covered by the release notes.
0.19.2
2/3/2022Release 0.19.2 is primarily a maintenance update focused on improving cleanup before building the package (egg/wheel artifacts). The version number was bumped from 0.19.1 to 0.19.2, and the changelog reflects a single fixed item.