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.2.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.2-cp314-cp314-win_amd64.whl (5.1 MB view details)

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14Windows x86

ast_grep_py-0.42.2-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.2-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.2-cp314-cp314-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

ast_grep_py-0.42.2-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.2-cp313-cp313-win_amd64.whl (5.1 MB view details)

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

ast_grep_py-0.42.2-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.2-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.2-cp313-cp313-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

ast_grep_py-0.42.2-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.2-cp312-cp312-win_amd64.whl (5.1 MB view details)

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

ast_grep_py-0.42.2-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.2-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.2-cp312-cp312-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

ast_grep_py-0.42.2-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.2-cp311-cp311-win_amd64.whl (5.1 MB view details)

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

ast_grep_py-0.42.2-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.2-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.2-cp311-cp311-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

ast_grep_py-0.42.2-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.2-cp310-cp310-win_amd64.whl (5.1 MB view details)

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

ast_grep_py-0.42.2-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.2-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.2.tar.gz.

File metadata

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

File hashes

Hashes for ast_grep_py-0.42.2.tar.gz
Algorithm Hash digest
SHA256 3ef99ad62d518e10acff88d57b2d36082bcd14e24193724d45e86fce3ab87cfb
MD5 6cff76d65e0b3f4e27cc5646c60dac7b
BLAKE2b-256 a3e1add749936f35b7fc9dcb320af00abdb555372611ccce7265b37ae66a40cf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 0efcec0e7970a5a5fe175ad4b997ec2cfc6d01bb583b1d857b299e5cd6ba9511
MD5 61e5e187a2da76c0d1ffe38b9a054ea8
BLAKE2b-256 3a8031a670361282005006cd185b169c99b747a6319a5fb9454c1012fb101009

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 b211f0ac572f49997214ee58c3af5440ec67b26495f71c52740be97f972d5dac
MD5 5af43c16c0c057c2de9aa627a21fd977
BLAKE2b-256 b61ce526c27dda6ab46e4594a15eb096ba26bbe3a8b125e2621c253c667543d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8792057945409b74f2dac257d706ab91ee7d26c96c1c16786bd209859ae9b4d2
MD5 6166a5ee2a75c5d2b5d3bafd51c2c126
BLAKE2b-256 1c60f616509f1f0c2b73d59617a091889a010e5b45cae0aecf89d58673b71fd2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 adeb6feaa911552196da7c7704327ac4d13819e62d569196d404c7ae4ec1c010
MD5 6555f9f5d4d9ed920b1e41819c202c75
BLAKE2b-256 50308a8312790a956951de342d4b8cb7be9b9f4621b4fb129d42b819983551f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7e701ec3f9842c855a8c1bf0863a0827335f440355ce4c86f60d0234f9d36d5b
MD5 4312fabac45ded61131b1f3778fc6b0a
BLAKE2b-256 7e3f1380ba2d5392c25b3f153c7ef357fc31a72b12f56270a92e11a094c25026

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7db74c12daa713dfb94d057f38b8e21c343ec2730cb48fb3222c8a3dd585a06a
MD5 a158faa131cebc5ad3875e4b6635f4af
BLAKE2b-256 e395b3c8fec9c95e7d985463764aaa49449fe35cd42067aecf889828417e4024

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2ad0c4a23b8c4c677d98fa96d1d85c0e3882daf79311c713ffd079864120ee6e
MD5 deb36e7c8c9f76a367265a50c013a7b0
BLAKE2b-256 32efda0d6b0529ca2371f12f922e28f6ef5453ad73d3ed5b8421d0d4423c51cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 f255e94530d5465ee774d97baf91c0d25deb75cba078f88504691824c8d4120f
MD5 c05d7b0cd2d2fda5400be45be0e9dbc3
BLAKE2b-256 ba6831cba664b5fa87885201b19df22628e133accdd27c145da52e5d493157b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bb38e67957269cf30dbd5c2a07ed66299f989dee580cebe305209ffacab3ad3c
MD5 e5e369cacd4897e92808e0a9c42d6dc8
BLAKE2b-256 432b35cc8dacd8f57d0da208421c4c9bd9e790855176bfa034e38dcd602ce7b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 7cf0e178abd8d2b73ba574d14160de9ad557bf506c2b4290611b8a59585600b1
MD5 a4d823c096c89814c1aeef140d1d1af8
BLAKE2b-256 8e3bc529db887616d06610de42266e16a5bb51ac3d603a8761ad8eb759d53fd1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 05ddd782ecc5de84af6cb94814a674a9d4f5fd37a94934f45ccc1d8af5ea6277
MD5 0f51c002ae087a18c47b90f92a938267
BLAKE2b-256 4536390b93cd7cf019a74b3228b80c3865673df199a830868002d82911c5b1e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 3c4930888a2a436d0192a04ca8b5942b5e5850b5e6c1dc6003b9e6067e2be780
MD5 dd513e6c2cbb9fdf02353d0a1ab3968d
BLAKE2b-256 3fa9613279c1d65227838432778f5cddd24c3831c19483e9915dfd4727185206

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 846d29c1656f6ddf026dc216b446643f501ba6dfb35250ce86f8da15a3bc1880
MD5 837a0f153979705f9489ef8dce4cf8dd
BLAKE2b-256 2509dfdec0fd1a1a7e2b5a26b2e09d2d24a9d2f03ba789dbc48dda5ac91ebb2d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 0b65af7a2b3b6788b1d3e3664fa106c6d22b77b90af10d62c6d71b9f4479bd14
MD5 763dd7b4be186e1ce96054ae698ccae1
BLAKE2b-256 763f64c9e01133d6ae6d152a092a09d17ea83df6cbf8fd2b4948a7345b75a5cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c36c4ef40ef6c0063a50737031227d17ce98bb788ccdfce26a310e1c1ec99541
MD5 858615ac4f08575492b70c4d7c100979
BLAKE2b-256 1e94a5869ca0fd70b87735f4d6cadff7ba15b0027d62e51a7ad67bffa22edc09

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 109af438908f9a09acd2eb3333f03d6fd931b6019be77e714b4a7bcda15ccb8e
MD5 00058566ebf1f19ff8a51ef197954d54
BLAKE2b-256 5e8016cbe8426d56b165a49d3ff21458047d2b21dab100a10cc9eb2107960dfd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ca59e6b2c88e98556b7958846d02c0ea26ec083677640aa3e27eae60a6bf96ae
MD5 c5d00c4cff638cee2718d210e56b87b5
BLAKE2b-256 3a8e2c5c28527d974f23378c975375a2faa22f118ee4ac703f56fcba1a3b1d24

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e581d307c55a9afed82e4e8457e456cb727b167ed737ccd76d8f2f9506c4c0df
MD5 19ea95e2c6f1c0add29a477793517ff1
BLAKE2b-256 2331022328ad1280f276ff83f2b25966e9d3638fed0c3e1b438b41a360fd0134

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5a9293940f27d10c2d6e59dbd18ead710057ad573ae13601157b2576991ca1b8
MD5 f96fc3391de356657b5ac540590841d1
BLAKE2b-256 0eaffc74a57caaa7c8cdbcfc1a83fc6d21277fe2faedc52f017ace1564791f94

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 b78180285a46e17d9c332a913e7fbe53768e3e72b7538eaaea23fae229c1c867
MD5 b380040161181333af235e3d72fc6672
BLAKE2b-256 d8193ceb5d4cb5e05624d1c72a2c6ffe8af600c8465e3c008f9da960040c7b5c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4a08f9daba736d3978cc2cc8a098e4e62df0b390ded267bd4e3146a83f1dd45b
MD5 fabb55d7ce45f6c46918b6d32517ce00
BLAKE2b-256 ae30ee11c0ea3f57937ff5b457c0c76b47a6047b31c67a44ec17054a786f0ae4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 46b0148f78d63362dc696f52cfd536a9a7005b7c30c767be431babcd7c0bac3f
MD5 b7d547dfff59ac1fb45ee76a6fcf5427
BLAKE2b-256 22f2f74c3d7763990b06458e585e64b51a83ebffc6745431239e8ba0594aeba0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ec41d1e031c0e82c5abf2d79d678806219fa48d5a26c7348043ec636487f4540
MD5 b990b6188298546c6ecd4a9ba7a57c66
BLAKE2b-256 5ee5921cf0adbc9a6358c0a48fd1d636c0dc1b686fc172d45995d6766d9bf4f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 3feb2fbbb336933b11886799b35bfbcbbbc10c1eefa9496db581c44b92b3a245
MD5 203240db1ee1cb073f960e9a51551fda
BLAKE2b-256 1fecd4ce92c58fa7444135ce4ae431a4d1b58276d3823d2983e4deae6cc25d40

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1d9da3f4e60403198a996f04926b7743c8b7e999b75cc86c33a17ad283e4b812
MD5 d4abf6655556666926df20ac0cde6a5c
BLAKE2b-256 6cb0533d81f12749e383ea38ac73b1dd0c27dbf0eac5d4e5a5778bada1990978

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 6edf9d7a3bb551630ef281e7117c0dc742704912d84c2ec04e7619db0d7f2c08
MD5 541ec3b99838b89cf84e3cffc9ae4f8d
BLAKE2b-256 00d585a5b3ad00fe2a3aab4668b2104198161bfc98a95f2497a5ae0213e3a7af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 13a5f58b0ee68f543ac0fe3bc3d748226d58caf5c5388d5ab23d6fb32c67a3f7
MD5 5fccb915b2990ff3916c528a4200c511
BLAKE2b-256 fc3fb229d7c77334de2820e5df40c7dbfc394a082fd8ab80f64ac19e3e5f72b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.42.2-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 dac335a6cf7c8e94d16ca8c93ef4282299f6801102c31b706196af9a3581075e
MD5 8599782c6891cb7949489415d4fc85ec
BLAKE2b-256 79c037168025e8c0b8b4fa5cb6b7f7a650891ab71f1e45f34c94a5c0536cd5ba

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