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

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14Windows x86

ast_grep_py-0.44.1-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.44.1-cp314-cp314-manylinux_2_28_aarch64.whl (5.3 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

ast_grep_py-0.44.1-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.44.1-cp313-cp313-win_amd64.whl (5.2 MB view details)

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

ast_grep_py-0.44.1-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.44.1-cp313-cp313-manylinux_2_28_aarch64.whl (5.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

ast_grep_py-0.44.1-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.44.1-cp312-cp312-win_amd64.whl (5.2 MB view details)

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

ast_grep_py-0.44.1-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.44.1-cp312-cp312-manylinux_2_28_aarch64.whl (5.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

ast_grep_py-0.44.1-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.44.1-cp311-cp311-win_amd64.whl (5.2 MB view details)

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

ast_grep_py-0.44.1-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.44.1-cp311-cp311-manylinux_2_28_aarch64.whl (5.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

ast_grep_py-0.44.1-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.44.1-cp310-cp310-win_amd64.whl (5.2 MB view details)

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

ast_grep_py-0.44.1-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.44.1-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.44.1.tar.gz.

File metadata

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

File hashes

Hashes for ast_grep_py-0.44.1.tar.gz
Algorithm Hash digest
SHA256 5b1d3c26a02663a3ffb12f5060cd3338299625be820cbf85d8f78d192827fc3c
MD5 b6c98cc097cf68f9e9fbf641edaaa8fc
BLAKE2b-256 fa6c65a11f4d8b77a84671b2750e2327336713cff8d99e9ed820e7cd9f28c3d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 710c583b1e2de28e11bbc0faa3f72af7c6ee60e01dd09a408955950cd4d07c18
MD5 ea4ec457bd2e51277720915b912d51c0
BLAKE2b-256 cc8492508f5ae39b35d49fce0578de3cecc0501c73e80b97e70feeec967949cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 e75b8808436f6932211f569bad06672173f37294dabf5224b09132a7b234383a
MD5 41b624d3c815cc88e2ec328cd0678a07
BLAKE2b-256 c573e668265128c9f8236cdb3816e17888d5585e673a3ecc713f0e9759006d29

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 526506b9995b266ece7e7568014f43ef162ba0fb10ce6ea54cb40e96ef986a6c
MD5 1fc09085a20b45e600fd017e044ba81e
BLAKE2b-256 59b0767b9ddca4a24d27ecd660d45b42b09b6c8be3393b4017424e87dadd64b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d8b75b33c806b10d973eeb78bd162fc3de8df335441d3864a0991d689510a9c6
MD5 05819a2905fa9fc42ef2ed99d3e78493
BLAKE2b-256 a19b3cc9fab1bac71dff74622fec31205cae3890e1778ef55d961eaafc4691c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 91c8db33e913535faa5252f0f8f98c1e4451399d2eb76c0d977d504d0df98d04
MD5 8d03d85f407dcf702bd48e17762b1d27
BLAKE2b-256 062f8ad57805be6ba1259a569300335f02af0ea158ef90905dc89ed844527859

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 799ba55817b9e8c12df1112fc37c4ed3de46768eeccc55407ffb55eed41f2dc1
MD5 327f04afbaa56e288986d17fe54913e5
BLAKE2b-256 fbe073f626bbe5881edb775086d2393e673d097658f001cd1e096ed006eee4b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e4a693ac6862dbeacefb0630cc21849c630e4c67a8cbd8282901c88beaa114a5
MD5 bf9d90cba1c0507b715382a4ec67affa
BLAKE2b-256 e9e444d94234003fe5cc648c466edf59079f4c872e4631d2ce1ded407904cd2b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 db2304ae600b97b88015e69845a5811ad596d3b7098ed7d00760827d87936dd1
MD5 f04e46c6207b20559e5cb364474f7d5a
BLAKE2b-256 ffb5877e51a4782174aa588e1c3ad5cbca457526410945477452191effe2cd7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 923ad3fbb082ce64736212053a98f2b99f5bf6b8b2d1b3c75adb8063e2641e31
MD5 7b5aaea3c7242f5bb07a0e516a81f134
BLAKE2b-256 9bfcf685ca6d90ac38f34d98a201ef5d4a43c1bfac5cf7143c9029287c6dcbd8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 290f0b93c409702f9c0604d00cc7d219cff602869cfe457b6ffe0ab88da8958b
MD5 ab29f7d96662ef0a5f4607e5335e7a16
BLAKE2b-256 b319d6c54898e504051a49d5b585c464a0278e6b74f020d9ed2124f025c8525a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 695cddc9b3d283add44c23efae5126241a31a968397885c68c751ecf76a4ea24
MD5 e4730a9464235340418cfc74582002d9
BLAKE2b-256 fc8976f32dac871a2c0b405d2a81520d6d32d3aca8a6c0c60562d04ef95fed3b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 be0c7dca8f2db70a7047a232f7f14a6bedc835658effc19225032e57479f4e25
MD5 e844384233fce6e22acf633e67680b04
BLAKE2b-256 423f4fcfc93f74e11db4c9843674b235808104ec9a214ed970ea53d374c541b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 667670a8b74edd72c6def1882129f3855a53829b2adfd8fa1750d2cf61e50049
MD5 2d0b36d432a7b6e7ca2e6d42a4ddf9d1
BLAKE2b-256 ee1a4909792c2caea8e96ca06f5d080c5406ef85c7e2629474037e2688dc163e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 ed96afd6d2c91c7e654d35cca15eb53f330ddaac6fe243793406afe117c0b4c4
MD5 e4cc48b434ac5357b207606b9794fca1
BLAKE2b-256 74aa382024e06d1669c7b9aafc4923f002a476de438443b85d0801afd50c2868

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9dfb4fa158eba1eb8831ab1e8312f806475c45532511b749481fdd70d45a4ec5
MD5 a82b94a5afa68cf7822ab08d4c1e98ca
BLAKE2b-256 e7b9eab7f0d7d5997427e85fa8b064214602151d35f138b60a539e77451cb52d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 2da2087108091b05cc1b370b060efe986f834904a9d2260b959af11e0f0b5bc9
MD5 2ff958f25d5547450edcbcac72c70f73
BLAKE2b-256 c33c1cac5f6168610ae8d2c03d5d923d90bbb658683e93bbc6f52f79f64c4e1a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3e65f30c616870831e3be9e05e48cd48da688175c64533649a06f2b95ed33b60
MD5 31675118be98328cf09fef1c693a3c9e
BLAKE2b-256 5ac03166e1e9ea3b1d104d8b33c30fd8fa5236ecb345060f2de226c8cab06d66

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8c76aed0dab4f813d0e1d7f4987b8875a5daed7c6613c5a03af86e7c867f7ba4
MD5 d9cf64ea9a8dc6be32e2e8d641a50041
BLAKE2b-256 4f7a0ef296e9fc022a6c6572309a4d4934f5f994411e2605b1d5558f9b2c6ac4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8d44e72f38d481767bf8d44d443450d4f7a5e3b24ec964c2827733020f218174
MD5 835386d3bfdcc6a289ec22a615159203
BLAKE2b-256 309a4dd94d8eaa268d64573cb223fe281f038b8e3f8e1d9d0a93447dcaef72b8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 754758f82adbeab760b397e46af6a50746067e4fd976532f7270d41b5eb4d1a8
MD5 1b6c5eb4b856b6849bbbac44a4d73a4d
BLAKE2b-256 81f398c70e33e370fc56fb9cd0cda430db90bfb009886d392dcd0e7becfbdb2f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8ad7d17dc472452345db27ece47477bb7896c313aced651337d9e797a67bfb6d
MD5 87d8e153359b4d06b7d9f1848d100e03
BLAKE2b-256 4cb1e969b4e391fc4b2808e44ba7f24dea1bfe44835fde46873bf5f358eb00dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 752c4360660af996ce8172f4a5fbab5e8381f585fb95c31ca0a621c37dda0ddd
MD5 72123ba75f652cc2bdf6667cefdfb523
BLAKE2b-256 c59c7741d9455e7a902a2fc412546dc94ece253e3fe6edf3d12776a84919e577

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 70bd3f614c45a26894e5f89eb77efd1c7d625f7d2751d92997ff0a6340ba3cfe
MD5 e71f35c28b630df0519eda356250b3a3
BLAKE2b-256 1ea3ae3554f1e2d45b5d6ada3275deee63406f27a12ad49461b9a653b83ea3b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4277fe523b3475948237d58db57ec06b7ed0308e25400460ea6a31b21dea8472
MD5 4a5eaab0904a82a654414fab346ac8d9
BLAKE2b-256 5d494862a576ab81a5deef0cdb21d37a6a4472b8d0d3cc350b5a43a0b855e220

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4864fc9537549993c71bfcf39415c9092220ecec13d9aa980a18f6e607250a46
MD5 f4f9c9b6998c7dbd32b71ce8c7e395e6
BLAKE2b-256 a420676b72cff2f7188c7995c73de828c0ca32a0952e5b3166b2fee6a57776f6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 d15bb2c3904fb0525e202158075155cfe261af52af2fa27e1777587259cf3f5e
MD5 e8ce2718e455323c79ccb33fe03890a2
BLAKE2b-256 587fdb23cdad96be7e7b32ae843bccb9a7d8660edbf95542d77cbe13aac8c628

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8c2657df1a5f944403faf835a7da9c7752799893411e2866bd89e11b99ecf49d
MD5 12fc1056826310af96c8633d57d83ec7
BLAKE2b-256 380f541c688a3f98a63b267eebf8be74e5e15818d521ac2d6c02596d172fb1e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.1-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 118e5d47da374594558ef7512fd91679fab355a20534df0bcaeca17d260039b7
MD5 2e5b6178b623107f69a45e7390878fd0
BLAKE2b-256 198d5b5b4ab99b40baa838050ff2bb97123bff0994d67e1f6f22956160d8201c

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