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

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14Windows x86

ast_grep_py-0.44.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.44.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.44.0-cp314-cp314-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

ast_grep_py-0.44.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.44.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.44.0-cp313-cp313-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

ast_grep_py-0.44.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.44.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.44.0-cp312-cp312-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

ast_grep_py-0.44.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.44.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.44.0-cp311-cp311-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

ast_grep_py-0.44.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.44.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.44.0.tar.gz.

File metadata

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

File hashes

Hashes for ast_grep_py-0.44.0.tar.gz
Algorithm Hash digest
SHA256 8f3b734d0ab0b1e7692cde4eca3f47c440e0398caee7420d07b3645f53123b77
MD5 c9ef79daf768c18ace5ef94a2ee0932e
BLAKE2b-256 0b6ece10143ff48cdf1d8b52bc43baeed2f88ac19e0499a04336900d2b047b19

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 6b0354ee5610a43d756aebab4acc5bc65a890bc7be681d30b72b84dd6d6011b6
MD5 35f19adbf35bd5d3e004b11c9476d945
BLAKE2b-256 b4169a5859450eb9e6412477ec010aeebceefba4bd91a7ec0a4cfd0ebd2a9017

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 1139ca5b196ef121af2ba131c4337ed22ca35feeebeb58420842e6cfe9e7a329
MD5 e86bf6ce8b2f5e8afde7763159d9a093
BLAKE2b-256 9c22bf8a4ea5d60111e2cfeead14c4b95c2062afff1409c74ba27d497afafcba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1e46ef7eb98d650bcb9d384bdee15f656c42dcecb44e655b3269eb512d2683e3
MD5 3fc67b19a1e2abf965ab02c1897b34fb
BLAKE2b-256 783c6b875cf00ec0381c0b9e143349ccef6e50a76cecc24ded11e6625f594d7c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b269615172d5fcf40caed90c6fb04d84820bd2f9aa31d39ed07d0d8ed14e3fed
MD5 433b26a7b6dfdb09a2b6c1ce7feb2386
BLAKE2b-256 aa0210d63d7033ad2c4c806855ba025a6bd01bbc8ac88f42481c9acc70321ff8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 007db74cd85dda2614292829c1fc9c478aff66cc64cc24ec6eefbc02c4ab444f
MD5 17c77186e68e638b9d40908a753629cc
BLAKE2b-256 f1730e9861282f24d4bef0123221b02ba0a3de31019965d9f0ac2c6fdc5d06ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 aeb08e6653045104c12cae6ad9b31ab8b5e1988cd1767ea0a09ae97b9329628e
MD5 5e4dd34488edbd4d607b3f94d5ff79e7
BLAKE2b-256 809d03fa2531beddd07aee37eb34be4e27bf3bcf29c74a9fca31380f0b71cc77

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d08435649095a1d9a0d9f02d94edff94893d205324132d107195e2be9cbbd3f5
MD5 e5ad455d75719c828dc6914dd83e06d1
BLAKE2b-256 2236c6189c3d411840159246404638671619218cd169e1d97c3650ff0b98cf25

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 ee7d12e26eccbbc663f7ba67a61470df70c5558370df29574f3c6ccfe5b37e36
MD5 1ddecf0f08b27f6d6f157e5d8802f9a6
BLAKE2b-256 8b5b01f97c9e864af461647721f27bf2801f090eda726b3a595ea97cc9d3d8d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d950210e334d60a97e0332016e81981e94bd72f3ba1b8a7e96d52006cdb22bba
MD5 96d673925a95597f1678223a089556d0
BLAKE2b-256 6c9e4f8cb53482f38a1a9809d78f1d83deac6a1d1e5e398aaeb88aa1594fe319

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 42b37f442489c1d474117de6cbf28fd26085886f9687c46e84717aed1bfd7517
MD5 d0d940a04c0d6dcbe5fda873a1ace1de
BLAKE2b-256 078a71ec5d93833225c65c127b91e512a2cbcddb00e6c970a048d5efdcc6a79d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8efb5f047b74d447f0cd6ade41040bcba965df66d7a349845b61a6be73148b99
MD5 c3d92d3b3986325c36de51893a131a8b
BLAKE2b-256 53ee77d4546d92adb0b84aaa60cd47b73cfa9bcf9228324f177b65e74b572569

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 17197824467ee05eee2b1ca7bda3ed7906c7e6c705d09a9061b47a2c7a6a07f1
MD5 cf8978b2bb5efaa5018a37cdd107998f
BLAKE2b-256 17b6f12df11c3993d7bace5871b8e3e51ca8958a566eb16150adaee53ea59b24

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7064c0b162bb62a2e5e23962d358edb6fca398b05e670a32c3b280b23a21a098
MD5 010305b940ba6f073c20361152ab405d
BLAKE2b-256 dc4381466ad4bf4d52b62fb5c5fc890c7f6e206722677232e37c0ff1eee2154f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 541563443fdfa5d0abaf415997f40a834377373cf63be908be13213222d5c85d
MD5 3bd7e4791668832a70e2b11d8bc8dcdc
BLAKE2b-256 6d30e30583ccbde8291a70c70181f34e685814579233ae36f9bb967c9a461f6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 af57de4ad3474fcb1fb894aeded8dd9eca00cebfc03f374b58102044a860ef93
MD5 3a9ccc280bedded0d97c693c9bb43312
BLAKE2b-256 3328a38eea926dcf2563a93d1a3b4a4c8556a4578f68cf92cda5bb4b97f05bce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1212e8b3ec3bb00b32682229a3f1f3e313d3974508836ccb4edb4fb1fde8c90a
MD5 d8fd747cb944ba2e0f660f5bc28ca2cf
BLAKE2b-256 c1429dcea1ed09be4ca7b024569dc62e650ad7e737b05b9d98a2df51efe18fc0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7040f658c8385d1269f1f18771dd00b9fc61898dc919e5f6ecf9aab91edd2515
MD5 8a9c9839404483f15391af24db468b32
BLAKE2b-256 108041650e7f2c82a539597dea0d32bb106f646affa0f919969f08e2b650b4eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 44a43e0290a8a16a200c219a500ba0b35fdc118e49ce56b179caec548adac8df
MD5 64c9dfd192ea599d36ed52fc0a19ad20
BLAKE2b-256 7e0c31b9360618ff86ab300a97644b4924dd4ad0feeef7f5adbd5bed4fcab036

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5930f21e49909a857f1feae886400dd064ef1f8591eec2803361d77e8623f74b
MD5 76afe2451aa74cc3962dfd04d508ccc3
BLAKE2b-256 a29e08c21da68c3ff2f521e34439011b7cc63c4ff375c4c08e91d1f67b6a26cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 aeac8668c4cbdddc9d6af1131499db7f56456294db9b2e62ce5d4022cbf4f97b
MD5 39dbffa633e3b871561db8908c2bd15f
BLAKE2b-256 629bc324f3aa3e74f3ac2e3111872d66c0bf9ed8b4a2e8fa3a07092edd2c5a69

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c18b48328f5fdd97d9e063f3c0ca8febe8619c7d3a833a5a2aeca5a75c68b72f
MD5 886d8f28bde233a439a23634b2b03887
BLAKE2b-256 300af76c66afdad9e12a1357b34f219aa63b5ac7ec6b96ff7d934c3ca7c88856

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 11f90fb62f197de40cdf7eb36820b44ddb91c0ae4ff4dc4a0e34a991ded5eded
MD5 eb61ee8984786cce86f2e9155eec9568
BLAKE2b-256 3b3055ec282ba646b6e11e920d93cf9f04a063fef9266ec807e3bbaeb625f420

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e6e482537ccbeb247f146ba85c93790d512eb9494db1a9fd80e4a85f23e56931
MD5 221d28293beaa1954f1079d80b758204
BLAKE2b-256 b67d1e98e5962eedc5c8aad9e80eaece650c332982bbbfa4563b6fb155356c15

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0baf89b16c1d16aeef8371a2b77c9dbb69aa4b5169d285ef2781e93804b6dd8f
MD5 a8fef0040b80af1d8f2bdc5d355d720e
BLAKE2b-256 2df95c953797784f077c8367b0b092e12f83d40bd2057ee46052f9c6ec665882

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 6c7bc50fa24e049b8001fdac97ed686c2e34bfdff85907030877ec21bbe7e0c5
MD5 930af2b55495160fca69d05bc177ac72
BLAKE2b-256 52f52be3f1a58fc56a854cf7d4faa078542a7ddba82434fe76a7584c16be7218

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 89fd5ad0382fa2b09c05ea75c51501f4a048993299e972f5241804e4b3941a63
MD5 2e37d1c657b7ca8d5fa38bbce59c0e97
BLAKE2b-256 275729ef47d3af8af3418a3410a956bed02421c5deb39bde1732ba584fb849fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ed9820be1c6fb455970401540b38d160a00ea8d789d12dc752b1e125872adde6
MD5 0728e4041eb97833ef832251fe8502e4
BLAKE2b-256 8eb7a0215c2ccd91268928b8a45cc50e2af9039f73ac19aa02c89d7b366d82d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.44.0-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 358e5a68ca4a3abc30699d70a76c0413d56b2f7d61289f8aa1cdf9cb6bba58df
MD5 76d8eceab823086b24de5d391e749fcf
BLAKE2b-256 a27bff91e80d6bd6475e62befed833acbe4720474028ed0756d0fae35eb2b554

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