--- id: ast-serialize version: "0.8.0" license: MIT license_treatment: permissive maintenance: active --- # ast-serialize — Python bindings for mypy AST serialization License: permissive · Maintenance: active · Popularity: top 1,000 on PyPI ## Install pip install ast-serialize uv add ast-serialize poetry add ast-serialize ## Description # ast_serialize - Python Parser and AST Serializer This is a fast Python extension for parsing Python files and serializing the AST using the native binary format used by mypy. This will eventually replace the current mypy parser, which uses the Python stdlib `ast` module for parsing. **This is work in progress.** ## Development Prerequisites: - Recent Rust toolchain - Python 3.10+ (3.13t or 3.14t for free-threaded builds) - [maturin](https://github.com/PyO3/maturin): `pip install maturin` - Checkout of [mypy repo](https://github.com/python/mypy) for testing Development build (fast compilation, unoptimized): ```bash maturin develop ``` Optimized development build: ```bash maturin develop --release ``` ## Testing **Rust unit tests:** ```bash cargo test ``` **Python integration tests:** Run end-to-end parser and serialization/deserialization tests using mypy's test suite in the new-parser branch: ```bash cd ~/src/mypy [or wherever you have mypy] pytest mypy -k NativeParser ``` Add new test cases to `test-data/unit/native-parser.test` (in the mypy repository). See the main parser test cases in `parse.test` for the expected output format. **Note:** Run `maturin... ## AI interpretation — verify before relying A fast Python extension that parses Python source files and serializes their abstract syntax trees using mypy's native binary format, intended to eventually replace mypy's stdlib-based parser. Verdict: A young but actively maintained Rust-based parser designed for mypy integration, offering performance gains over stdlib ast. Zero known vulnerabilities and permissive licensing make it safe to evaluate, but alpha status and tight coupling to mypy's development cycle mean it is not yet a general-purpose replacement for standard parsing. [View on SkillFed](https://skillfed.io/packages/ast-serialize) · [View on PyPI](https://pypi.org/project/ast-serialize/)