35 releases (9 breaking)

new 0.22.3 May 13, 2024
0.21.4 May 6, 2024
0.20.2 Mar 27, 2024
0.16.0 Dec 29, 2023
0.13.2 Nov 20, 2023

#6 in #codemod

Download history 11/week @ 2024-01-28 119/week @ 2024-02-11 321/week @ 2024-02-18 199/week @ 2024-02-25 14/week @ 2024-03-03 201/week @ 2024-03-10 5/week @ 2024-03-17 422/week @ 2024-03-24 56/week @ 2024-03-31 429/week @ 2024-04-07 15/week @ 2024-04-14 314/week @ 2024-04-21 336/week @ 2024-04-28 243/week @ 2024-05-05

927 downloads per month

MIT license

385KB
11K 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–19MB
~250K SLoC