Enable and enforce modern type annotations across the codebase #13371
+2,069
−1,965
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #10725
This enables and enforces (via linting) Python 3.10+ style type annotations across the codebase.
x-ref #13182, which has the wonderful statement "currently pip coding style is to simply avoid PEP 585- and PEP 604-style type annotations" that would no longer be true after this PR.
x-ref #13236
This PR is going to be easiest to review commit-by-commit, but practically speaking, the first and last commit are almost entirely handled by Ruff itself. astral-sh/ruff#17763 was a slightly annoying aspect of enabling FA100 but that should be less of a concern moving forward since a PR introducing new annotations can also introduce the relevant import.