65 releases (18 breaking)

new 0.31.1 Dec 8, 2024
0.30.1 Nov 26, 2024
0.25.4 Jul 26, 2024
0.20.2 Mar 27, 2024
0.13.2 Nov 20, 2023

#271 in Programming languages

Download history 135/week @ 2024-08-23 14/week @ 2024-08-30 324/week @ 2024-09-06 28/week @ 2024-09-13 263/week @ 2024-09-20 60/week @ 2024-09-27 188/week @ 2024-10-04 83/week @ 2024-10-11 173/week @ 2024-10-18 130/week @ 2024-10-25 78/week @ 2024-11-01 150/week @ 2024-11-08 29/week @ 2024-11-15 138/week @ 2024-11-22 138/week @ 2024-11-29 135/week @ 2024-12-06

444 downloads per month

MIT license

455KB
13K 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

~8–19MB
~268K SLoC