Skip to main content

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.

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.45.0.tar.gz (155.3 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.45.0-cp314-cp314-win_amd64.whl (5.2 MB view details)

Uploaded CPython 3.14Windows x86-64

ast_grep_py-0.45.0-cp314-cp314-win32.whl (5.1 MB view details)

Uploaded CPython 3.14Windows x86

ast_grep_py-0.45.0-cp314-cp314-manylinux_2_28_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

ast_grep_py-0.45.0-cp314-cp314-manylinux_2_28_aarch64.whl (5.3 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

ast_grep_py-0.45.0-cp314-cp314-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

ast_grep_py-0.45.0-cp314-cp314-macosx_10_12_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

ast_grep_py-0.45.0-cp313-cp313-win_amd64.whl (5.2 MB view details)

Uploaded CPython 3.13Windows x86-64

ast_grep_py-0.45.0-cp313-cp313-win32.whl (5.1 MB view details)

Uploaded CPython 3.13Windows x86

ast_grep_py-0.45.0-cp313-cp313-manylinux_2_28_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

ast_grep_py-0.45.0-cp313-cp313-manylinux_2_28_aarch64.whl (5.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

ast_grep_py-0.45.0-cp313-cp313-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

ast_grep_py-0.45.0-cp313-cp313-macosx_10_12_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

ast_grep_py-0.45.0-cp312-cp312-win_amd64.whl (5.2 MB view details)

Uploaded CPython 3.12Windows x86-64

ast_grep_py-0.45.0-cp312-cp312-win32.whl (5.1 MB view details)

Uploaded CPython 3.12Windows x86

ast_grep_py-0.45.0-cp312-cp312-manylinux_2_28_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

ast_grep_py-0.45.0-cp312-cp312-manylinux_2_28_aarch64.whl (5.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

ast_grep_py-0.45.0-cp312-cp312-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

ast_grep_py-0.45.0-cp312-cp312-macosx_10_12_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

ast_grep_py-0.45.0-cp311-cp311-win_amd64.whl (5.2 MB view details)

Uploaded CPython 3.11Windows x86-64

ast_grep_py-0.45.0-cp311-cp311-win32.whl (5.1 MB view details)

Uploaded CPython 3.11Windows x86

ast_grep_py-0.45.0-cp311-cp311-manylinux_2_28_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

ast_grep_py-0.45.0-cp311-cp311-manylinux_2_28_aarch64.whl (5.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

ast_grep_py-0.45.0-cp311-cp311-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

ast_grep_py-0.45.0-cp311-cp311-macosx_10_12_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

ast_grep_py-0.45.0-cp310-cp310-win_amd64.whl (5.2 MB view details)

Uploaded CPython 3.10Windows x86-64

ast_grep_py-0.45.0-cp310-cp310-win32.whl (5.1 MB view details)

Uploaded CPython 3.10Windows x86

ast_grep_py-0.45.0-cp310-cp310-manylinux_2_28_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

ast_grep_py-0.45.0-cp310-cp310-manylinux_2_28_aarch64.whl (5.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

File details

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

File metadata

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

File hashes

Hashes for ast_grep_py-0.45.0.tar.gz
Algorithm Hash digest
SHA256 f96ec0175c296a04b2119ef4ff526aa14573db2a2dd35d24b22175390b2cbab9
MD5 ae9adc736238bd10373f7031921e5f3f
BLAKE2b-256 bf01675c994c5309f59f0a3a1a1f8e00beb5a40bc51c45aeffafb27b00d51743

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 7da97a59473612abfc82bf5cccb34701a58deffcce78a84502f94d11a1c95b83
MD5 83932b785eda148c31ab711adee0d9c0
BLAKE2b-256 62b15f849a687f5cdbcfc003d8ab9145c832256d741bbfd8903c70726ce91ed2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 bf9fa4645783671ec5c45c6036c35809af0404ebd80d10302dd704865a568461
MD5 f7b59153bda6301001e19a3265b1425d
BLAKE2b-256 c0401d59b4c020945415e84396fd801d7791fc1a649667ab124d81e5cac170dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a06b2690c66c254022601d4b80fbc2abfd39e93fc9d1d19ec99168735ddef4e1
MD5 195250a56c96e6ed6438065d0c4815af
BLAKE2b-256 d23f1e2ddf6193b4b40d46064014f8a85f3d16f2af19e8627a6009ce0075bdd6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b33911190198961e85921a50e3cd44ed0d60d301d26bb215e766795de6a824a8
MD5 59d01a2a78caab48bc35ece7ae4eec0a
BLAKE2b-256 b45f6f59e177ae332e3540019c8932ce10c42ddd95a0b0fc59c3b783ad001fce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 05ee8b9dfa8edbb8a119048d629027f859abe835bc0c814be8bf3b48bf332763
MD5 ed195309e0fd73885d1667cc53f20a75
BLAKE2b-256 efc9296478fcf9e9cfdfd61cae854fe30f8b5ec4dad90a9472ea19ca0c01ea59

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 784bbff0339eab053127cc254ccc04fb5522afd238ff01c2318802ad71522dba
MD5 8a2886b40d4a062e65983980cf331921
BLAKE2b-256 b5a6edcfc43c1cab3eebd3aee9003675173a8bfd8220f210e3bc322f970b0510

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 0df945e6c112b6d21860c0d074f780dad6a25c72cb1988c40eb66b7ed701272b
MD5 59b2e00eb70f192f14f5ceaf19270c9e
BLAKE2b-256 2b4f9673e3a7b7dcc12e1118e813a01a6b380ab6c7d05e81175fbcfc91465cde

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 d6f1cdadd015a9b0806403fcb44c921ae40bb615fe96ce8e28b0957b6139efb2
MD5 fabcd35f711151d0e2e055119ed1bae6
BLAKE2b-256 8cc002157953adc01798d73210bccb0f1102a9817137f23b74df3f0c725ff210

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dfda851a6be563a86518c93bb8be0bdc5a400ba262ea56fd2a2d9619c70b3f81
MD5 52928b1f383bac04ad4d897fac579992
BLAKE2b-256 7bb764d9b9ff8b950890a86ea94b8a669e73fd14318f958ec50a19a72ed85ed0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8237ee9049afc02cb40f090928db283a1f0843dee93c41f747ec978571e514c5
MD5 cd507cbf684e4a09292cc2b140f5efb8
BLAKE2b-256 8dd1d06a16325268bb66565497b4dc2f6b69670ba5ea5825826331e6cc724cc5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b04d1bd7f0144e9ab23a1eeab6b271288a59938d2864e3afeb4ed4dd74fddfe0
MD5 8fec496ae800221e3889d151a4c197e8
BLAKE2b-256 34beda3954eaf57e57451747b5f5581acdd96bc16d49d57d09748fdf895e3259

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4fdba29578f1b34d9186d6a446a2c687e683cb409df6bbf5d7d60b8dcdc7abee
MD5 a6be09699d5c40892701e5260f4ab461
BLAKE2b-256 f13015ac9b3eb165b7b4223beaf35814cb5791482360c08708bafcdf572c8a05

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0889a7513e389446078b5ed0a77a40b8cb60b3ad748070cee3f9a108ecd7a983
MD5 105d8639de685f5bbec05c99b8c4efd8
BLAKE2b-256 2f11d127a363b1f866db954d82fbd1a9dda2806b8b9e3be21d50ec51cda5e52e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 f604cb81d846e3970582050eed20f31dece172180225c84343d57265f592789b
MD5 c640de77ecf67e576cefb6335a898726
BLAKE2b-256 3a7c673cdc72c2ebf58b3bae3911ae9bd6f089879b351e34a8f512af857bac18

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4870321678e333dd40f66c3829352dda1da0c9e2f6d8804e66ab501fa313f4b6
MD5 d0d506c2c10b9135a9b325c0fed8e307
BLAKE2b-256 9d6a203f468127660750caf394db60be011314e1fac7b3aa95e5b6d054aae473

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 fb9b0f8523d4236eaef17a1ae4419b38dcde342e16c2bad6bc77bf3d8680e90e
MD5 c12b5508ef38560517d7eec36e4356f6
BLAKE2b-256 3e426868467ff99bf13a47a605aea6601d1ec23e8081d4e9b39fbe5f50d6d52f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e4b69cac2467e4828ea2762b73f64d3bb86b1112dbed3feeb05260bb84cf8f0b
MD5 84ff8ebc2539439b5f3e0c8dd0f712db
BLAKE2b-256 2ebccdb2cae73eea77cbc566326447a1e2d089630b03a430581a583896859ffa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7e944d33a3cd7e061bd1901e3192872f92432ea6b41c7545745f6654d8c0e8b9
MD5 308386a6120d08faa302b813facf5504
BLAKE2b-256 5f9ddb4d6285ca9faf4f7e9096e75de6902f891306038028735476bba3f60f49

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3718378bba35236c51a71a060db256161ce2347a7f6e6462096722a418d2d30c
MD5 a4365b6a6b61b6c9888405a6ea5c8be9
BLAKE2b-256 7c5b14f30e099e27e5ea2780ea13bc4ea268cbf31355eb42ae614f2dbd0e0cb7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 96382431a8ea93fa9b6da23e0ba465fbc8afaaf48c5c4d4788d0220a2755773d
MD5 4c6828138ccf48f4c9195a871df32473
BLAKE2b-256 2546b55c7b4dbe0deec3447694f14a4df0053bf85756e6dca774f8d9ade81ddd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 05d86d75d392b70872d86ee5c2702c935e42b3214162e47e4207bf4262e8375f
MD5 4bdd0f51b099dd74080e197c6211eddd
BLAKE2b-256 1493cc1c424f971c04ecaa9a0775c4f1f412fd29229fe0f3d0f3f81f0407c4c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 bd57fb1d735235d5e8abfd85e26b043231e3f48f3f5cd8b1f9a3ef795ba88350
MD5 988e393ba2b695df9d7e0d259727d5d0
BLAKE2b-256 c24495c3d416dfafe2482e56ec8230a1eae5e15eea5f12d83a8c855e0f531a55

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 68307d494e840cc41c1dbf8efc1997c865b54bb7f33bfbf5e2fd81e38b28deca
MD5 b065095242cee5d660c44ad43e561aad
BLAKE2b-256 0dee0ca9f0f434d0fcb47b5d492c00e8b7af43650aa624780865caebfc1bcde1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8021af6832f53da505f5b08c1ea7208e61c05b46ea4b36d79b2b552b1e4baa0f
MD5 daa6702065014eb0e08e02242d9f30f5
BLAKE2b-256 168e3ba3ce3e2af28ba09619291dc9c645154162e89a91529804566297339ab2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 22cc0fe09f48e0d22c0645974372a1dbedd9672925f44c5b8c17d0104377b13a
MD5 d21b05d6027637671fa500ef6ffe6f27
BLAKE2b-256 59664d04c9085b0468cfe214d28225adc22a11c4599804d01f290f55841ac624

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 598db702bb403f91687231e5f0073f6bfea75a7f34489f5297f388604986c72e
MD5 9bb42ef0b43fe55e563dbb30e5cec90c
BLAKE2b-256 eca7dc8712e9f43a951c9fc576b9debfbcbb5ed8a1e15b63480d90010632bc50

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3ebe300cc1a9b61ad077078584d9836bce73bbd72ffbd149e6f2a198c02cb97b
MD5 036e0da1cfe8a7eb31b7bae6dd6bb977
BLAKE2b-256 11ce96585e3f0f0d80b8461fc6732a4088e11dbfa2b34898630ab9dfc260ced3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.0-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 46d0164e84d86ff9b57e519d2e2bf3f01fb02d4edc64d8df8b78dff7281eac26
MD5 0c99492082105193cdf840832ef33e9b
BLAKE2b-256 13eb221868971a2e93480004b60522ae6b31d8b2003cf11b2ff2779c06ce1020

See more details on using hashes here.

Release history Release notifications | RSS feed

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