skillfed

libcst

A concrete syntax tree with AST-like properties for Python 3.0 through 3.15 programs.

libcst Permissive license All contributions towards LibCST are MIT licensed. Some Python files have been derived from the standard library and are therefore PSF licensed. Modifications on these files are dual licensed (both… (full text in the JSON record) Active 1,935 v1.9.0 released

Install

libcst on PyPI

pip

pip install libcst

uv

uv add libcst

poetry

poetry add libcst

Package facts

License All contributions towards LibCST are MIT licensed. Some Python files have been derived from the standard library and are therefore PSF licensed. Modifications on these files are dual licensed (both… (full text in the JSON record) (permissive)
Python support supports the current Python release (>=3.9)
Install friction medium — platform-specific wheel
Runtime dependencies 3 — pyyaml, pyyaml-ft, typing-extensions
Maintenance actively maintained — 15 days since the last release
Last repo commit
First released
Popularity one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13)
Known vulnerabilities none known (OSV.dev, checked 2026-08-13)

Evidence: libcst-1.9.0-cp310-cp310-macosx_11_0_arm64.whl; libcst-1.9.0-cp310-cp310-manylinux_2_28_aarch64.whl; libcst-1.9.0-cp310-cp310-manylinux_2_28_x86_64.whl; libcst-1.9.0-cp310-cp310-musllinux_1_2_aarch64.whl; libcst-1.9.0-cp310-cp310-musllinux_1_2_x86_64.whl; libcst-1.9.0-cp310-cp310-win_amd64.whl; libcst-1.9.0-cp310-cp310-win_arm64.whl; libcst-1.9.0-cp311-cp311-macosx_11_0_arm64.whl; libcst-1.9.0-cp311-cp311-manylinux_2_28_aarch64.whl; libcst-1.9.0-cp311-cp311-manylinux_2_28_x86_64.whl; libcst-1.9.0-cp311-cp311-musllinux_1_2_aarch64.whl; libcst-1.9.0-cp311-cp311-musllinux_1_2_x86_64.whl; libcst-1.9.0-cp311-cp311-win_amd64.whl; libcst-1.9.0-cp311-cp311-win_arm64.whl; libcst-1.9.0-cp312-cp312-macosx_11_0_arm64.whl; libcst-1.9.0-cp312-cp312-manylinux_2_28_aarch64.whl; libcst-1.9.0-cp312-cp312-manylinux_2_28_x86_64.whl; libcst-1.9.0-cp312-cp312-musllinux_1_2_aarch64.whl; libcst-1.9.0-cp312-cp312-musllinux_1_2_x86_64.whl; libcst-1.9.0-cp312-cp312-win_amd64.whl

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Programming Language :: Python :: 3.9Programming Language :: Python :: Free ThreadingTopic :: Software Development :: LibrariesTyping :: Typed

About libcst

from the package's own PyPI description — quoted content, verbatim

.. image:: docs/source/_static/logo/horizontal.svg :width: 600 px :alt: LibCST

A Concrete Syntax Tree (CST) parser and serializer library for Python

|support-ukraine| |readthedocs-badge| |ci-badge| |pypi-badge| |pypi-download| |notebook-badge| |types-badge|

.. |support-ukraine| image:: https://img.shields.io/badge/Support-Ukraine-FFD500?style=flat&labelColor=005BBB :alt: Support Ukraine - Help Provide Humanitarian Aid to Ukraine. :target: https://opensource.fb.com/support-ukraine

.. |readthedocs-badge| image:: https://readthedocs.org/projects/libcst/badge/?version=latest&style=flat :target: https://libcst.readthedocs.io/en/latest/ :alt: Documentation

.. |ci-badge| image:: https://github.com/Instagram/LibCST/actions/workflows/build.yml/badge.svg :target: https://github.com/Instagram/LibCST/actions/workflows/build.yml?query=branch%3Amain :alt: Github Actions

.. |pypi-badge| image:: https://img.shields.io/pypi/v/libcst.svg :target: https://pypi.org/project/libcst :alt: PYPI

.. |pypi-download| image:: https://pepy.tech/badge/libcst/month :target: https://pepy.tech/project/libcst/month :alt: PYPI Download

.. |notebook-badge| image::...

Read as markdown · JSON record · Source repository · Docs

AI interpretation — verify before relying

AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page

LibCST parses Python 3.0–3.15 source code into a lossless Concrete Syntax Tree that preserves all formatting (comments, whitespace, parentheses), enabling automated refactoring and linting tools to read and modify code while maintaining exact formatting.

Medium install friction due to a native Rust extension; binary wheels cover Linux/Windows x86/x64 and macOS x64/arm64, but other platforms require a Rust toolchain. Actively maintained with a release 15 days ago and 1935 GitHub stars.

Dual/multi-licensed: primarily MIT, with portions dual-licensed MIT/PSF (derived from Python standard library) and Apache 2.0 (dataclasses code). Permissive overall; safe for commercial use with proper attribution.

Usage

pip install libcst

import libcst as cst
from libcst.tool import dump

tree = cst.parse_expression("(1 + 2)")
print(dump(tree))

Requires Python 3.9+. If a binary wheel is unavailable for your platform, you must have Rust toolchain (cargo) installed.

Verdict: LibCST is a well-maintained, actively developed parser for building code transformation tools. Its lossless CST design and broad Python version support (3.9–3.15) make it suitable for production refactoring and linting. Medium install friction from native compilation is offset by prebuilt wheels for common platforms and zero known vulnerabilities.

Needs verification

  • Whether pyyaml and pyyaml-ft serve distinct purposes or if pyyaml-ft is a variant that may conflict
  • Performance characteristics and memory footprint for large codebases relative to standard ast module
  • Maturity and stability guarantees for Python 3.14–3.15 support (marked as beta in classifiers)
python code parser with formattingconcrete syntax tree cstpython refactoring codemod toolast parser preserves commentspython source code transformationlossless syntax tree librarypython linter framework

Similar packages