ast-grep python binding
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]
MacOS: Install patchelf and maturin
brew install patchelf
pip install maturin
Build bindings
maturin develop
Run tests
pytest
All tests files are under tests directory.
License
This project is licensed under the MIT license.
Metadata
Release files for ast-grep-py 0.45.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ast_grep_py-0.45.2.tar.gz | 163.7 kB | Details |
Built distributions (wheels)
Total release size: 144.7 MB
Release files / ast_grep_py-0.45.2.tar.gz
| Download URL | ast_grep_py-0.45.2.tar.gz |
|---|---|
| Size | 163.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5823432e46056cef976389911770648b0055fefc3ff3afd64db0e214bf1174dd
|
|
BLAKE2b-256 checksum How to use checksums |
f5917aba76522c9dcad2089b3b20e5489de7d35918f45bf202c0d38223531be0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp314-cp314-win_amd64.whl
| Download URL | ast_grep_py-0.45.2-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 5.0 MB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
21eaeaa5e39c387082a89456ab1db67eea7db4af8a1a1eabb5d3e0c20ebc8b0f
|
|
BLAKE2b-256 checksum How to use checksums |
308cd918f56d28c045940efb0d5002a4cef46554e9965b2e1719565ce5ed4794
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp314-cp314-win32.whl
| Download URL | ast_grep_py-0.45.2-cp314-cp314-win32.whl |
|---|---|
| Size | 4.9 MB |
| Tags | CPython 3.14 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
585b456f07efcbc6c171576e54a0e50cd2f1fcc22fc683220da63578ac969775
|
|
BLAKE2b-256 checksum How to use checksums |
d04fb8577384c80f08994231dc5159aa72f3833d81620c09ee372ef77b7d0041
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp314-cp314-manylinux_2_28_x86_64.whl
| Download URL | ast_grep_py-0.45.2-cp314-cp314-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 5.3 MB |
| Tags | CPython 3.14 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
b42d758b93a039aa1cfa3a4ba20e5fe8c4dcc9fabe284bec874a47af4e4b38eb
|
|
BLAKE2b-256 checksum How to use checksums |
4597b2fb0f5c7a3190e9297e9a474a7faacc27845c18fc49f9a6d0e08e5a4ff3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp314-cp314-manylinux_2_28_aarch64.whl
| Download URL | ast_grep_py-0.45.2-cp314-cp314-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 5.2 MB |
| Tags | CPython 3.14 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
c7c01a1e0bff94de4551cc1b976ac54e61bcbeba6ebb955b183737e72974f98a
|
|
BLAKE2b-256 checksum How to use checksums |
43abd32573216ad424f4527b2acd4a318a24b6e4e2d1166b611b2c15bb98f2a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | ast_grep_py-0.45.2-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 5.4 MB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
bef584ba8b8940ca8eb05fc5d23cdad63391a7d793606b741ac5f886bb44ad87
|
|
BLAKE2b-256 checksum How to use checksums |
47f00442c6c70886554c2d776150eabc973113294625c05e7302ba57c86c8e58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp314-cp314-macosx_10_12_x86_64.whl
| Download URL | ast_grep_py-0.45.2-cp314-cp314-macosx_10_12_x86_64.whl |
|---|---|
| Size | 5.2 MB |
| Tags | CPython 3.14 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
135ba550e0d6971ee976f9a69a37123726107c9f6fa8a9d1a9a853afa6987d56
|
|
BLAKE2b-256 checksum How to use checksums |
ab6694e7bcae54c246cd82ff47d961dc4661ebfb9d39f21ef43af93f14732f74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp313-cp313-win_amd64.whl
| Download URL | ast_grep_py-0.45.2-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 5.0 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
e3221e3f0a9aa45a8b063468d24078d5330a91b437d5822d78f15a797f78820c
|
|
BLAKE2b-256 checksum How to use checksums |
08a954dce44d325888c3f9c82ae80076524cede7ad2afe4430f8d07d7749fb96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp313-cp313-win32.whl
| Download URL | ast_grep_py-0.45.2-cp313-cp313-win32.whl |
|---|---|
| Size | 4.9 MB |
| Tags | CPython 3.13 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
466689af39637eb971957067ae241afb53806d071cdd5f6a741243f146e191a8
|
|
BLAKE2b-256 checksum How to use checksums |
5619f75b86e2b4cecddddb8a0e35028ce244b8f5d579cf8a6333700368c5c7ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp313-cp313-manylinux_2_28_x86_64.whl
| Download URL | ast_grep_py-0.45.2-cp313-cp313-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 5.3 MB |
| Tags | CPython 3.13 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
32912b24050e6a35594456032da1bb303ed7b0cbc6a3415e32b52a24a2dca649
|
|
BLAKE2b-256 checksum How to use checksums |
23c56a239ca666e4c286e88b72c4bfe63183ae24d026683156ad1117bab1b17a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp313-cp313-manylinux_2_28_aarch64.whl
| Download URL | ast_grep_py-0.45.2-cp313-cp313-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 5.2 MB |
| Tags | CPython 3.13 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
97a9683a89fc0d00f6fe5591d697846c812b3f051af094673edf2267e898551b
|
|
BLAKE2b-256 checksum How to use checksums |
124999e89b9caffd914ad004ced77e3ccaeb271e2d70a08ee48bd727fd6e5edb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | ast_grep_py-0.45.2-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 5.4 MB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ecae056eac857c87c6ec568ca45a7cc9682a9c91fb51d90cfc8d6d2ebc2e878a
|
|
BLAKE2b-256 checksum How to use checksums |
dc74758d3213d91e920c386b0da8001ff56ad33923086fe9553fb390b4e76ad7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp313-cp313-macosx_10_12_x86_64.whl
| Download URL | ast_grep_py-0.45.2-cp313-cp313-macosx_10_12_x86_64.whl |
|---|---|
| Size | 5.2 MB |
| Tags | CPython 3.13 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
fdd65d74eab7016ba433a29f97a991da67cad20c7d73a3b90f06070d0054e8f2
|
|
BLAKE2b-256 checksum How to use checksums |
25052e93567b1b9a03c5aa077c6308c9d1a9ab015a69df065b2ed8b92a66b3c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp312-cp312-win_amd64.whl
| Download URL | ast_grep_py-0.45.2-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 5.0 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
7cfd8319614522ee5ef26fc72eeafe4b61a89797c48dfa5c5afb4e2efc71ad66
|
|
BLAKE2b-256 checksum How to use checksums |
cdd4880cfdf663c30529c7445bf8087e8523acc54ad792fe09c38f27040249a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp312-cp312-win32.whl
| Download URL | ast_grep_py-0.45.2-cp312-cp312-win32.whl |
|---|---|
| Size | 4.9 MB |
| Tags | CPython 3.12 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
e570c7ba5f1bc97ae8a8986d426abad2655c819e6461b6a51de0792a26d60beb
|
|
BLAKE2b-256 checksum How to use checksums |
744b5c49b2be03370973c876158ce162c4e7ec32557780149cda84a3e0d0c0b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp312-cp312-manylinux_2_28_x86_64.whl
| Download URL | ast_grep_py-0.45.2-cp312-cp312-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 5.3 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
4c382ff5b59a135ee4b230585178818b0350a64c0655bea5bf31ba65e0dea458
|
|
BLAKE2b-256 checksum How to use checksums |
df6bc3d5139e68d593b14e682fd19a55e67f8b4fa685bc3f228f3ca3500d0daa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp312-cp312-manylinux_2_28_aarch64.whl
| Download URL | ast_grep_py-0.45.2-cp312-cp312-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 5.2 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
f9eaad08e29d13b6539f8fc44f75f11a771d94d982b1308e193bec0fb2816b2d
|
|
BLAKE2b-256 checksum How to use checksums |
d331e586165987ed49690d5fd85f0401fbccd4f04608d0b22d09a11d194bd7e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | ast_grep_py-0.45.2-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 5.4 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c78c3be1dd7a82517f19a323e2afdf1d1109c6f9b1da54e976e2cc7244a7eb75
|
|
BLAKE2b-256 checksum How to use checksums |
f676ce1874be477c991b49b7d3b07344b3facfe8137c880d84db53512fc77ed2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp312-cp312-macosx_10_12_x86_64.whl
| Download URL | ast_grep_py-0.45.2-cp312-cp312-macosx_10_12_x86_64.whl |
|---|---|
| Size | 5.2 MB |
| Tags | CPython 3.12 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
eb648964effd586a0f77f63347ee453e9aba6398543acdd473c959dd747e90a3
|
|
BLAKE2b-256 checksum How to use checksums |
c871edef05154dd3796a09048d9a48e32be60a4be02979228b48a3baf1d23da4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp311-cp311-win_amd64.whl
| Download URL | ast_grep_py-0.45.2-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
94052fa9da932214223a55f2b23741c8993f6355f786c8e91f72a936c0770dbe
|
|
BLAKE2b-256 checksum How to use checksums |
cba55f5a803119b2cb607b98757c575a5186fa7b21c616579a2713512e9b3451
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp311-cp311-win32.whl
| Download URL | ast_grep_py-0.45.2-cp311-cp311-win32.whl |
|---|---|
| Size | 4.9 MB |
| Tags | CPython 3.11 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
f53f2f99bd0de5f23da7c82313e365d1c75a450230a9099865cf93f68059e138
|
|
BLAKE2b-256 checksum How to use checksums |
cfb3e0283a20736aedc5003de934f0d13e0cd2a3ec6c84b38ff3d4dfcc24ea93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp311-cp311-manylinux_2_28_x86_64.whl
| Download URL | ast_grep_py-0.45.2-cp311-cp311-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 5.3 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
d574a2f32e6afc8a786413f390ec86c64e3a27ea6842a59e37e6eb7d4a0a2599
|
|
BLAKE2b-256 checksum How to use checksums |
deb5c889d81dab1d4a6f18112879f75de97c7638cde8690c9a184080d804d178
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp311-cp311-manylinux_2_28_aarch64.whl
| Download URL | ast_grep_py-0.45.2-cp311-cp311-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 5.2 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
4ae518735d75d358d6f4ed24d621ba23c4c26ce708664b842bfe9164a3976f4f
|
|
BLAKE2b-256 checksum How to use checksums |
20ec3841de16274236348b62c6083a713d4684e0a085f51b48269439519db88f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | ast_grep_py-0.45.2-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 5.4 MB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
0e72d270cfc5e1c87e93011c28b072938c6d4a726adc054e47c2dea3d3098218
|
|
BLAKE2b-256 checksum How to use checksums |
87947409208c7ef564499d7464c959b39bfb564d82b8b38928ee0a7674dbbb8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp311-cp311-macosx_10_12_x86_64.whl
| Download URL | ast_grep_py-0.45.2-cp311-cp311-macosx_10_12_x86_64.whl |
|---|---|
| Size | 5.2 MB |
| Tags | CPython 3.11 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
ad06adfa32f5f571be8cebd43f209fcbab27b55e24e9cb93765a05a01540f7b0
|
|
BLAKE2b-256 checksum How to use checksums |
474cd8cda6550aea722a623759b4c6a77cd8f80a760a8e5f1aaf2497e65b3019
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp310-cp310-win_amd64.whl
| Download URL | ast_grep_py-0.45.2-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
3ce509ace8ffbac4315f74162650c8cdb46b00eba998c105e3070aa90598bcf4
|
|
BLAKE2b-256 checksum How to use checksums |
3c74023c135c0c313436bb83912a2f81f98204d1c5769b6f21b0761d881c44bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp310-cp310-win32.whl
| Download URL | ast_grep_py-0.45.2-cp310-cp310-win32.whl |
|---|---|
| Size | 4.9 MB |
| Tags | CPython 3.10 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
df33b05f9ff9390f832606bea07c0d522811b870f357bf25ff6e335ddfc9411e
|
|
BLAKE2b-256 checksum How to use checksums |
fc4edef416e9151932c18db9bb7d196529402f899cd5710e51f6eec02a120e07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp310-cp310-manylinux_2_28_x86_64.whl
| Download URL | ast_grep_py-0.45.2-cp310-cp310-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 5.3 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
3ecf2d6f8d30fcccca60290d7da3811b2e83b7b4d224c35138c84cc88eeec04d
|
|
BLAKE2b-256 checksum How to use checksums |
5f0e02761d9f977af584c991fb5208174351275f79f6886570aac33380988ef3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|
Release files / ast_grep_py-0.45.2-cp310-cp310-manylinux_2_28_aarch64.whl
| Download URL | ast_grep_py-0.45.2-cp310-cp310-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 5.2 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
ac6477f9a9a8e3940bbec1db74099f80d5e30a2872fae58fe517c4610b6d1f8c
|
|
BLAKE2b-256 checksum How to use checksums |
ebc3ce94bd18c916fcc96ccbbdf4e6f7e8ef8dfc1a463de71c098c61260464e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.14.1
|