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.3.tar.gz (148.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.42.3-cp314-cp314-win_amd64.whl (5.1 MB view details)

Uploaded CPython 3.14Windows x86-64

ast_grep_py-0.42.3-cp314-cp314-win32.whl (5.0 MB view details)

Uploaded CPython 3.14Windows x86

ast_grep_py-0.42.3-cp314-cp314-manylinux_2_28_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

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

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

ast_grep_py-0.42.3-cp314-cp314-macosx_10_12_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

ast_grep_py-0.42.3-cp313-cp313-win_amd64.whl (5.1 MB view details)

Uploaded CPython 3.13Windows x86-64

ast_grep_py-0.42.3-cp313-cp313-win32.whl (5.0 MB view details)

Uploaded CPython 3.13Windows x86

ast_grep_py-0.42.3-cp313-cp313-manylinux_2_28_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

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

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

ast_grep_py-0.42.3-cp313-cp313-macosx_10_12_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

ast_grep_py-0.42.3-cp312-cp312-win_amd64.whl (5.1 MB view details)

Uploaded CPython 3.12Windows x86-64

ast_grep_py-0.42.3-cp312-cp312-win32.whl (5.0 MB view details)

Uploaded CPython 3.12Windows x86

ast_grep_py-0.42.3-cp312-cp312-manylinux_2_28_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

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

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

ast_grep_py-0.42.3-cp312-cp312-macosx_10_12_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

ast_grep_py-0.42.3-cp311-cp311-win_amd64.whl (5.1 MB view details)

Uploaded CPython 3.11Windows x86-64

ast_grep_py-0.42.3-cp311-cp311-win32.whl (5.0 MB view details)

Uploaded CPython 3.11Windows x86

ast_grep_py-0.42.3-cp311-cp311-manylinux_2_28_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

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

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

ast_grep_py-0.42.3-cp311-cp311-macosx_10_12_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

ast_grep_py-0.42.3-cp310-cp310-win_amd64.whl (5.1 MB view details)

Uploaded CPython 3.10Windows x86-64

ast_grep_py-0.42.3-cp310-cp310-win32.whl (5.0 MB view details)

Uploaded CPython 3.10Windows x86

ast_grep_py-0.42.3-cp310-cp310-manylinux_2_28_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

ast_grep_py-0.42.3-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.42.3.tar.gz.

File metadata

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

File hashes

Hashes for ast_grep_py-0.42.3.tar.gz
Algorithm Hash digest
SHA256 4d65e0676bb913523fd8946809cfa8eae5166f559041604bc530634292d58e92
MD5 534c204424ade5ebc236213adcdd5d41
BLAKE2b-256 61cd7fe47c398512d8e8415b23d941ffda49d83f7007e7cfeed0ca704bf16764

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 998548acc1d663dc8bc68dbdbdc15381bd6fc75aaae9250aaeada7321bf5315d
MD5 587665b102daea07e360fe635be599ff
BLAKE2b-256 764b6c559c393bad47bab0ccd3d882cdb53eb8592d8cf954e573d534081fd19d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 db37f8ad8989f9e15e954bace1385df3c3b868c0181fe3497066ec3de967b278
MD5 2bb073f8ae873b059fed348f8d309ba7
BLAKE2b-256 a9a93e1898def6b640ebef0e9b0be828187ad592c8acd989b3c59a269af5f195

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ea6da549253530b78e94f9b55e22273fabfab8c602b30bd809ac8aec90965120
MD5 fdfc76cf0244c1d2df6a82433c1957b7
BLAKE2b-256 e35a8c49526098011a441a507d85d91c997c298d58a7c1db18802d6929825ae9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9ea199d79bcefa86606ecaadf88df3fb47c4fa1eff8e652adc06a8cd32389bbc
MD5 e4ff88436dddaf4f0745cc793d2dad03
BLAKE2b-256 a20666b2b02ba3785b41d3dd62fd4fc1eb633f0dcedb36d9cc549737ad19c681

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c6434d4d90445ae8035d78ddb09040e8320ba4ff6b8f077be9818d40b1e23d02
MD5 fd9cae867d6c707c830e7a329e706b83
BLAKE2b-256 488cfee98e765a25d75b23ba4804397537ea732786af33cb50c266e415a870d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6aed0efa0f888098b84b34f629fbe770c4eb037e29bf1cb2de2c573357e028ab
MD5 50eddf31bd613c7260b9b5d6fee4a3a8
BLAKE2b-256 8c1b1dcb1088893063cc108cc0f671bc67f5c2d7b797d11401b189a4ffd7fdef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e98cf082c588bfd2e3ebb9643c55dc284f2bd1216bed4e64f929cbe426dd0413
MD5 152a15734188fe5235ef5cfb839242a8
BLAKE2b-256 8a9abe5e1cc1fe4d8fd35225c91c53c277980507e5b9eabd5ede68f6bbf3f5b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 e05e80b48833cea5ef66d1acfb736c1920ef02857959f62332f10af3224ce498
MD5 733b07c700edf20065ba3c1dc3eca16c
BLAKE2b-256 8d21e40450b43b8e42897fd3735f939369f9728d3a40f92ced4861a31d49516d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7db816cbafdb062e39b808d1d8e9250a70835cc8597e08d9858e1dd4aa6689ad
MD5 f62bde6cbf0324b75c4272478669e91e
BLAKE2b-256 98fe2fa68bfa4bddaa37fc443b7ebc0571b68fe80afc09509443e2aed4a46aa6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d39db04cac8a052d676ff504452e444d8f75c51c90b939c3def286387946587e
MD5 be4803b9cc438c8eb71efd83f8d6e488
BLAKE2b-256 4143d09e328ddefa0bc2df7711081fae99327b356def91554e22faa95d0529e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d963d4f91a10161791886402f9fd478c3b86ee22d1a10dd727a302e087ccdd22
MD5 e8cda98ceab8aa40faeeeb96723c271b
BLAKE2b-256 5e16415de77a9c81315f4ede6c37c2ceae72edc11d489b32803fe39a8c40631d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 26f24823ffbc20d30833cb7ec3b040d21be6a5cc00f338a09bab5d972ba6a6bc
MD5 79787c321e20410950fbaa47466ff2f0
BLAKE2b-256 8e62af56e40c0777f9c0b00cd08af4fda5cacc609590d58c2ea4bd8e6d4de5ac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c7a1b5fdced6fdc575da5f5f4280827e9a80387759de293353f1b0e0e1b216c0
MD5 bc2694427b5ccdb4f691123c35347a82
BLAKE2b-256 3875fc0fb024c01628cc0ce4e20077711130e152dfbf42c1ca49e2f22b49bfbe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 4c0ac7250b7f0cd2101ad73ad88423b5d05c10e41f127a7672b1db56e1379536
MD5 e2e7f3c1b3ad4f40d0317449fe8537df
BLAKE2b-256 03ed637b49adb1153eef3b55da56d7555c4007237945bb3489f2001249f97d7e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b5aca7ee4e39edd2c7bdfb08d54c61748f72e192428348ed5efea434c3393347
MD5 198fac70d17f7d7b8c5c8bd1c63591dd
BLAKE2b-256 f1048f1f1322ba4d43a7e585f6e58243e87b759cddfef7b7263bc566ce284863

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 bc083374da605215d5ef32bccef44ee3a186081585e9ab04f57cd8f5ac91f7df
MD5 b801a3f51e1f8fa5b699cf21f073a346
BLAKE2b-256 fbf3a85e6471cf8bfb149262b429fd23f7279c138763db0a79617869bfed37e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dc15e56f86fca9ab0f4a112d204bb279e57a2047d4f408fdd3bcdd1ee45c8b88
MD5 1a1f43a83537288056523fc3022f8b9a
BLAKE2b-256 d2dec0e04703b6be86e1b55cec1e8ca2a0db186f8cb7359696f1908fb169ff20

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4f588c998640283a0b4fea28aa7e0694ada24ceae26fc6162d601e3de1cacdae
MD5 58a7d889cc620ed9d1f2b30660bb4013
BLAKE2b-256 83594bccdd151d06dcf24f88c973515cf5f9db21ba93dd68611d9d1048e0d0b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 39d8ca5b6543dd55d86287ffdffa651e0962fba710e7050ef284601a4af37687
MD5 9c4b78d02152c8225df2bd7d33f75011
BLAKE2b-256 89594db0e4db86d344a90f07564505ccba3fa269074ed1817468a979cd3e01cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 a2df48a8dabde66e8bbef758ea505538922f407a5cebda2be791fc43a9bdf26e
MD5 02f61744adb9d4997e4cc0b93e277fc4
BLAKE2b-256 92adca1183e93a9e61e623c2d07416cff435fb5201de93fdb79d4d43ff77b8a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e49fec3764758006f202efa1252f824ca9924c48a150b3eb80643eaa1327fea3
MD5 117414cd4d96f52e9218f9842f974e7b
BLAKE2b-256 f2510463e2a7990ff9ce6d685d3d166bbf6a98d6af8a7dfe25aeb87d88b1cc09

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9121b399f244a2457f0a0b903206074fba7e939adaac78012ca898e48ac96a04
MD5 4209189b120f654793f15714e3aca5a8
BLAKE2b-256 8024caf7f66c3393eef1d73aa5aa3bc0ef3f0617b386f6a0a0613b5d7c69eb3a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9e58e34e27b49cf349e4d5eed929ca560f12765479439945fe3f84efb3af4ed5
MD5 5c2e073eb090fc02890b1daf93652f88
BLAKE2b-256 23ced647c6924d60f85a1dab0f868412d752dc7f171668153cbff516c66f5526

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8c8beee57c4f8dc8e5727df6c45e9d1db2432252834c26f26d0a1f4cb94dd35e
MD5 6027e460c1360338fcc7dc46541a467d
BLAKE2b-256 37648b7c9ccc530a1830fa7dce76ec2455db1a6fe89d039bbcc1b8dad5eba213

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f670ab9496c69c870b56af86e291edc85983470415c511bb15a8a7d01d1685c5
MD5 ccb4f8158c3b72b7727f3bfe4d52de2a
BLAKE2b-256 13b5a8e5352f59967d31aed772a59b87f083c08e37b17606ce9ecc9064da3e60

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 471e204a9e696f154e18525f11aa7be246aac5fa300c2da3e3228bc7bcd349a2
MD5 709b439d22e7892df9bd9741aebf0a15
BLAKE2b-256 ddb3a27f623122b1fcdf3f6e847ebe226ff10278e97d73e0a272f68f1c54d08d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b0826bf7006b589313f7ed35905689e5f431988dbcdaf04bc42be254d764189a
MD5 8c9084962962de2f105a574c9069576b
BLAKE2b-256 f527a33dcd91537c5a122b628e642c77a3eee5b45e74f5ee870b5767dec119ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.3-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 7aeb4d4430343d31ad86de3c93f4537fb392c14ea393074ef431fb73f7fa2120
MD5 a78a5967dc761d7a9a0cde21f40c069d
BLAKE2b-256 20c58e1489c274fb36f8ccd999ad05a8847fe833bc1763485021e6c7a2566e08

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