Skip to content

Feature: add httpx2 support with httpx fallback - #328

Merged
yanyongyu merged 8 commits into
yanyongyu:masterfrom
CoderJoshDK:httpx2
Oct 28, 2026
Merged

yanyongyu merged 8 commits into
yanyongyu:masterfrom
CoderJoshDK:httpx2

Conversation

@CoderJoshDK

Copy link
Copy Markdown
Contributor

Deprecate the use of httpx in favor of httpx2 when supplied.

Closes #321
Replaces #324

If the environment of the caller has httpx2 installed, we use that. Otherwise, we give them a deprecation warning.

In the future, httpx should be dropped and a hard cut to the httpx2 namespace should be used. This is to help avoid client mismatch.

@yanyongyu yanyongyu added the enhancement New feature or request label Oct 1, 2026
Comment thread tests/test_httpx.py Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Aware that this file is a bit funky. Honestly, this test can be removed IMO. But up to you.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I think this test could be removed. Instead, running all other tests without httpx2 in the env (using httpx) seems more meaningful.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Do you want to test like pydantic is done? I ended up having it only test 1 time in the matrix because it seems excessive to me to run it for everything. But that can be done too.

Comment thread pyproject.toml
"anyio >=3.6.1, <5.0.0",
"httpx >=0.23.0, <1.0.0",
"hishel[async,httpx] >=1.3.0, <=2.0.0",
"hishel[async,httpx] >=1.4.0, <=2.0.0",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Bump here because this is the first version that supports httpx2. I want to avoid a really strange case where you somehow have httpx2 but not the version of hishel that supports it and you get a super strange import error / explosion. This also makes the _httpx.py file a bit more reliable in its try-except.

Comment thread githubkit/_httpx.py Resolved
Comment thread pyproject.toml Resolved
@CoderJoshDK

Copy link
Copy Markdown
Contributor Author

I am working on some important $DAYJOB things today. But after work, I will do the pyproject change you wanted and look into the failing CI. Please give me any other changes you want me to tackle (if you have any) and I will do them tonight!

Have a test run with httpx instead of httpx2
Comment thread .github/workflows/codecov.yml Resolved
@CoderJoshDK

Copy link
Copy Markdown
Contributor Author

I am going to be away till next week. Next week, I will come back to this. Feel free to make any commits to my PR as you see fit or wait for me to get back.

Preserve the HTTP compatibility layer for upstream auth timeout changes and verify timeout propagation with both backends.
Override way of disabling httpx2
@CoderJoshDK

Copy link
Copy Markdown
Contributor Author

A bit delayed but should be updated with your requests!

@yanyongyu yanyongyu left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

small typo. githubkit uses lower case name in the docs.

Comment thread docs/usage/unit-test.md Resolved
Co-authored-by: Ju4tCode <42488585+yanyongyu@users.noreply.github.com>
@yanyongyu
yanyongyu merged commit 4fd62b8 into yanyongyu:master Oct 28, 2026
35 checks passed
@CoderJoshDK
CoderJoshDK deleted the httpx2 branch October 28, 2026 11:17
@honzajavorek

Copy link
Copy Markdown

brilliant! thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support httpx2

3 participants