Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

👷 Add ty to precommit - #15091

#15091
Merged
tiangolo merged 34 commits into
fastapi:masterfastapi/fastapi:masterfrom
svlandeg:feat/tysvlandeg/fastapi:feat/tyCopy head branch name to clipboard
Mar 15, 2026
Merged

👷 Add ty to precommit#15091
tiangolo merged 34 commits into
fastapi:masterfastapi/fastapi:masterfrom
svlandeg:feat/tysvlandeg/fastapi:feat/tyCopy head branch name to clipboard

Conversation

@svlandeg

@svlandeg svlandeg commented Mar 10, 2026

Copy link
Copy Markdown
Member
  • Add ty to pyproject, precommit and lint script
  • mypy is also kept for now
  • Update code to pass ty
    • 150 original issues
    • bulk of those were issues with ty complaining about _Unset default assignments
    • quite some where ty sees no issue though mypy does: these need an extra ignore on the same line - ugly but we can remove these when we remove mypy alltogether
    • then there are a handful where ty sees a problem that mypy thinks is fine, here we add ty: ignore statements that are ignored by mypy.

[UPDATE]: note that ignored deprecation warnings are handled more properly in cf #15101 🙂

@svlandeg svlandeg added the internal Internal changes label Mar 10, 2026
@svlandeg svlandeg self-assigned this Mar 10, 2026
@codspeed-hq

codspeed-hq Bot commented Mar 10, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 20 untouched benchmarks


Comparing svlandeg:feat/ty (11a0f1b) with master (4b82602)1

Open in CodSpeed

Footnotes

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

@github-actions

github-actions Bot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

📝 Docs preview

Last commit 11a0f1b at: https://fc84969f.fastapitiangolo.pages.dev

Comment thread fastapi/security/http.py
self.model: HTTPBaseModel = HTTPBaseModel(
scheme=scheme, description=description
)
self.model = HTTPBaseModel(scheme=scheme, description=description)

@svlandeg svlandeg Mar 10, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Here (and in a few similar cases), I've moved the typing to the var on the class, assuming that it wouldn't get a different type at any time. By moving the typing in this way, type checkers can more easily deduce the correct type of class vars.

@svlandeg
svlandeg marked this pull request as ready for review March 11, 2026 11:23
@svlandeg
svlandeg requested a review from YuriiMotov March 11, 2026 11:23
@svlandeg svlandeg removed their assignment Mar 11, 2026

@YuriiMotov YuriiMotov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM in general!

Added several suggestions in review comments. Can help with the implementation if needed)
@svlandeg, what do you think?

Comment thread fastapi/_compat/v2.py
Comment thread fastapi/encoders.py
Comment thread fastapi/param_functions.py Outdated
Comment thread fastapi/routing.py Outdated
Comment thread fastapi/dependencies/utils.py
Comment thread fastapi/dependencies/utils.py Outdated
Comment thread fastapi/openapi/utils.py Outdated
Comment thread fastapi/applications.py Outdated
Comment thread fastapi/routing.py Outdated
@svlandeg svlandeg self-assigned this Mar 11, 2026
svlandeg and others added 2 commits March 12, 2026 21:26
Co-authored-by: Motov Yurii <109919500+YuriiMotov@users.noreply.github.com>
Co-authored-by: Motov Yurii <109919500+YuriiMotov@users.noreply.github.com>
@svlandeg

Copy link
Copy Markdown
Member Author

Thanks so much for the thorough review @YuriiMotov! I've addressed all comments in detail, let me know if there's any other concerns!

@svlandeg
svlandeg marked this pull request as ready for review March 13, 2026 15:34
@svlandeg svlandeg removed their assignment Mar 13, 2026
@svlandeg
svlandeg requested a review from YuriiMotov March 13, 2026 15:35

@tiangolo tiangolo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks awesome, thank you @svlandeg ! 🙌

And thanks @YuriiMotov for the thorough review too!

@tiangolo
tiangolo merged commit 98b269b into fastapi:master Mar 15, 2026
38 checks passed
@svlandeg
svlandeg deleted the feat/ty branch March 16, 2026 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Internal changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.