Repository navigation
Conversation
Daverball
force-pushed
the
feat/py315
branch
from
September 24, 2026 07:24
2774279 to
68940a3
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #211 +/- ##
=======================================
+ Coverage 96.5% 97.0% +0.4%
=======================================
Files 4 4
Lines 968 1000 +32
=======================================
+ Hits 935 970 +35
+ Misses 33 30 -3
🚀 New features to boost your workflow:
|
Daverball
force-pushed
the
feat/py315
branch
from
September 24, 2026 07:29
68940a3 to
8d34ec3
Compare
Daverball
force-pushed
the
feat/py315
branch
2 times, most recently
from
September 24, 2026 09:51
00bd6a8 to
e7bd178
Compare
Daverball
force-pushed
the
feat/py315
branch
from
September 24, 2026 09:54
e7bd178 to
edc1064
Compare
Daverball
force-pushed
the
feat/py315
branch
from
September 29, 2026 06:27
b73339e to
604e4cc
Compare
Collaborator
Author
|
@sondrelg Do you think you could take a quick look at what's being proposed here? (I don't think this needs an in-depth line-by-line review, but if you want to do that, I recommend looking at the individual commits separately, to get a cleaner diff) That way we could have this ready in time for the release of Python 3.15 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Python 3.15 adds lazy imports which provide a new way to reduce the import overhead of type hints. It is however not as reliable, since inspecting
__annotations__will always trigger the lazy imports for symbols used in annotations, even if a format likeannotationlib.Format.FORWARDREFis used and there is no way to inspect it in a different way that doesn't trigger the imports.Nevertheless we want to recognize lazy imports and not push people away from them, so for the purposes of
TC001,TC002andTC003these imports are ignored, just like existing imports inside type checking blocks are. On the contrary we will never flag lazy imports withTC004or intend to add a similar rule for lazy imports, since there's both many other reasons why you may want the import to be lazy (like breaking import cycles, without putting the import into a function) and no clear indication for when deferred annotations will be inspected, so we mostly couldn't tell when the lazy imports will be triggered anyways. We instead defer the management of lazy imports to other existing linters likeflake8-lazyandruff, which both provide dedicated rules for managing them and should work well hand in hand withflake8-type-checkingin this mode.For good interoperability between
flake8-lazyandflake8-type-checkingwe support their f-string based way of putting relative imports into__lazy_modules__, since otherwise there's no reliable way to map relative imports to the absolute names used in__lazy_modules__, without adding a lot of code, configuration options and overhead to determine the parent module(s) of the file we're linting.There are a couple of new settings related to lazy imports. Please refer to the README for when and how to use them.
This also drops support for Python 3.10 which will reach its EOL at the end of October (this also seems like a good opportunity for us to refactor some our AST traversal code into match statements, which are well suited for this task).
This also adds zizmor as a security linter for our GitHub Actions workflows. I used actions-up to update and pin the workflows to their current latest version in order to comply with zizmor's recommendations.