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.1.tar.gz (148.8 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.1-cp314-cp314-win_amd64.whl (5.0 MB view details)

Uploaded CPython 3.14Windows x86-64

ast_grep_py-0.42.1-cp314-cp314-win32.whl (4.9 MB view details)

Uploaded CPython 3.14Windows x86

ast_grep_py-0.42.1-cp314-cp314-manylinux_2_28_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

ast_grep_py-0.42.1-cp314-cp314-manylinux_2_28_aarch64.whl (5.1 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

ast_grep_py-0.42.1-cp314-cp314-macosx_11_0_arm64.whl (5.3 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

ast_grep_py-0.42.1-cp314-cp314-macosx_10_12_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

ast_grep_py-0.42.1-cp313-cp313-win_amd64.whl (5.0 MB view details)

Uploaded CPython 3.13Windows x86-64

ast_grep_py-0.42.1-cp313-cp313-win32.whl (4.9 MB view details)

Uploaded CPython 3.13Windows x86

ast_grep_py-0.42.1-cp313-cp313-manylinux_2_28_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

ast_grep_py-0.42.1-cp313-cp313-manylinux_2_28_aarch64.whl (5.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

ast_grep_py-0.42.1-cp313-cp313-macosx_11_0_arm64.whl (5.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

ast_grep_py-0.42.1-cp313-cp313-macosx_10_12_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

ast_grep_py-0.42.1-cp312-cp312-win_amd64.whl (5.0 MB view details)

Uploaded CPython 3.12Windows x86-64

ast_grep_py-0.42.1-cp312-cp312-win32.whl (4.9 MB view details)

Uploaded CPython 3.12Windows x86

ast_grep_py-0.42.1-cp312-cp312-manylinux_2_28_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

ast_grep_py-0.42.1-cp312-cp312-manylinux_2_28_aarch64.whl (5.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

ast_grep_py-0.42.1-cp312-cp312-macosx_11_0_arm64.whl (5.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

ast_grep_py-0.42.1-cp312-cp312-macosx_10_12_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

ast_grep_py-0.42.1-cp311-cp311-win_amd64.whl (5.0 MB view details)

Uploaded CPython 3.11Windows x86-64

ast_grep_py-0.42.1-cp311-cp311-win32.whl (4.9 MB view details)

Uploaded CPython 3.11Windows x86

ast_grep_py-0.42.1-cp311-cp311-manylinux_2_28_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

ast_grep_py-0.42.1-cp311-cp311-manylinux_2_28_aarch64.whl (5.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

ast_grep_py-0.42.1-cp311-cp311-macosx_11_0_arm64.whl (5.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

ast_grep_py-0.42.1-cp311-cp311-macosx_10_12_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

ast_grep_py-0.42.1-cp310-cp310-win_amd64.whl (5.0 MB view details)

Uploaded CPython 3.10Windows x86-64

ast_grep_py-0.42.1-cp310-cp310-win32.whl (4.9 MB view details)

Uploaded CPython 3.10Windows x86

ast_grep_py-0.42.1-cp310-cp310-manylinux_2_28_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

ast_grep_py-0.42.1-cp310-cp310-manylinux_2_28_aarch64.whl (5.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

File details

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

File metadata

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

File hashes

Hashes for ast_grep_py-0.42.1.tar.gz
Algorithm Hash digest
SHA256 8a5edf393a4879511c5a4012b058e4309ae85bd78181c7a3cbd59df0dbd12e12
MD5 9325718be8ed7430837794281dc174e9
BLAKE2b-256 47890f394db4e52f6109688294961cbc3753f29f5e310914133efc308709531b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 ba06299a780e6cb3442fbcc673479738df867d0ca91ccb4556db020769b8e536
MD5 cb26dd46030186b957ede3f97fbb1274
BLAKE2b-256 f42c010f57547595a5b7f1771497da9f43675f0f2cd56fb2fedb8e40a689ed2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 1aac1bd917d14c29c093ae68e8b4f2b0984986571ebd9721185e41b63150c0bb
MD5 c2e743b20e282c54170628482adc029a
BLAKE2b-256 c72c033e099c4981b3a764df9ad5ecb21a29a25776badd414c47cbace2a13971

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 17f09feae710fcfe98d97c5e5ece416c7d1884db5daeb3b8f9862f008f5b5b7c
MD5 acfd75a91f4073acbccc923c701e6105
BLAKE2b-256 0a2924305399142b14ae61dc5146cadb5e6c1d88cdeff83b7f28f49fbfc147bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 954da8bf4779daed5f1f3fac097bd17cfd1b794102cc235e92e64ed3c8c0bdf5
MD5 ff93e6480e79367aba9d3d73f94076df
BLAKE2b-256 6e43033d780de522e79f9b26cb1f888dd365088406762104f348f8da85a2192c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 094d88cffe0daa65a940cea9e14038aa1563145fe2777d477d9589a9a7b75d1b
MD5 c7e8112e6fe41b2830f78fe696d8eb2d
BLAKE2b-256 235bedeba2baaabc4a9c10d626aa84ae863b0c8127698dfe1d94255dc516213b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 246c60d9b452d199585fb37d6d7c2455c002bb1f8d585cd8608ce658c4d09157
MD5 d55f75ae0a13128c4d4e729c802ca79c
BLAKE2b-256 a28cfb1d2cf32fca0e229fc330f37d32e5b768a061ac6c98bca6f17cce92684c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b1f6927baf4e6ed48cdc5a6d68670c9f5e0e83c4cae110b764ca46a5278cd37a
MD5 62cf46a2706095377683750bcdfad846
BLAKE2b-256 887dbd68fe6e97131a07b48b8f8bedf436e4e097e348ec1de3d1ac1fc6a37c36

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 1d72c5f26eb239493354b76698489f7ed2e6be4878cc983ac666ef15c89475a3
MD5 33ec238d7519a4e56b141c510faca2b8
BLAKE2b-256 fc0f02e997f0e91ff14425760924a3d738a31eb1d6f5613b384700d066d388e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 022c1ff2de8b7b9309479eb468b6e9f3a76e975a0fe3f6ad0f5d81a9010bd7ec
MD5 bf471955626bb782e704ea367bd12a44
BLAKE2b-256 6e350ad7c7887a2902360b2772bc149525d79a3d5d94bf93b00523f1a669bd86

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4c3ab2f7e4fdd68fbe7ece820f900e4caff1e2174be98bcfc2f739ba90eb16a1
MD5 2a9dee45f4bd5c813eec17f236e36ea9
BLAKE2b-256 4e33da3c17ef8a04c610f97db613ca849ab764ead89dc7223514453856e428ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 463d7466655024eacc86d3b08dcbd4124061dfb8d26652be0e824a9b4e1c9fff
MD5 670e01659ddf65371bbcc22cd4e57264
BLAKE2b-256 f2ad82b27a081098f3e848c4b89404b05ac2fbc5b217490fd155162ba0e96164

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e2aca388253afa8d31129bc1d8861a9be330bd2425ff8cc696153d497107c13f
MD5 4a165890d486aa97c30e021291ca48f3
BLAKE2b-256 f85961365cf54a523e87cbeac4c8936f7afcf2302659b5854f9b1ac71b0e005a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 29d972b1e056c766559eca2bceb25d8eb559857c62520ad7d7f2115b9b91efc0
MD5 f9b6bea1436bc94afcd0f55fa4671370
BLAKE2b-256 466f91f2f1389666e9430df2ed2f5a66e0102e28c2e4ee4414ecc19d6d34c30a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 1b3e83e64c09c63651a863808a48bdbcf46a238717e1d7e3670739ac7fdea98c
MD5 82126191d560a0364039b7ce390d5bcc
BLAKE2b-256 8a71bf3ca0f518a3be9ee2b935d9f1cfd67fc32079f38a9b62ff4823dad5f2ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bf24d21d47ffb9735c7f9def2ee8ef9d69ec5ef55d8b0a4b5340cc0dd1fcca2d
MD5 5da71fd60b311b5d50a711ecc077c79a
BLAKE2b-256 ec9f4ad6dfce395103c5454199d18d43d63593edd548c5554b7cf4f38f56af76

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3603f9a785ef45cba0b5d146bf45cc5a1aafcc232064c367bc96829775932401
MD5 8b4e59ea72ee8667efc808da8a172a7a
BLAKE2b-256 baf01192d25cda0642e7204b666496453ed1255a86c86c5cac369d1dfdf660e4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 955928766ec3f1a772765acb55d367239a8a627ee1304d4e324fad17f70fdef4
MD5 d365047ccc02e0b64c7a0bfc6cc4dbf8
BLAKE2b-256 a2f55e8b8bf9297184470e90ac5ea05882d99d3f6ed91717dd5e4f6645153380

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4747e77bbf16df573377879b7385c50c2749b7a19c9156decd226025b77844e8
MD5 883cbe0e75f4dd89d6b1275e3d963558
BLAKE2b-256 25e054dc5b6dc2c31fe310ef6b4b91b5578aae95552bd2f047e17e33280d69d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6298ded6b7bb242341b2790b0101858527d38c54891d5c268697ae0d36bece9e
MD5 64e072f97554e241d4913af4f5ecf3de
BLAKE2b-256 47b421c962b8a47378079013638baa12d7589878c3d354de7634577070b27f41

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 9c1254d8ef148ae521dddf4cf85f0abed24ee98e3e6576612af452a55a6c8ab1
MD5 3a61b6c7639095df8955743b7aae376a
BLAKE2b-256 b332b97090cba9fda20ed9839a936a5c3e49c491cf49e0b96fb99bfe79d2a212

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a3812cf933396faf246aa02cfdce71d64192b3f8508193148cc19af3bf857318
MD5 1b0cc18f93c187f6432d5a268ed3e141
BLAKE2b-256 384a69c4660b9277e0ab87a28edcddd22fbcf9572caf7fab5803908da6152259

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 18dc95c6c17bc1368e7d00467b52ccd5c65a6ab9143a58c7fc62bec411f95afb
MD5 f3ddf99010a2882acd7df90c932543f8
BLAKE2b-256 e79c037db7f446d65713a7c959c737b248d5504a1977a8a565d5719116994019

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 47e3e0428fb745fe97c69dfcf0d6cc50fa30c73dc47a0df19e6848b98393b21b
MD5 37f3259eebc812076ed216062319c7f9
BLAKE2b-256 4b765541ae17ec5ae52d275d84e5da2541429f5b75bc6bcc64ec2fe52ca05188

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f20752e5a8db02024a37da7a0099ae66c50f6d6152fa42c98cd63bbcac3730bc
MD5 50363dfd1fcdfdd0a5bc7c8c8d2bc115
BLAKE2b-256 1b31363476594cafcc955481fe1b9f05de88676a78d14f0749d7b60fa59e778c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5a43dcabd307eef438b7b9bc6cbeb7518ad164caca65e268112a316d89a5f4ba
MD5 b08a88a26f2c7270b9327c5eb1c2c821
BLAKE2b-256 43293bf0f51bbfdc97e2a4d09c1d93511860f8a60db00b7cbf371af1231281a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 1a67ae6bdf41914faa496ae73bbd3a0073b84e59445289e9e58f206cd32657d7
MD5 0f001d5e7585fe5ebea655879f656808
BLAKE2b-256 76deb923a101eafa5b130c69d6891140dd700b8cf64192d909951f0874951122

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9694743e61c7c75b73c50ed757911d5d6e299016481daa0a29ba3624c0f40747
MD5 d1fc38bb8f0701238e6f849247f32505
BLAKE2b-256 d2a51b2417027f9aea7f7e6d44e369139d30e58b38359457e1575a35043db977

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.1-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4ef383f73cb77a6e5140ab3bb18d786194bce9b6a831db50944abb76572de946
MD5 f59ab72787f71f4a31e2b3fd350337e1
BLAKE2b-256 bbf093ee8f615f87c2515696ae5429bbb50a2eb918b657eeab0f3f6e14629394

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