mirror of
https://github.com/Instagram/LibCST.git
synced 2025-12-23 10:35:53 +00:00
A concrete syntax tree parser and serializer library for Python that preserves many aspects of Python's abstract syntax tree
https://libcst.readthedocs.io/
This ended up being pretty complicated, so the parser stuff will come in another diff. Hopefully this should set up up nicely for dicts, sets, and lists too. |
||
|---|---|---|
| libcst | ||
| stubs | ||
| .gitignore | ||
| LICENSE | ||
| README.md | ||
| requirements.txt | ||
| setup.py | ||
LibCST
TODO: Add documentation.
Auto-formatting code with isort and Black
We use isort and black to format code. To format changes to be conformant, run the following in the root:
isort -q -w 88 -m 3 -tc -fgw 0 -lai 2 -ca -ns __init__.py -y ; black --target-version py36 libcst/
Running tests
To run all tests, do the following in the root:
find -name "test_*.py" -printf '%P\n' | xargs python3 -m unittest
Verifying types with Pyre
To verify types for the library, do the following in the root:
pyre --source-directory . --search-path stubs/ check
Examining a sample tree
To examine the tree that is parsed from a particular file, do the following:
python -m libcst.tool print <some_py_file.py>