62 releases (17 breaking)

0.30.0 Nov 11, 2024
0.28.1 Oct 20, 2024
0.25.4 Jul 26, 2024
0.20.2 Mar 27, 2024
0.13.2 Nov 20, 2023

#288 in Programming languages

Download history 154/week @ 2024-07-29 470/week @ 2024-08-05 105/week @ 2024-08-12 101/week @ 2024-08-19 91/week @ 2024-08-26 257/week @ 2024-09-02 83/week @ 2024-09-09 150/week @ 2024-09-16 157/week @ 2024-09-23 179/week @ 2024-09-30 50/week @ 2024-10-07 206/week @ 2024-10-14 45/week @ 2024-10-21 136/week @ 2024-10-28 90/week @ 2024-11-04 136/week @ 2024-11-11

539 downloads per month

MIT license

450KB
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
~266K SLoC