r/Python • • Oct 29 '26

Discussion Alternative to libCST

Looking for a suggestion of an alternative CST parser to libcst. Have been trying to install libcst for over two days now but still unable to do so, I think the issue might be that there is no PyYaml `wheel` for Python 3.15.

So now wondering if there might be some other alternative CST parser available. I need to parse comments as well as other code so standard AST won't work as far as I know.

16 Upvotes

14 comments sorted by

View all comments

24

u/V0idL0rd Oct 29 '26

Python 3.15 came out very recently, I think a lot of popular libraries are still in the process of being updated, maybe try with python 3.14 for now and upgrade later?

-3

u/RomfordNavy Oct 29 '26

Not so easy to do in this case as code relies on lazy imports which didn't exist in 3.14.

9

u/coderanger Oct 29 '26

So remove them? It's literally a 2 week old feature, have you made so many changes in that time as to make backing them out impossible?

0

u/RomfordNavy Oct 29 '26

Been working with lazy imports for a few months now on earlier non-final releases of 3.15. In order to avoid cyclical imports much of the code relies upon lazy imports, really don't want to have to revert to the previous way I was doing things as much has changed since then.

5

u/really_not_unreal Oct 30 '26

In that case you'll have to live without.

7

u/mr_frpdo Oct 29 '26

Technically Lazy is just synthetic sugar. It can be rewritten to use with out it.