Skip to main content

Structural Search and Rewrite code at large scale using precise AST pattern.

Project description

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]

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.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ast_grep_py-0.42.0.tar.gz (147.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ast_grep_py-0.42.0-cp314-cp314-win_amd64.whl (4.9 MB view details)

Uploaded CPython 3.14Windows x86-64

ast_grep_py-0.42.0-cp314-cp314-win32.whl (4.7 MB view details)

Uploaded CPython 3.14Windows x86

ast_grep_py-0.42.0-cp314-cp314-manylinux_2_28_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

ast_grep_py-0.42.0-cp314-cp314-manylinux_2_28_aarch64.whl (5.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

ast_grep_py-0.42.0-cp314-cp314-macosx_11_0_arm64.whl (5.2 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

ast_grep_py-0.42.0-cp314-cp314-macosx_10_12_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

ast_grep_py-0.42.0-cp313-cp313-win_amd64.whl (4.9 MB view details)

Uploaded CPython 3.13Windows x86-64

ast_grep_py-0.42.0-cp313-cp313-win32.whl (4.7 MB view details)

Uploaded CPython 3.13Windows x86

ast_grep_py-0.42.0-cp313-cp313-manylinux_2_28_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

ast_grep_py-0.42.0-cp313-cp313-manylinux_2_28_aarch64.whl (5.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

ast_grep_py-0.42.0-cp313-cp313-macosx_11_0_arm64.whl (5.2 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

ast_grep_py-0.42.0-cp313-cp313-macosx_10_12_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

ast_grep_py-0.42.0-cp312-cp312-win_amd64.whl (4.9 MB view details)

Uploaded CPython 3.12Windows x86-64

ast_grep_py-0.42.0-cp312-cp312-win32.whl (4.7 MB view details)

Uploaded CPython 3.12Windows x86

ast_grep_py-0.42.0-cp312-cp312-manylinux_2_28_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

ast_grep_py-0.42.0-cp312-cp312-manylinux_2_28_aarch64.whl (5.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

ast_grep_py-0.42.0-cp312-cp312-macosx_11_0_arm64.whl (5.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

ast_grep_py-0.42.0-cp312-cp312-macosx_10_12_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

ast_grep_py-0.42.0-cp311-cp311-win_amd64.whl (4.9 MB view details)

Uploaded CPython 3.11Windows x86-64

ast_grep_py-0.42.0-cp311-cp311-win32.whl (4.7 MB view details)

Uploaded CPython 3.11Windows x86

ast_grep_py-0.42.0-cp311-cp311-manylinux_2_28_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

ast_grep_py-0.42.0-cp311-cp311-manylinux_2_28_aarch64.whl (5.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

ast_grep_py-0.42.0-cp311-cp311-macosx_11_0_arm64.whl (5.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

ast_grep_py-0.42.0-cp311-cp311-macosx_10_12_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

ast_grep_py-0.42.0-cp310-cp310-win_amd64.whl (4.9 MB view details)

Uploaded CPython 3.10Windows x86-64

ast_grep_py-0.42.0-cp310-cp310-win32.whl (4.7 MB view details)

Uploaded CPython 3.10Windows x86

ast_grep_py-0.42.0-cp310-cp310-manylinux_2_28_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

ast_grep_py-0.42.0-cp310-cp310-manylinux_2_28_aarch64.whl (5.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

File details

Details for the file ast_grep_py-0.42.0.tar.gz.

File metadata

  • Download URL: ast_grep_py-0.42.0.tar.gz
  • Upload date:
  • Size: 147.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.12.6

File hashes

Hashes for ast_grep_py-0.42.0.tar.gz
Algorithm Hash digest
SHA256 822ef35f5cb8bf22b9899ee0fa19e5f7ee4e329e923a89ef5852b4c28a5acad6
MD5 423c5eadd1a5563a4fa3f2049e250864
BLAKE2b-256 ae8022bdb1bb1949a09e1f5cec663d6e293115b2c200b5a4f1189a8977c3f457

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 e1eacbb33c9b4700a1b001c5b9b9f5edc4d63f85dc4584406652bca7478dcb27
MD5 2ad440856513efebab90395c20396b6b
BLAKE2b-256 5bda761cf626ddd67a8f75e1b97852847dc0bcfafa484b8126bcdf0c468efff2

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp314-cp314-win32.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 ec2756c8869b30b82b104ef99ecd26949b8e94f28f1dbbc6d1351fb0b5ca43a9
MD5 7c171610a95f9a4d097e4fdd401ab484
BLAKE2b-256 1f4c3adace120b29a55fc88be06458be085bb48859e95923303d449f2d59cbb7

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 967415d775b0bef1827ff1e70eb95cb60754d12a5dffea3e4e8daf2bd99ad7fe
MD5 429f1ca8e5445f4ef08b735842d03af9
BLAKE2b-256 53846bb2e1c3c966a4f5664033e80a2bcaf4d9059f55f281bfc2d433227251ad

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp314-cp314-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 23b2ef30c314cf1b6d5de0c9ad91c9074f52b6204e7a524eedc624f4951c74bc
MD5 d69e1b1cffa3fc90af45b6a1fe8258eb
BLAKE2b-256 159aece2ff63dafde3f0bc891e52fa606c1336807696b46163f55fb25c9168d9

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 985676ff57bc292674551a460a7c81020755beae04f4710682fbff62813e38b0
MD5 59a5e36808fa849d45659862bf218991
BLAKE2b-256 ceb0e7adfc731b1894b040cce6c5633ae16d765120a693ffd831a5e5a02e991a

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp314-cp314-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c479e6a7e856b1b804178cdfcf0fc5ebc3c23aaf1920ec08d675dc5a6539d43a
MD5 52917011c4a3178a78ffcfc8f59e1a4c
BLAKE2b-256 fecb97309cd6264602059fe003e76ac186935aa4f5808b8ae21b933594633891

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 a6c76e9c1b11508a197398d597d2b7ad9b18a044fb685b9d7edd0cee61acb991
MD5 4da5a976f1d2dd3952768d0e325ecd40
BLAKE2b-256 96a86bcda83dc30aa48e00f0edca149069da0214897a12f7e8d87c9cff54993f

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp313-cp313-win32.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 70d499ab3b12dc687e0c72345ff55e597f04399a13cc68449ae76d31779dfac8
MD5 7b2b3158432c80183b00687c1341fda7
BLAKE2b-256 7361ce6b0ff2de0be635953aef84f162d97e89a63b8f7b94f28c9e7ad92a911d

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1865477042608ba839573a3c15ca31b1331d105c7f2879384d5105c005c72c7b
MD5 de534684b7f84d36082095d1b040b346
BLAKE2b-256 b34e6f3cdbadc5b32fca0585feb1a9d5075ad175658b833a103491a82152fe9c

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ba787ff4637a75d8d57e596317e01374f2a2db12c1f90508ae4d1bbdda96b7bc
MD5 5d86051a67b1d8964466268fd17a63ed
BLAKE2b-256 39cb8a102c1fa2f6a28f142c7b97446f9e15ca51d4c6d964724ab705aa5e8cc4

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8a1a3d79bfff8779b1bcdf30de5266a8f4ba1f3cd7d82257cbc26fa45fef3af0
MD5 dd3442ddf605072cca13d6d1b847e3f2
BLAKE2b-256 54c6ae674b189d7751133a0fe3bd7a3c5061c411c60af9211f8776f231401592

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 294841afb21724762adea7fd7f8536a3975b1ba70b1e2c1003cc438609ff64ed
MD5 bb68b03d8ec297e3012c8b4afee937fa
BLAKE2b-256 0cb74b896ffdac221cdf96fb87b2749fdfcd3b5c724ed76509318ec8cbc3899b

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 10526ac880d30f7fe43adc5adb65c2a3892f94e61b184b1a5c8d7b1d49233cfb
MD5 4778b77dfcb704f5515a2c789c38bc8f
BLAKE2b-256 7a41f445376604e85d72dbf968685cd75b01bd803254776c7a0e0319f3873033

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp312-cp312-win32.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 1d5fadf59d1c7cc2410922cf7a53f9fb36f739423e11fa9ff88308b7b976bfb8
MD5 6986e91f4ae85d518e7f4c57a5382d61
BLAKE2b-256 419097d771a47b4ef90d932ec6e4370ff28d91f989696448552a3745516a8b87

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 16c4bb5c860a04321c753dfb03c5ef8fad9e578e29bae0c8479fc8d97670f25d
MD5 bae7261603ebf951524b332937020b53
BLAKE2b-256 e1b4f061d013f76b7fd281eae38394c3e057192334e1c61bdd87e9c572a9fb93

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c586e19fcbf012ad3d2bc19cd0834c74a2d0f9da86cec6ca370baabfadb12e3f
MD5 c3021f785e0bae64bfe4e1078f033b94
BLAKE2b-256 c380b9d3af2a4e22ae46f039a2df43d000b561ec78c146038a90741fedb7b086

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5658bb89b5b2daf07a864103e34c910bef30f1b4842232ad24b2b41c1a5d8bd0
MD5 f92e4bc0a2124b1d60a811d183fa6bb9
BLAKE2b-256 50c8d3a4e4eb3e8cb96da04d488d00fe46505d3c7c3668b6638b6e7fa4234f2e

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ecf474eef119fca58f4fd2190d6534f9c678a68fb7e0ed90564d07e7e7b408a0
MD5 8bf177d5cfebd393acc2b0244c4728bf
BLAKE2b-256 cf75ca70a1a724100a28391e03c0bf62b1b5fe9d1d4c7aba669037091018d953

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 85ad0969e7a7fe4c13ec16779af3eab3653893299bd36e75e2c4482edb99d1f3
MD5 0745b872371e8598703ded86c5353002
BLAKE2b-256 8d3ca4a2a5e8c4222f2916bbe416b03bc052c9f9c82ee772161d066d11b4226b

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp311-cp311-win32.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 0b93de2884ae0f998fd05add83ee7224097fd7db546a694b10483c8d0b4549fb
MD5 a519edf4a65cc18c8bd5a54b91661248
BLAKE2b-256 1175d33d2e61e536599d928d0ca97768058f7b71b1b4f0b4f421756915ec0534

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a61c7488508c6c3636db1a744cfcc8ad882810ed599c10d3f1b8222eb9befb29
MD5 c9ad386ef3641e13d66c629306117716
BLAKE2b-256 c24cb11f7fe2be488194ed22ff019c33f4fbc77356e42aab6032779a319aba75

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 bd89e5be2b59d45368d5d8fa878c008ff0965dcfe670e60cb9bc6d87fa0e8c7d
MD5 930a77fff27efd2ad0d6c75d9ebd9429
BLAKE2b-256 e04a595e7645a546a03173179e50e505e470fefd6bf541dca195a09024433e8d

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 adb5e1bcf1cd7fc59b93551ed7662eb62a6047c1c0e0a26025f8472312651e11
MD5 897572f88d6e31c8585657b5eef1e18e
BLAKE2b-256 713a19dd4ed4741687311e9d83d99472e49ef5bddbd7321c77fcb09fc7468e52

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9d8ae0d5e87759135b510698c747b1874126c3412a26cc16b5d2567006fa5ba8
MD5 a05f8c3ef7ec1d95b374573053455a00
BLAKE2b-256 d2d59fd10d8595c8fe673c4db7fee82f384f4a41b2e02bb012a4486f05866ffc

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8431462e511d57be843749dd19d2d6b374f2137668bc82d64d78711b23c6e78c
MD5 65160125c3a5e6bfb567d54b598fc13b
BLAKE2b-256 5c8b9316714a58410c6edd6daed4422e1c46caba3f5811591e06c637943c0936

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp310-cp310-win32.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 6634affb866908dd130da6bbd12ccc910add60d7399a9e26777cb23e67e2ba85
MD5 476dfe8d98963fd1b5b5bcf7494a89ff
BLAKE2b-256 65067367d29a1f787abefb96163a8b11eff9c3fef73b100c448aa5f956a58020

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 918ca8a9d5fde778730470bd845f821373ca720a6b0a21b9fe31c3e2296154b3
MD5 18e02fadde7bcc80d04dc857b79af05c
BLAKE2b-256 5c6c2ec422e77a43ede6a480744f1a62e892cef6056f5af292dc2d4cf9dcacb3

See more details on using hashes here.

File details

Details for the file ast_grep_py-0.42.0-cp310-cp310-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for ast_grep_py-0.42.0-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 81edbd2cf56bb46892ef01275d564d66921f553d5503dcf3fe47ac12781c8679
MD5 baf1a1a8e7ba485b444b60719eff8190
BLAKE2b-256 cc263b51236aa1bc993ba7b5bfa715f92672c90326786206ffdcaba869399f30

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page