Structural Search and Rewrite code at large scale using precise AST pattern.
Project Links
Meta
Author: Herrington Darkholme
Maintainer: Herrington Darkholme
Requires Python: >=3.8
Classifiers
Development Status
- 3 - Alpha
Environment
- Console
Intended Audience
- Developers
License
- OSI Approved :: MIT License
Operating System
- OS Independent
Programming Language
- Rust
Topic
- Security
- Software Development :: Quality Assurance
- Software Development
- Text Processing
ast-grep python binding
ast-grep
ast-grep is a tool for code structural search, lint, and rewriting.
This crate intends to build a native python binding of ast-grep and provide a python API for programmatic usage.
Installation
pip install ast-grep-py
Usage
You can take our tests as examples. For example, test_simple.py shows how to use ast-grep to search for a pattern in a file.
Please see the API usage guide and API reference for more details.
Other resources include ast-grep's official site and repository.
Development
Setup virtualenv
python -m venv venv
Activate venv
source venv/bin/activate
Install maturin
pip install maturin[patchelf]
MacOS: Install patchelf and maturin
brew install patchelf
pip install maturin
Build bindings
maturin develop
Run tests
pytest
All tests files are under tests directory.
License
This project is licensed under the MIT license.
0.42.1
Apr 04, 2026
0.42.0
Mar 16, 2026
0.41.1
Mar 10, 2026
0.41.0
Feb 22, 2026
0.40.5
Jan 10, 2026
0.40.4
Jan 05, 2026
0.40.3
Dec 15, 2025
0.40.2
Dec 14, 2025
0.40.1
Dec 11, 2025
0.40.0
Nov 16, 2025
0.39.9
Nov 07, 2025
0.39.7
Oct 27, 2025
0.39.6
Oct 05, 2025
0.39.5
Sep 08, 2025
0.39.4
Aug 17, 2025
0.39.3
Aug 05, 2025
0.39.2
Jul 27, 2025
0.39.1
Jul 21, 2025
0.39.0
Jul 21, 2025
0.38.7
Jul 10, 2025
0.38.6
Jun 24, 2025
0.38.5
Jun 08, 2025
0.38.4
Jun 02, 2025
0.38.3
May 28, 2025
0.38.2
May 18, 2025
0.38.1
May 11, 2025
0.38.0
May 10, 2025
0.37.0
Apr 15, 2025
0.36.3
Apr 13, 2025
0.36.2
Mar 19, 2025
0.36.1
Mar 11, 2025
0.36.0
Mar 09, 2025
0.35.0
Feb 15, 2025
0.34.4
Feb 02, 2025
0.34.3
Jan 27, 2025
0.34.2
Jan 27, 2025
0.34.1
Jan 26, 2025
0.34.0
Jan 26, 2025
0.33.1
Jan 13, 2025
0.33.0
Jan 05, 2025
0.32.3
Dec 30, 2024
0.32.2
Dec 18, 2024
0.32.1
Dec 17, 2024
0.32.0
Dec 17, 2024
0.31.1
Dec 08, 2024
0.31.0
Dec 02, 2024
0.30.1
Nov 27, 2024
0.30.0
Nov 11, 2024
0.29.0
Oct 30, 2024
0.28.1
Oct 20, 2024
0.28.0
Oct 06, 2024
0.27.3
Sep 22, 2024
0.27.2
Sep 22, 2024
0.27.1
Sep 08, 2024
0.27.0
Sep 07, 2024
0.26.3
Aug 25, 2024
0.26.2
Aug 18, 2024
0.26.1
Aug 09, 2024
0.26.0
Aug 08, 2024
0.25.7
Aug 05, 2024
0.25.6
Aug 05, 2024
0.25.5
Aug 01, 2024
0.25.4
Jul 26, 2024
0.25.3
Jul 23, 2024
0.25.2
Jul 19, 2024
0.25.1
Jul 15, 2024
0.25.0
Jul 14, 2024
0.24.1
Jun 26, 2024
0.24.0
Jun 23, 2024
0.23.1
Jun 22, 2024
0.23.0
Jun 11, 2024
0.22.6
Jun 05, 2024
0.22.5
Jun 02, 2024
0.22.4
May 27, 2024
0.22.3
May 13, 2024
0.22.2
May 12, 2024
0.22.1
May 12, 2024
0.22.0
May 08, 2024
0.21.4
May 06, 2024
0.21.3
May 03, 2024
0.21.2
May 02, 2024
0.21.1
Apr 25, 2024
0.20.5
Apr 11, 2024
0.20.4
Apr 08, 2024
0.20.3
Apr 08, 2024
0.20.2
Mar 27, 2024
0.20.1
Mar 25, 2024
0.20.0
Mar 24, 2024
0.19.4
Mar 11, 2024
0.19.3
Feb 25, 2024
0.19.2
Feb 23, 2024
0.19.1
Feb 19, 2024
0.19.0
Feb 15, 2024
0.18.1
Feb 01, 2024
0.18.0
Jan 31, 2024
0.17.1
Jan 12, 2024
0.17.0
Jan 11, 2024
0.16.1
Jan 05, 2024
0.16.0
Dec 29, 2023
0.15.1
Dec 18, 2023
0.15.0
Dec 16, 2023
0.14.4
Dec 12, 2023
0.14.3
Dec 11, 2023
0.14.2
Dec 03, 2023
0.14.1
Dec 01, 2023
0.13.2
Nov 20, 2023
0.13.1
Nov 15, 2023
0.13.0
Nov 06, 2023
Wheel compatibility matrix
| Platform | CPython 3.10 | CPython 3.11 | CPython 3.12 | CPython 3.13 | CPython 3.14 |
|---|---|---|---|---|---|
| macosx_10_12_x86_64 | |||||
| macosx_11_0_arm64 | |||||
| manylinux_2_28_aarch64 | |||||
| manylinux_2_28_x86_64 | |||||
| win32 | |||||
| win_amd64 |
Files in release
ast_grep_py-0.42.1-cp310-cp310-manylinux_2_28_aarch64.whl (4.9MiB)
ast_grep_py-0.42.1-cp310-cp310-manylinux_2_28_x86_64.whl (5.0MiB)
ast_grep_py-0.42.1-cp310-cp310-win32.whl (4.6MiB)
ast_grep_py-0.42.1-cp310-cp310-win_amd64.whl (4.8MiB)
ast_grep_py-0.42.1-cp311-cp311-macosx_10_12_x86_64.whl (4.9MiB)
ast_grep_py-0.42.1-cp311-cp311-macosx_11_0_arm64.whl (5.1MiB)
ast_grep_py-0.42.1-cp311-cp311-manylinux_2_28_aarch64.whl (4.9MiB)
ast_grep_py-0.42.1-cp311-cp311-manylinux_2_28_x86_64.whl (5.0MiB)
ast_grep_py-0.42.1-cp311-cp311-win32.whl (4.6MiB)
ast_grep_py-0.42.1-cp311-cp311-win_amd64.whl (4.8MiB)
ast_grep_py-0.42.1-cp312-cp312-macosx_10_12_x86_64.whl (4.9MiB)
ast_grep_py-0.42.1-cp312-cp312-macosx_11_0_arm64.whl (5.1MiB)
ast_grep_py-0.42.1-cp312-cp312-manylinux_2_28_aarch64.whl (4.9MiB)
ast_grep_py-0.42.1-cp312-cp312-manylinux_2_28_x86_64.whl (5.0MiB)
ast_grep_py-0.42.1-cp312-cp312-win32.whl (4.6MiB)
ast_grep_py-0.42.1-cp312-cp312-win_amd64.whl (4.8MiB)
ast_grep_py-0.42.1-cp313-cp313-macosx_10_12_x86_64.whl (4.9MiB)
ast_grep_py-0.42.1-cp313-cp313-macosx_11_0_arm64.whl (5.1MiB)
ast_grep_py-0.42.1-cp313-cp313-manylinux_2_28_aarch64.whl (4.9MiB)
ast_grep_py-0.42.1-cp313-cp313-manylinux_2_28_x86_64.whl (5.0MiB)
ast_grep_py-0.42.1-cp313-cp313-win32.whl (4.6MiB)
ast_grep_py-0.42.1-cp313-cp313-win_amd64.whl (4.8MiB)
ast_grep_py-0.42.1-cp314-cp314-macosx_10_12_x86_64.whl (4.9MiB)
ast_grep_py-0.42.1-cp314-cp314-macosx_11_0_arm64.whl (5.1MiB)
ast_grep_py-0.42.1-cp314-cp314-manylinux_2_28_aarch64.whl (4.9MiB)
ast_grep_py-0.42.1-cp314-cp314-manylinux_2_28_x86_64.whl (5.0MiB)
ast_grep_py-0.42.1-cp314-cp314-win32.whl (4.6MiB)
ast_grep_py-0.42.1-cp314-cp314-win_amd64.whl (4.8MiB)
ast_grep_py-0.42.1.tar.gz (145.4KiB)