39 releases (10 breaking)

new 0.23.0 Jun 11, 2024
0.22.4 May 27, 2024
0.20.2 Mar 27, 2024
0.16.0 Dec 29, 2023
0.13.2 Nov 20, 2023

#6 in #codemod

Download history 320/week @ 2024-02-22 34/week @ 2024-02-29 168/week @ 2024-03-07 41/week @ 2024-03-14 350/week @ 2024-03-21 115/week @ 2024-03-28 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 180/week @ 2024-06-06

662 downloads per month

MIT license

405KB
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