Skip to content

[codex] Add httpx2 to standard extras - #15729

Closed
sairamveereddy wants to merge 1 commit into
fastapi:masterfrom
sairamveereddy:codex/add-httpx2-standard-extra
Closed

sairamveereddy wants to merge 1 commit into
fastapi:masterfrom
sairamveereddy:codex/add-httpx2-standard-extra

Conversation

@sairamveereddy

Copy link
Copy Markdown

Summary

Add httpx2 >=2.0.0 to the standard, standard-no-fastapi-cloud-cli, and all optional dependency extras.

Why

Current Starlette's TestClient prefers httpx2. Without httpx2 installed, importing fastapi.testclient.TestClient can emit a Starlette deprecation warning while falling back to httpx. In warning-strict environments, that warning can fail tests or local validation even after installing fastapi[standard].

The test and docs dependency groups already include httpx2; this aligns the public extras with that setup.

Validation

  • python -m pip install -e ".[standard]"
  • python -W error::DeprecationWarning -c "from fastapi.testclient import TestClient; print(TestClient.__name__)"
  • python -m pytest tests\test_request_params\test_path\test_required_str.py tests\test_param_include_in_schema.py -q

@github-actions

Copy link
Copy Markdown
Contributor

This PR modifies dependency files (pyproject.toml or uv.lock), which is restricted to members of the fastapi organization on GitHub.

If you need a dependency change, please open a discussion describing what you need and why.

Closing this PR automatically.

@github-actions github-actions Bot closed this Jun 10, 2026
@codspeed

codspeed Bot commented Jun 10, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 20 untouched benchmarks


Comparing sairamveereddy:codex/add-httpx2-standard-extra (997a9f4) with master (e133ffb)1

Open in CodSpeed

Footnotes

  1. No successful run was found on master (b317203) during the generation of this report, so e133ffb was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@YuriiMotov

Copy link
Copy Markdown
Member

You can always add httpx2 to your project's dependencies to avoid this warning

@bonastreyair

Copy link
Copy Markdown

Thanks @SairamVeeereddy I have the same "issue".

It is weird that by default fastapi generates the warnings from the recommended ways of working, no?

https://github.com/encode/httpx is unmantained and https://github.com/pydantic/httpx2 is maintained by pydantic, wouldn't it be better to depend on httpx2 instead of httpx then?

@YuriiMotov is it considered dropping httpx dependency entirely and only depending on httpx2, so basically doing a full transition of the dependency? Thanks in advance 😃 !

@YuriiMotov

Copy link
Copy Markdown
Member

@bonastreyair, thanks! We are aware of this situation and Sebastian took a decision to keep it as it is for now for some reasons.
You can start a discussion to gather more community feedback, this would help us understand how important it is for users

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