47 releases (12 breaking)

new 0.25.4 Jul 26, 2024
0.24.1 Jun 26, 2024
0.20.2 Mar 27, 2024
0.16.0 Dec 29, 2023
0.13.2 Nov 20, 2023

#6 in #codemod

Download history 293/week @ 2024-04-04 164/week @ 2024-04-11 117/week @ 2024-04-18 209/week @ 2024-04-25 521/week @ 2024-05-02 404/week @ 2024-05-09 25/week @ 2024-05-16 148/week @ 2024-05-23 299/week @ 2024-05-30 194/week @ 2024-06-06 38/week @ 2024-06-13 236/week @ 2024-06-20 184/week @ 2024-06-27 15/week @ 2024-07-04 240/week @ 2024-07-11 206/week @ 2024-07-18

679 downloads per month

MIT license

420KB
12K SLoC

ast-grep python binding

PyPI Website

ast-grep

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]

Build bindings

maturin develop

Run tests

pytest

All tests files are under tests directory.

License

This project is licensed under the MIT license.

Dependencies

~7–18MB
~248K SLoC