Repository navigation
Update LibCST-based fixes for Python 3.15 - #28616
Merged
Merged
Conversation
Summary
--
This PR bumps our libcst version to 1.9 and incorporates the new support for Python 3.15 into fixes
that involved imports and unpacking in comprehensions. The unpacking fixes affect 3 C4 rules and are
in the first (non-empty) commit, while the lazy import fixes are a bit more widespread and are in
the second commit.
I admittedly wasn't that familiar with our usage of libcst before this, but it looks like we have
kind of a weird mix between using libcst and additional manual string manipulation. My changes
preserve that with a couple of `format!("lazy {fix}")` calls. libcst also itself makes this change a
bit awkward by using separate node types for lazy and non-lazy imports, so I ended up returning the
parts of the imports instead of `Import` types directly in a couple of cases.
(I'm putting do-not-merge on this for now to avoid violating our dependency cooldown, but the
changes themselves should be ready to review ahead of that)
Test Plan
--
Updated existing snapshots for the C4 rules and new mdtests for the import helpers
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 97.87%. The percentage of expected errors that received a diagnostic held steady at 97.78%. The number of fully passing files held steady at 130/145. |
Memory usage reportMemory usage unchanged ✅ |
|
|
ntBre
marked this pull request as ready for review
September 15, 2026 16:45
Member
I believe we can bump the version sooner. I believe renovate has a longer cooldown than what we require as minimal dependency age. |
MichaReiser
approved these changes
Sep 16, 2026
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.
Summary
This PR bumps our libcst version to 1.9 and incorporates the new support for Python 3.15 into fixes
that involved imports and unpacking in comprehensions. The unpacking fixes affect three C4 rules and are
in the first (non-empty) commit, while the lazy import fixes are a bit more widespread and are in
the second commit.
I admittedly wasn't that familiar with our usage of libcst before this, but it looks like we have
kind of a weird mix between using libcst and additional manual string manipulation. My changes
preserve that with a couple of
format!("lazy {fix}")calls. libcst also itself makes this change abit awkward by using separate node types for lazy and non-lazy imports, so I ended up returning the
parts of the imports instead of
Importtypes directly in a couple of cases.Test Plan
Updated existing snapshots for the C4 rules and new mdtests for the import helpers