Replace libcst with stdlib AST + tokenize - #169
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
AlexWaygood
force-pushed
the
libcst-no-deps
branch
from
June 8, 2026 22:35
df304d3 to
c1924ff
Compare
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
AlexWaygood
force-pushed
the
libcst-no-deps
branch
from
June 9, 2026 10:20
85ed461 to
a044bb7
Compare
This comment has been minimized.
This comment has been minimized.
AlexWaygood
force-pushed
the
libcst-no-deps
branch
from
June 9, 2026 10:28
a044bb7 to
6c7e52a
Compare
This comment has been minimized.
This comment has been minimized.
AlexWaygood
force-pushed
the
libcst-no-deps
branch
from
June 9, 2026 10:41
6c7e52a to
ac810c8
Compare
This comment has been minimized.
This comment has been minimized.
AlexWaygood
force-pushed
the
libcst-no-deps
branch
from
June 9, 2026 10:57
ac810c8 to
9a7612b
Compare
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
AlexWaygood
force-pushed
the
libcst-no-deps
branch
from
June 9, 2026 11:02
3101466 to
3814f56
Compare
This comment has been minimized.
This comment has been minimized.
AlexWaygood
force-pushed
the
libcst-no-deps
branch
from
June 9, 2026 11:06
3814f56 to
fbfd350
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
This change has no effect on the docstrings that would be added to typeshed. 🤖🎉 |
AlexWaygood
marked this pull request as ready for review
June 9, 2026 13:25
AlexWaygood
added a commit
to astral-sh/ruff
that referenced
this pull request
Jun 9, 2026
## Summary Pulls in astral-sh/docstring-adder#169, so that we have a version of docstring-adder that supports 3.15. This enables us to add docstrings for the new-in-3.15 branches in typeshed. I also switched us to temporarily use a version of Black from git, because I'm too impatient to wait for a release that includes psf/black@f665703. ## Test Plan CI on docstring-adder
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.
Replace libcst with a handwritten codemod implementation using the stdlib AST + tokenize modules.
libcst doesn't support Python 3.15 yet, and it may be months until it does. I don't really know what the maintenance story is over there these days, and I don't want docstring-adder's Python-version support to be tied to a Meta repo. Using stdlib AST + tokenize adds less complexity than I would've assumed; it actually allows us to simplify the implementation in a number of places.
I also explored using the asttokens library (see #166). It doesn't simplify things meaningfully over this approach, however, and I don't like the library's approach of monkeypatching tokens onto AST nodes. It makes it very hard to use the library in an app like this that uses strict typing. I'm also not sure what the maintenance story is over in that repo: there haven't been any commits in half a year; and the type hints are extremely antiquated (they can't be understood by ty).
Closes #165