What does HackerNews think of LibCST?

A concrete syntax tree parser and serializer library for Python that preserves many aspects of Python's abstract syntax tree

Language: Python

Better late than never :)

FB people have great experience with introducing typing into weakly typed languages (e.g. PHP vs Hack). So I actually started using pyre-check in place of mypy. The tool is really great and fast. I also like pysa quite a lot.

Pyright only came into focus because it was best Python LSP implementation for NeoVim, and it is also the default for helix-editor which I play with. It's also nice that I could suggest pyright for some younger colleagues using VisualStudio Code (with strict mode enabled of course).

P.S. I'm also using other interesting tools and libraries from FB (Instagram) like libcst [1] or fixit [2]

[1] https://github.com/Instagram/LibCST/ [2] https://github.com/Instagram/Fixit

Never used it but it appears that Facebook/Instagram have a format preserving CST library for Python: https://github.com/Instagram/LibCST
Are you sure it wraps the LibCST library (https://github.com/Instagram/LibCST)?

> Bowler builds on top of the Concrete Syntax Tree (CST) provided by lib2to3 in the standard library.

> One of the problems of patching code using ast package of Python is that it loses all the formatting and comments of the original source code.

What you actually want here is a concrete syntax tree preserving all the comments and whitespace. There’s a sort of built-in one as part of lib2to3 used by the likes of black and yapf. There’s also a good third party options now in the form of https://github.com/Instagram/LibCST.

There’s been talks about adding a CST module to PSL, but I don’t think the proposal went anywhere.

https://bugs.python.org/issue33337