Skip to content

Update LibCST-based fixes for Python 3.15 - #28616

Merged
ntBre merged 4 commits into
mainfrom
brent/libcst-1.9-python315-fixes
Sep 17, 2026
Merged

ntBre merged 4 commits into
mainfrom
brent/libcst-1.9-python315-fixes

Conversation

@ntBre

@ntBre ntBre commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

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 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.

Test Plan

Updated existing snapshots for the C4 rules and new mdtests for the import helpers

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
@ntBre ntBre added fixes Related to suggested fixes for violations python315 Related to Python 3.15 do-not-merge Do not merge this pull request labels Sep 15, 2026
@ntBre ntBre mentioned this pull request Sep 15, 2026
27 of 32 tasks
@astral-sh-bot

astral-sh-bot Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Typing conformance results

No changes detected ✅

Current numbers
The 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.

@astral-sh-bot

astral-sh-bot Bot commented Sep 15, 2026

Copy link
Copy Markdown

Memory usage report

Memory usage unchanged ✅

@astral-sh-bot

astral-sh-bot Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

ecosystem-analyzer results

No diagnostic changes detected ✅

Flaky changes detected. This PR summary excludes flaky changes; see the HTML report for details.

Full report with detailed diff (timing results)

@astral-sh-bot

astral-sh-bot Bot commented Sep 15, 2026

Copy link
Copy Markdown

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@ntBre
ntBre marked this pull request as ready for review September 15, 2026 16:45
@ntBre
ntBre requested a review from MichaReiser September 15, 2026 16:45
@MichaReiser

Copy link
Copy Markdown
Member

We can merge this once renovate bumps the version normally)

I believe we can bump the version sooner. I believe renovate has a longer cooldown than what we require as minimal dependency age.

@ntBre ntBre removed the do-not-merge Do not merge this pull request label Sep 17, 2026
@ntBre
ntBre merged commit f8519be into main Sep 17, 2026
73 checks passed
@ntBre
ntBre deleted the brent/libcst-1.9-python315-fixes branch September 17, 2026 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fixes Related to suggested fixes for violations python315 Related to Python 3.15

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants