amyreese / fissix

backport of lib2to3, with enhancements
Other
44 stars 22 forks source link

Plans on 3.9+ support? #39

Open sobolevn opened 3 years ago

sobolevn commented 3 years ago

Hi! Do you have any plans on supporting new Python versions? Or since this is a backport - this is out of scope?

amyreese commented 3 years ago

If there's a reasonable grammar change for PEP 614, I'd be willing to review a PR. However, given the broader move towards PEG parsing in CPython, it's likely that fissix will never support Python 3.10 or future versions, as those grammar changes can not be expressed with pgen2, and adopting a PEG parser is almost certainly out of scope for this project.

I think it would be better to build a new project with similar goals on top of CPython's PEG parser, and drive adoption in projects that currently use fissix/parso/baron/etc.

cclauss commented 4 months ago

The GitHub Actions pass on current versions of CPython and even on Python 3.13 beta which has lib2to3 removed.

What is the status of this issue?

amyreese commented 4 months ago

I see this issue as primarily tracking support for syntax features from Python versions past 3.8, when lib2to3 was unofficially deprecated/abandoned in CPython. I'm not aware of any grammar changes/fixes in upstream lib2to3, but would be happily surprised to find out otherwise, and we can always pull those into fissix if possible.

Otherwise, as-is fissix will run just fine on newer version of Python, but can't parse things like decorator expressions, match statements, exception groups, inline type vars, etc. If your code worked on Python 3.8, then fissix will continue to work on it as well, but short of someone working to update fissix's grammar/parser, or porting Black's work from their own custom fork, this is probably the end of the line for fissix feature wise.

As an alternative, I can recommend LibCST, which has its own PEG parser and already supports 3.12 syntax, but of course it's not a drop-in replacement for fissix. It has a much more detailed set of types for each CST node, closer in spirit to the ast module in stdlib, but with all the necessary features for tracking whitespace/comments/etc.

I've personally used LibCST with good results in µsort and Fixit, so my own need for maintaining fissix has mostly passed, but I will continue to do so as long as others find it useful. At one point I considered working with PyCQA to hand off ownership/maintenance since it's used by their modernize project, but even that would have required more effort than it was worth to me — happy to let someone else lead that charge if they are interested.

cclauss commented 4 months ago

Perfect answer @amyreese. Thanks.