ast-serialize
Python bindings for mypy AST serialization
Install
ast-serialize on PyPI
pip
pip install ast-serializeuv
uv add ast-serializepoetry
poetry add ast-serializePackage facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 6 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: ast_serialize-0.8.0-cp314-cp314-pyemscripten_2026_0_wasm32.whl; ast_serialize-0.8.0-cp314-cp314t-macosx_10_12_x86_64.whl; ast_serialize-0.8.0-cp314-cp314t-macosx_11_0_arm64.whl; ast_serialize-0.8.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; ast_serialize-0.8.0-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; ast_serialize-0.8.0-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; ast_serialize-0.8.0-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl; ast_serialize-0.8.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; ast_serialize-0.8.0-cp314-cp314t-manylinux_2_31_riscv64.whl; ast_serialize-0.8.0-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl; ast_serialize-0.8.0-cp314-cp314t-musllinux_1_2_aarch64.whl; ast_serialize-0.8.0-cp314-cp314t-musllinux_1_2_armv7l.whl; ast_serialize-0.8.0-cp314-cp314t-musllinux_1_2_i686.whl; ast_serialize-0.8.0-cp314-cp314t-musllinux_1_2_ppc64le.whl; ast_serialize-0.8.0-cp314-cp314t-musllinux_1_2_riscv64.whl; ast_serialize-0.8.0-cp314-cp314t-musllinux_1_2_x86_64.whl; ast_serialize-0.8.0-cp314-cp314t-win32.whl; ast_serialize-0.8.0-cp314-cp314t-win_amd64.whl; ast_serialize-0.8.0-cp314-cp314t-win_arm64.whl; ast_serialize-0.8.0-cp315-abi3.abi3t-macosx_10_12_x86_64.whl
About ast-serialize
from the package's own PyPI description — quoted content, verbatim
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:
pip install maturin - Checkout of mypy repo for testing
Development build (fast compilation, unoptimized):
maturin develop
Optimized development build:
maturin develop --release
Testing
Rust unit tests:
cargo test
Python integration tests: Run end-to-end parser and serialization/deserialization tests using mypy's test suite in the new-parser branch:
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...
Read as markdown · JSON record · Source repository · Homepage
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
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.
Medium install friction due to compiled wheels for multiple Python versions and architectures; actively maintained with a release 6 days ago and recent commits, though the project is marked as alpha (Development Status 3) and explicitly noted as work in progress.
MIT license permits commercial and private use with minimal restrictions, making it suitable for integration into type checkers and development tools.
Usage
pip install ast-serialize==0.8.0
import ast_serialize
# Parse and serialize Python code using mypy's native format
result = ast_serialize.parse("x = 1")
Requires Python 3.7+; free-threaded builds (3.13t, 3.14t) need the corresponding CPython free-threaded interpreter installed.
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.
Needs verification
- Whether ast_serialize's output format is stable across versions or subject to breaking changes during alpha development.
- Performance benchmarks comparing ast_serialize to stdlib ast module for typical use cases.
- Whether the package can be used independently of mypy or is primarily intended as an internal mypy component.
Similar packages
permissive · top 1,000 on PyPI
librtpermissive · top 1,000 on PyPI
tokenizerspermissive · top 1,000 on PyPI
tree-sitter-bashpermissive · top 1,000 on PyPI
fastarpermissive · top 1,000 on PyPI
bcryptpermissive · top 1,000 on PyPI
fastuuidpermissive · top 1,000 on PyPI
pytokenspermissive · top 1,000 on PyPI
deltalakepermissive · top 1,000 on PyPI
mypy-extensionsunclear · top 1,000 on PyPI