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

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14Windows x86

ast_grep_py-0.43.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.43.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.43.0-cp314-cp314-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

ast_grep_py-0.43.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.43.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.43.0-cp313-cp313-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

ast_grep_py-0.43.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.43.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.43.0-cp312-cp312-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

ast_grep_py-0.43.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.43.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.43.0-cp311-cp311-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

ast_grep_py-0.43.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.43.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.43.0.tar.gz.

File metadata

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

File hashes

Hashes for ast_grep_py-0.43.0.tar.gz
Algorithm Hash digest
SHA256 7f24d88de4e7bf376b81bec7064015388e9623858ea7ffbf3085251e3e7fd1ea
MD5 3cf15c07e42aaaa4c93d65f584ae6315
BLAKE2b-256 b6af4ad9de232c1887993462ca3e5ed9f89ac695ca6c66417e49de1c451c0af6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 4ad12ccb4fbe9aca32f02b7562924c900ed70c2b42ebf4ee52497073aff51aec
MD5 83977f754f12a4f7600262698ded2805
BLAKE2b-256 a19f4a4088c5b70e28dcdf740b9f10c4bb5f7e6f5edd1463e7efb41666a23570

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 47d55f36158a191c9e190f4aabf4ce11d034104ad9cc1a96e1892e0bf164b5e7
MD5 347cf5ee3489913c8bff1b5392545824
BLAKE2b-256 0dedc83f4c88c874c7a85c97996fb2d5b6086ec564fc02d4f2f5a24b2035fe6c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0ca793f2480d3bbbbcec7ab5f3cbb60808b6e7c1fc4a5699a597dd9cec780147
MD5 cca13546ff291c6176ba0f0f6944ff12
BLAKE2b-256 276d423aa2508197802626971df1a09721e35d99c5c31bffb0fd54c84bcd41c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a67f606142dd72efdcd087bfc56beb67f8ff6be75186a24df853ab85bb2c0430
MD5 a15b4f339afbd7cdf9e75d1b5a4e6a12
BLAKE2b-256 8475c3ce417779f093b31e069a4f1e7d3116d86cac351dfac8a2863417b01021

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6e50500476ad93cad37d12fe9bcb1afcd4dcc0551a39587bea6883b89c71e63b
MD5 3c07838e33e2790a2c543e3884f8347d
BLAKE2b-256 021181f1e6a038aa6f5bfd87b0742f5eaea3787b2d36198faf335939b43e803a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 052fc3c799b45de4f30239dbe47a45fc56e77636c823a7fb02b1bd1ef6468fe1
MD5 c345061c8786d390b20778ea0514da22
BLAKE2b-256 03929f71b237b98dbc1b9c34aac9a2837bb6448e7d2b00ebd024728cdbfdc150

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 92872d04c7002a30479e0f9ebece1839894d9fc01752dab34375e3209965aa55
MD5 451e186daa2ed3a8fd2a50f3ef242d73
BLAKE2b-256 7729891e039eed2bee06bf99f01b93684f40493a5ff57d32750f15324da003c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 153868e2cff3eb179f7360332929b07f24eae3753624940e15158d6d49c24250
MD5 4decd3d8b5c426717749749d339d3ce5
BLAKE2b-256 36b6e4d4d5be7317230432ad122ee6b38bf1aca5f3bb9367e006f0d21f404298

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4e97555040a653c119d318c2f08add9d9e7c4e5d3ed87daaa4daa69a6bc8844c
MD5 0ca1fad8d89ac148b69a4cb34b58f8fc
BLAKE2b-256 539b3e3166b30bfc273ed58978a81d312bd8cd74e64bb07734548ab537f7b8d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0ac7395c052f10b4fa521d97fd6a3cccdcb4d582e60a1d8f0b8b47096d0d5e48
MD5 b30d618d034e12ec9ea2d200e99b7899
BLAKE2b-256 78530b7c30be2899a5fa827dd36a6d2c60868f36119700e05350baa0641d58f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 30140cc8b2ef4776161adcda46a72f7a90d501957b8e786be0b8e629086c09a2
MD5 85851f97136e346bed67a816c409885b
BLAKE2b-256 7db602f818587da32b479b9f3f113115f70b202c3ba9853db3a503a366e90ece

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2eb684c21d56635d6f5a68d51d988882c85ce664b4d2fb657f9a36cf9de0e48d
MD5 834aae7809083a99a4cbf5624a4d8d95
BLAKE2b-256 3939002514ebf42af4ea059c92e1edb3a190b02c64a19ea15528e65639500e8d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 111189385c87f93b5d5f9b10e7fc4c95f0342e7f83d583bdd2438e18bf4432ff
MD5 f0676864db0d154aa3b7dec0e8efd2a0
BLAKE2b-256 a7944085a5d4912b7499d70f883b0bcc99c93fc5d579cd9a9918736dac56001e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 9f0a4688a71b830ea2c63f58010dbeae20f98f1286237f41f9c69f2f9274345e
MD5 175afd6a1ade5acde7744662d12be6fe
BLAKE2b-256 ac5991325dbf87053af61f75b413ba40e60b81cb3a0a348ba28c492531665048

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2b0f7db2e4191748af6a33d1da0b822279ffd1e964c0cb74b2bafed9763d133e
MD5 34ef745f6849916b45673a68477ec400
BLAKE2b-256 cc5be122b3c27aec86394a9384f5fc01dafbaa392db4e6d9d6d7de43e10ad9bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 91be3dc02530bc69d8267a22cfe9306a871a0101e20794004d18be843848fecb
MD5 0681820b828bfa21fd84de12ee50ad02
BLAKE2b-256 07a7bce1de3e24d377b3d2b0357572c54dcb24bb13e95f0401be0639e467cfe4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9690b7fb6422a864ccb905d20bcb5c40c6c23e08088df77f09d3a3e8938c801a
MD5 440deab237804e05ee3d1efda8e68c30
BLAKE2b-256 adf38b91ae25ada15db4e0e2c50a06af28623f09eaf8b6953e4ccd4837c6b9ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 5cad982155b74852fbaaa141b9b7b1cf04bc4a25b426d88eabbb8d1e4a99d958
MD5 83598079ea8511c4a5b0b4903bbb90d8
BLAKE2b-256 0c84e82b820024c37f3dc423bbd4999f1b9b9edacefef2909b850f0e1d89a79c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6669f57d7a798e432c7f3b0c3e081cab503914f26151e68b0fbc997c3be08bbb
MD5 1211a09ee9a849342cba8c7c8ce9521a
BLAKE2b-256 835f0b1c888c21ed4c475a709305747d35ba99027bcee542079021b38d09f384

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 4ccf627fc12b28893b758b520cd8723f103ab29e78052f137457e2b582ac02a4
MD5 704d8cc935cef8d97c6b26c898a3290a
BLAKE2b-256 95bb72de0d4f6fc9d1a16b954433ed07f3d1e2c236a4fd3dc06cfa06c70e4fa3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 15beaad8da89cfd652ee1599e73185f7829596ccf488a7a7e9790eff9f58ed52
MD5 30bdd9cccfbb317af854e8441997e3c2
BLAKE2b-256 2508e002be3adadf226c0133da8ac89e75cb42cb69b395a59d556f8feabaca2a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 30eb29c23037b161336e8fcb3b78569dc2f1c8521725ad1a1a22636b86f6a951
MD5 cd4f56978b4f94a19e51dfc9869a2eff
BLAKE2b-256 6d509ed9f8580d9db5c947e63b28445598b4a4b4d4cc91bdd6d17705821351a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 88a5cf693be007ba368925208586af6fb39f1c13d5ad6688dbdbbb116792fdff
MD5 456940dd05255ce0948d38f63af2f1c5
BLAKE2b-256 2742208b9e20b3be9bcc26e79fdcd46747679194e14d2645fe1c5c4eabf1f779

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2e94fca4d516dd6da5fd06cfbed46e67ac5d27bab9a3c27653ec7f05a8dbda7a
MD5 b15d5679304180c607f49d6be8b610bb
BLAKE2b-256 0de56768d54936a0ef2837d69a56e15c05db608819ff6deab88e99ad8616f6ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0ce1f8013b460819172c26cb9786792b5f08e286f21449da05705e153e7bfcd1
MD5 ee6bcb1bfba997c00c8a31e619103b24
BLAKE2b-256 1f042e36c08574137be96e96460c361a62582d10dc87a9dee9b2d5d924ad22b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 f45e226e21dceed452eb0fca7db244e0762bda4f95fe436071e9f608cc910ad7
MD5 05799cb98a511a9379e6c8dfe64a3e14
BLAKE2b-256 c80324249448dd203bb72c7f1f34e268ab63e649f7ab15726eb6148f03110e53

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5cd8a6bb08a9badb09a822e8c52036b7d23c0db0f43fe05d93b4a2c08e53c65f
MD5 8b95688350eb26f8e9d9b6c4e80937ef
BLAKE2b-256 fa4956c5b40d70d57bc64b8a2981031867926ab44c41bd228c1eacc5208b18a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.43.0-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 af14f53756b2b6b9fa11ccf690eba2945a54637570c8c16c4ac0975d3489bfa2
MD5 181fbef9fed1785a339443455d3bca91
BLAKE2b-256 86766f78e564235a862755bd1ac3f8e38ae1baada4246ff1958e98194b9a1d21

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