Jimmy Lai <yuri...@gmail.com> added the comment:

Just found Guido mentioned LibCST. Here is a quick overview:
1. LibCST is an open source Python concrete syntax tree parser. It provides a 
CST looks like and feel like AST.

2. It's built by Instagram for linter and refactoring tools (exact use cases 
what Ɓukasz mentioned). We have a linter framework built on top of LibCST which 
allows a lint rule automatically fixes the issue (autofixer) for developers. 
We're working on open source it to help developers write better code easily. CC 
Tim
We also found a couple other linter related open source tools use LibCST.

3. It's based on parso (which based on pgen2) and currently supports Python 3.5 
to 3.8. Tim is working on adding the support back to 3.0 now and potentially 
2.7 later.

4. It provides various patterns for traversing and modifying CST easily, 
including the AST visitor/transformer pattern, matchers pattern, various 
helpers for find/replace nodes in a tree and high level transform helpers (e.g. 
added needed import, remove unused import).

5. It also provides metadata for tree node from static analysis, e.g. 
line/column position, qualified name, scope analysis, inferred type annotation 
(through Pyre). Those are useful information for building advanced linter or 
refactoring tool.

There are more features available in LibCST. We continue to develop it to make 
automated refactoring even easier. We welcome your feedback and PRs!

----------
nosy: +jimmylai

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33337>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to