Use the LibCST native extension for parsing
mainThe libcst.native module is a Rust-based extension that enables high-performance parsing of Python grammar using a PEG parser. It is packaged with LibCST and is used by default by the standard LibCST APIs.
Key features include:
- Feature parity with the pure-python parser (supports target versions, strings, and bytes).
- High performance (aiming for within 2x CPython performance).
- Uses a PEG parser to closely follow the CPython grammar definition.
While the core logic is in Rust, the Python wrapper handles input conversion (e.g., converting bytes to UTF-8 strings) before passing them to the Rust layer.