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

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14Windows x86

ast_grep_py-0.45.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.45.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.45.1-cp314-cp314-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

ast_grep_py-0.45.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.45.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.45.1-cp313-cp313-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

ast_grep_py-0.45.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.45.1-cp312-cp312-manylinux_2_28_aarch64.whl (5.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

ast_grep_py-0.45.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.45.1-cp311-cp311-manylinux_2_28_aarch64.whl (5.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

ast_grep_py-0.45.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.45.1-cp310-cp310-manylinux_2_28_aarch64.whl (5.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

File details

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

File metadata

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

File hashes

Hashes for ast_grep_py-0.45.1.tar.gz
Algorithm Hash digest
SHA256 444f09a3928d966ee779b1ab9fbce881d4fa9a276c6e9fac6bb1746d2efc5714
MD5 04daa44160427a2117bdc9ada3f5fdef
BLAKE2b-256 2981fa716e61d5be8acc7d1da0125cee2e0726307e4289b6410c6a9581d4f703

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 00d89d7ae157f18319f897b9779cc449b2e97be4ccb7fc489ed6e41f6436b27f
MD5 afabccc6f060b06ff71160c77a5e1aed
BLAKE2b-256 1f26b34feb7f35f6d13e5244f67f526b87946e107d9d2ca7b534e927d06bf2b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 c1c2cf472ef657e6aa3a57f1a7d824d790320a97d0c1245a5b8b060288d1f690
MD5 341ba31c694fc1a90892ae3c7d32a41d
BLAKE2b-256 39fd26ed2b048fcdd1d81f6da21aa152215e03b390303b0c70c2b96e4108da46

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7b1ac42d8872059abe794fd0005a3ba6ebae72c2db72422765a376c56bdaac35
MD5 8ffa995b84b4142712de71dd1067c73b
BLAKE2b-256 b4f8d603657858079fe9c856a23ce543da799c6e265d86e8b7731e6bd8c22531

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 2534c6d8035fa2397fa7abe1b0b7c9c8ad6a69b57b0316828da2f5f92b41411c
MD5 531345f2c3aa3ab06a6ae644b360e575
BLAKE2b-256 49bd4b6ababea21ec5d4a56c86b56959849f8cd5bdfbdc839279521c2be14a5c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0f296c015d618ab41840b4e08db5ba3618ed4e1739f7797002d5b00c64ad2aae
MD5 606f561c529fa377d2674de2465ac4d5
BLAKE2b-256 b0c1af430c2cc01e8f527da258f02e8b06fd7af0d8a9ef8cb181b99bd36049d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 48cc4d872ea5f7d60c55e7d19fc795d4e8ede156f675e87245c87efa94889993
MD5 209c9e79e55f8e323fecc246cb120987
BLAKE2b-256 e6193157219288b8135cfaeb51cb5a8a3d26cab3adc7484ac13be6aeb0d41915

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 0bfc05f252e99455296bbad4d87043973052d5c29ff5c08b1f7bbf80e81cad57
MD5 16ffc737708ae75158bbb21c0ed03363
BLAKE2b-256 35593c9a915405a9aef9bf90b706396bf0393a1e1177ab725b90654b0d6fd921

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 4c8581b059026ff4c4249751054a5823175db7f303f9a352f69af017177332b4
MD5 deb9661a19c8033c39be4c90f47a5f36
BLAKE2b-256 9feac2951e0fd740293c82613f6956d3f9dad81eab1d16cdb3da8543c579f994

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 841ac568f9f4a94155e43e661367e7c55788c599683bb674ab5fe0b5dfcdb977
MD5 7ca74c8c49241e92abd7e94b3a36416d
BLAKE2b-256 53a196857476280ce36f21950856eb57def7b92c95583333106003262f7f93cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 955d00b7573738d29aa8f1ec889cec87d5802abc0e3b7fd4b2cfd95c066117cf
MD5 04cd6452e50df62ab7fb2026ded29a75
BLAKE2b-256 c608bc2179ce647429406a3f48cba7d1b93b8b0dc35ac0209af1820d57f77728

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 35b796de0e8c9bc9454b1ef24f07c86bd182e4f80afc66d0bcd188fd88acd20b
MD5 b856494373b457dd0f6d33f646dbc24c
BLAKE2b-256 3b8ac9b25e40648d6f21c4717d169d566cc4cb44fc215fa18f702b0885648992

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 515e0b1d3f1474b0ee136068f343eb500e38ce055652114059c72a5f362998e2
MD5 e200f99924e51b4867c8560aff47971e
BLAKE2b-256 a41bd7cfef152cd747306d2760a90b24f4913e07b7c84bd308db3f5268e7cec6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 57fafff917a6f26c60d2e53faee7cbfaba9ccc633fdd69eb31a85abbedebf7cb
MD5 05bb0a05bbc5393f1275c9f3cb8489cb
BLAKE2b-256 e5d93f99c33b927192a18faca1ecbc6fd6588c4f6bb18c9c114d2bfb4cbd591d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 357ff96e75fcc241c6f36a30a7178fbaa4c45e320a8cfa69d2dc87c81d148b06
MD5 3cd872419994c94b77a5beb923e4130b
BLAKE2b-256 711e4ee446c30c130e28589a553f4162f343f9c5256e149b16de4bb52465d3ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b018c762c1fa913d16e3396f06eb5c5f5f48728bd331cdc591880e62be3eb1ba
MD5 360de31bc744b8ba9851b151b71083c7
BLAKE2b-256 f9002db8135f4826d55f3d8efa544521b73c16c176230b4802dcd0c9935cb572

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 dc5a35f1bc86daa3d1c79d322e9ec4d4380b6c72c141ce43879ee21856cea77c
MD5 9de4b7991c4095ade5f1977853b5fd67
BLAKE2b-256 0d2aa55aff6091b75b9bfc9d2cfad6d5dbc17776f4fc3cc671dc8a85a27cacba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9caa33905cb352a62f5178e41c279f6cbe7fbfd8961ca5d76233d36b58f7e041
MD5 9278782c26678c6c6ff8ad9d71ffde36
BLAKE2b-256 f92ab4d68dd42ed47dc26d6a875e23ff4ebf587bb3418ad282434cc5c8669b70

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 012b14be02f2683cc63645670359309ab6feed0e1876cc0901f7f6a72f7a8993
MD5 75555146829e2cb812acc832f9bf1510
BLAKE2b-256 28b7c4f4bb38175eb78fc9f32ce103e2b42d387b6474d846890e1af01c011756

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 49a2622c6cd2fbbcdf67bf7f7c663e67bcd7f27e26698ba7ecd08927fd36432b
MD5 52bb051fdd46afa01e80e116a2444196
BLAKE2b-256 ccdf7ef158fd86689da1d68fddefaefea53e7a3985ae78e99d2be632c3d8def9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 3ce29112283c406859244faaa68e47445cca2a480bc0bf0bd2a3dab26159e89f
MD5 017b392eee5471e4c2eabb95ba77e066
BLAKE2b-256 c10b3838a54f099db4add68d162b7ab52050aecfdaa9f453e4aee9bdba95f92b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e972cf3868109837eba6c882b5cdda27e753bc38ba6c00ced9b78161af666e78
MD5 1c2f8d0d7b3794f0d9d96f8e1bcd209c
BLAKE2b-256 72ef34d72cf23b365d5b795bf0f58257267602c101868473b6f750a2d50a13d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 63e0c83cf45d699e11283c3764b2cbf68f87700f898a08d04f8ac9dcff017a86
MD5 9ca2f0b39ac3d98c72d81408fe8d529d
BLAKE2b-256 4f60e1170bbb78a0fe6e2ee948925c92fbcf0a9cf267cc684bdbbf84817f3f84

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e340dd96dd369c214f23dc2c51273c2cc5cf60b96ba972b4e1fec7119c056434
MD5 24b02c7b98265ee5359dfeb0a264f962
BLAKE2b-256 46d1d2eab80b5cc840bae52ff13933263b4cb6b455c153f9856aa8b64f8281f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8e89906067ea1091a866923a5b3cba24a6b358a94d3777b22a4bce098459a823
MD5 44f451bcb1da39f197e12fdc33c622d4
BLAKE2b-256 739fac1001511172fd708b603c4f075d6d36fa1f3a4630fc2ed50f69d34a2498

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 dee95d7613d51ba55f1b1cc83d0effa86fecd33ac5d00a47f35d97f6ec60647a
MD5 444b8074b5d82c66c4d4b82373143d8e
BLAKE2b-256 2c7841cd25460820136ab0e655e2e9d5d870644d20a3114179758c77f0b041c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 935969128dafe2ce43493c0eb0bb6db20dd48e706dfa7153f0fe86264c7a6633
MD5 baad30fa387675210f77c2c49228c413
BLAKE2b-256 c05e1a0d1c65a654371ebd2d2ffcde6f9edf824446680ae874407048db60a085

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d36f7746ce4efe5fe5a9d6c695a5b032d43cfd2b4461d379d5b6dfc8c1dfa22e
MD5 5b9a31ead7811510a7f9e98162e2e27a
BLAKE2b-256 f15c133218be7d479db69609f27c6314ca72b1e350f13adc9e2add15ad48de10

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.45.1-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0f21041eedb612b9d24e1cb4b522b8411a01fe98c63fa254b3d62c799a813e4c
MD5 061afeec8c565830fa0af43486a810ea
BLAKE2b-256 147dc0c0c10a441148001add9988b984e1ea97ce9cc2f11d83dac86514961151

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