Add support for httpx2 - #239
Conversation
|
| ] | ||
| dependencies = [ | ||
| "httpx==0.28.*", | ||
| "httpx2==2.*", |
There was a problem hiding this comment.
perhaps it's worth doing this as an extra?
There was a problem hiding this comment.
I would rather remove both httpx and httpx2 as dependencies. Make them optional (as the suggestion above, an extra dependency for each)
| "pytest-httpx requires the httpx2 package to be installed.\n" | ||
| "You can install it with:\n" | ||
| " $ pip install httpx2\n" |
There was a problem hiding this comment.
I would leave this choice up to the user and not talk about the need, because migration does not happen so quickly.
"Neither `httpx2` nor the legacy `httpx` package is installed.\n"
"Install `httpx2` with:\n"
" $ pip install httpx2\n"
|
@Colin-b Hi! Could we prioritize this, if possible, please? |
|
@Colin-b Kind reminder. 🙏🏻 |
Colin-b
left a comment
There was a problem hiding this comment.
I feel like it needs more work, I envision the following in term of support:
- only httpx2 installed -> valid
- only httpx installed -> valid
- both installed -> use httpx2
This would need to be documented, and ofc the test suite will need to be updated, same for the CI that will need to run in 3 different dependency setup.
I am however not asking you to do it, I can review this proposal a bit more and add those changes.
|
I could work on these changes if it helps. So, the plan would be:
Is that correct?
I believe it works exactly this way right now. |
|
If you feel like it, be my guest! |



Hey! I'm trying to add support for the httpx2 package, following the guidelines from the authors.
This PR allows users of the package to seamlessly migrate their application and test code from httpx, just by updating the package. Users who have no intentions to migrate will be fine as well: the added
_compat.pymodule tries to use httpx2 first, but falls back to httpx.This is a highly anticipated change I assume, so I'm looking forward for a review and any comments/suggestions are very welcome.