Skip to content

Use StarletteDeprecationWarning instead of DeprecationWarning#3119

Merged
Kludex merged 2 commits into
mainfrom
add-starlette-deprecation-warning
Jun 11, 2026
Merged

Use StarletteDeprecationWarning instead of DeprecationWarning#3119
Kludex merged 2 commits into
mainfrom
add-starlette-deprecation-warning

Conversation

@Kludex

@Kludex Kludex commented Jan 25, 2026

Copy link
Copy Markdown
Owner

Convert the remaining Starlette-emitted DeprecationWarnings to StarletteDeprecationWarning.

The StarletteDeprecationWarning class itself (and its use in TestClient for the httpx deprecation) already landed via #3291, so this PR only covers the leftover call sites: run_until_first_complete, starlette.middleware.wsgi, the lifespan deprecations in routing, the deprecated status constants, and the TestClient timeout argument. The filterwarnings entries are updated to match.

Rationale: a UserWarning subclass is visible by default, so deprecations reach users without them having to enable warnings explicitly. See https://sethmlarson.dev/deprecations-via-warnings-dont-work-for-python-libraries

AI Disclaimer

This PR was developed with the assistance of either Claude or Codex. I've reviewed and verified the changes.

…tion-warning

# Conflicts:
#	starlette/responses.py
#	starlette/testclient.py
#	tests/test_responses.py
@github-actions

Copy link
Copy Markdown
Contributor

@Kludex Kludex changed the title Add StarletteDeprecationWarning Use StarletteDeprecationWarning instead of DeprecationWarning Jun 11, 2026
@Kludex Kludex merged commit 45e51dc into main Jun 11, 2026
14 checks passed
@Kludex Kludex deleted the add-starlette-deprecation-warning branch June 11, 2026 06:29
bod-zol added a commit to bod-zol/fastapi-easy-responses that referenced this pull request Jun 22, 2026
- add httpx2 as dev dependency, because since starlette Kludex/starlette#3291 (version1.2.0) a warning is issued if the httpx2 module is unavailable for the TestClient
- Kludex/starlette#3119 (v1.3.1) made this a more visible warning
- parallelly in #14 I introduced to handle all warnings as errors in unit tests
- these caused the tests to fail for this version bump
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.

1 participant