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.40.5.tar.gz (137.9 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.40.5-cp314-cp314-win_amd64.whl (4.8 MB view details)

Uploaded CPython 3.14Windows x86-64

ast_grep_py-0.40.5-cp314-cp314-win32.whl (4.6 MB view details)

Uploaded CPython 3.14Windows x86

ast_grep_py-0.40.5-cp314-cp314-manylinux_2_28_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

ast_grep_py-0.40.5-cp314-cp314-manylinux_2_28_aarch64.whl (4.9 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

ast_grep_py-0.40.5-cp314-cp314-macosx_11_0_arm64.whl (5.1 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

ast_grep_py-0.40.5-cp314-cp314-macosx_10_12_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

ast_grep_py-0.40.5-cp313-cp313-win_amd64.whl (4.8 MB view details)

Uploaded CPython 3.13Windows x86-64

ast_grep_py-0.40.5-cp313-cp313-win32.whl (4.6 MB view details)

Uploaded CPython 3.13Windows x86

ast_grep_py-0.40.5-cp313-cp313-manylinux_2_28_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

ast_grep_py-0.40.5-cp313-cp313-manylinux_2_28_aarch64.whl (4.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

ast_grep_py-0.40.5-cp313-cp313-macosx_11_0_arm64.whl (5.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

ast_grep_py-0.40.5-cp313-cp313-macosx_10_12_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

ast_grep_py-0.40.5-cp312-cp312-win_amd64.whl (4.8 MB view details)

Uploaded CPython 3.12Windows x86-64

ast_grep_py-0.40.5-cp312-cp312-win32.whl (4.6 MB view details)

Uploaded CPython 3.12Windows x86

ast_grep_py-0.40.5-cp312-cp312-manylinux_2_28_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

ast_grep_py-0.40.5-cp312-cp312-manylinux_2_28_aarch64.whl (4.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

ast_grep_py-0.40.5-cp312-cp312-macosx_11_0_arm64.whl (5.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

ast_grep_py-0.40.5-cp312-cp312-macosx_10_12_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

ast_grep_py-0.40.5-cp311-cp311-win_amd64.whl (4.8 MB view details)

Uploaded CPython 3.11Windows x86-64

ast_grep_py-0.40.5-cp311-cp311-win32.whl (4.6 MB view details)

Uploaded CPython 3.11Windows x86

ast_grep_py-0.40.5-cp311-cp311-manylinux_2_28_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

ast_grep_py-0.40.5-cp311-cp311-manylinux_2_28_aarch64.whl (4.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

ast_grep_py-0.40.5-cp311-cp311-macosx_11_0_arm64.whl (5.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

ast_grep_py-0.40.5-cp311-cp311-macosx_10_12_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

ast_grep_py-0.40.5-cp310-cp310-win_amd64.whl (4.8 MB view details)

Uploaded CPython 3.10Windows x86-64

ast_grep_py-0.40.5-cp310-cp310-win32.whl (4.6 MB view details)

Uploaded CPython 3.10Windows x86

ast_grep_py-0.40.5-cp310-cp310-manylinux_2_28_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

ast_grep_py-0.40.5-cp310-cp310-manylinux_2_28_aarch64.whl (4.9 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

File details

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

File metadata

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

File hashes

Hashes for ast_grep_py-0.40.5.tar.gz
Algorithm Hash digest
SHA256 53a0d027cf56079e2e39a62aa36e60c50e015c5b2ee2e74e7188983692c1d8c2
MD5 7b058888865acd43e558ef0e5516c5be
BLAKE2b-256 417dc5668b8268cb95581f499122130025577aafdf2510390e81fc9bc81f459a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 9356b086234aa0a7d93a52488e970be15dc34620e066bc30477dd24a7d0a6508
MD5 421ea6e9e4bb80e54e0b223e5cdd6622
BLAKE2b-256 60bfccb7bde131c0abc82989c3367536b41be613eff4d3123ccf63ecee90fe69

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 8e36cc025f1c87f9973ff86771dd3e1979230df8465ad04f048711fffdc48347
MD5 5145679d09093371d0e3c351b6117cb1
BLAKE2b-256 777ef50766f5112be74a4a20bd164137c6c5498e10b62e2ec6d51f533c791ff5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1a3cf2f3b51b3672346c969b190af82da5207b914f55d510066bf9441d456e58
MD5 ef8dc61921115e5d53f7c5fb35529cad
BLAKE2b-256 8cd70283182335a54e16052b5bb23ebbdabf26edc57d8936de70cd0941c20585

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 64075f5eb8be8c980378bd77b4481d289110b1f748e0508e555498a2742aa87e
MD5 373034afc25d2180eb20f312abd671cb
BLAKE2b-256 12c26ee2e13c746977fb42c6d734e7ce6a0a11304cd8699bde9b6bd716f17dfe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8b7713473fb653215142d01d07e5ff5f40f80ccbf83ef208125d5ddfec30ca14
MD5 4f661c4f30bf00b2eb0a3b5b4afd9298
BLAKE2b-256 d6fd5205a7944056044bbe9e81a06e633b30e7e6b32b12c77d4f08a250907e53

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 19b5d95dd2c86bb59903eee5ca7863dd7799abb50d7c11c592b2549c320db5b1
MD5 4fc543cff1fc5184b4ff9b36e7849246
BLAKE2b-256 5315c1194d7683561103811e846d8af66c904a7422836c7cdcd8090e82d65e2b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 48a0b909d280430bdec5361b6063c311ab4400cc80d12cb985cfd74011982db2
MD5 e49ee60faafe371fa1b336d310ae5e09
BLAKE2b-256 b05a85b96dc4bad0ad2a4f76a6bc19d7ed799551f9bfb6568f764a0162226a1b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 a290bcbd460eb72364d784120cea966b7590c3ae842bddb7e1b512a3df241948
MD5 77af5cf723ccef55b894bcccb2fc5d9b
BLAKE2b-256 5ceb7d3d77770ae80a28eafebadcbedefeb55bee73862a81745843ed8d3cee09

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e37d10a741b16f4b205e8f290295a1460330b97f813b1b4ae9618c52b895bd81
MD5 ed639889143b23e04d7d96339385d2ad
BLAKE2b-256 9c7ab368be17d41bb0a1fcc73b13a2685b04a419fb55c3f59fcc3b9d32d73a78

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e2f52088caa7e25f3af44d804ad1fdadb46419d6e5e54fbc80207d0508bb2781
MD5 20650ce67f2967582f3a9bbf5aac5568
BLAKE2b-256 699e5a48fad1b2981ef878d60291172f39d46b4d4fc8f57b8e61c844c4e0cca8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 15651095191e3a34826569a2f9b36a24cc0711134d4d54fd22e5a639ab4630ee
MD5 8cda5d38bfc8804e12cc15c12c82def4
BLAKE2b-256 8c1b24c8fc07d3f86caa1e1dab09126a4e17df2f88489beb5ec560b755065851

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 409dcd1ff0a844b284784f6b7687054a203d075b105a4e6567715e937daeb55d
MD5 75769f05dc2712ffae712193750330cf
BLAKE2b-256 e022fd470921cef0aa024ed6a3b6b209e613cf50ce550e386b69c57adb78bf1f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2374750b655bcefe292d51664d9f1faff0892f4df0e8c8059936fc85539e8890
MD5 55f22eaba4c41643e0cdefd93cbdf1b6
BLAKE2b-256 c3dccc0eaa37e14bbb1787cd55aa31363bfc3ea1d958465d9604dd2909124c18

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 e059cea2dc1334c38856ee0bbf7d974a23d6da9df3c994db74b9c062d098c8c5
MD5 8ee749f83ea3915d7e9f32e343fbb4ae
BLAKE2b-256 0c1829cc7dab19948da7d3b5a186e717952265470ebc1411226bd681271f9a1d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4e9c287180d4cb89030a41e60bbf325c3a7b72b2fe1cb29a0e5c69b163a3dfa2
MD5 faa98ad873f4f3f4db77f210b877f0ad
BLAKE2b-256 1c5a70d542acb16c8d7b137fe89c6588e9af9d06f8bb217275d1e35d7df2e6fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 36d7ac0c8871414b6c29a0bb59f06fcebd161b1e62df4eb8553b16d6f66c0343
MD5 5bcd0a47353dd5cb7350e3c812f50cbd
BLAKE2b-256 d0ee4d66aea777a816bc54777849385976a609ccfedbc9c2e4e08f35e7895378

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0bc1c23be092555c6b004a981d21b8c80f5771f7958d10bf0c5a7765052b3d65
MD5 7b40f1cb60414cd739bc45514be1bfa0
BLAKE2b-256 b28fee4de8e9a09e90a1ff9ca47791990a3dababd284433979112f10b8e02ddf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0845da931694591fd7e5dc9a7d869d5d24f0a8a98942e39314925b89c5240ec7
MD5 69c0c852a666875c52659bd1a9a32bf3
BLAKE2b-256 93c289c2493c9b0b33b26fd197d6044e2a973f3cf7096ceb33327512f07fe913

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 65af7286a9edf3e673f10882fce8dbc953f1b2dfe9aecd9b617e892bfb4e4792
MD5 3f08353c68e43099a785cd0a635f682d
BLAKE2b-256 f3561224af558caa7b091400b67a7eb619ef168f6ae257fba0ebcf1485543250

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 eb070408381860d520131d86fac550928887dfbbe7d92909279262d1ce94f33c
MD5 ff25534c180246b9fcb1f90824097c71
BLAKE2b-256 52980c5e1b4b2aa2b4362b4fd6caa5b1ca02d103a4ce97ad8dcd6628e202de7a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4a88ae3126782acda3b3308677f95cc6b6620f5f284e2c0cdca44e5d6399afde
MD5 6f621e0665e54e2007032b8c38f215b3
BLAKE2b-256 d3b4f2eae321f7fd7352572fc82afba853afc170d1f16bff16906897f0a3f8a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4633ec56fa785d0bcfea067891c178063ef397d6ac3b3c3e17e7fad7ef498ea7
MD5 a2f54430c1d502bb9de7314333029c07
BLAKE2b-256 1e9f7d12109d7f7aedd72d3f39130fe0b84d46c4b5679ed1de7e2e1fcac08be4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d3894c89a66307d1a4e37dc99c6fd75403faa092f89c4bfd0d4367d5b6084870
MD5 d9e46966136548ab8f1d65d02bd7d815
BLAKE2b-256 f86b86ce2fa2084e14452d089b7a4289475d1b51eb543a2087bea7e8e61fb91d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d2d79e51f74ca75836e114f6a36ae35622cc5a91e4520afcb2b51f9adcf239da
MD5 15cb61676b780cd73defedf9cad66d2a
BLAKE2b-256 e26dc92bca08ffa554a7ff009657dfa41d59843b41316adcb221c3d398518580

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4eb01fc4535ad80a938f6fe4a43d47d17a17e89277df312599e45e6f7ce785f4
MD5 74d67a7d25b261109dd97acc2c074c38
BLAKE2b-256 eb440fa7c6dfbb1a2a2cb12b13110d5f59340a8daaa3a4d2b035ba0c06719334

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 162d307d2891834eb47b43197073e5ffc10a38b5bee24d61a097a3263a481696
MD5 22b29a69e0927b56abd687ef02f356c6
BLAKE2b-256 27602547601d69cae9d1840b18d54ca1c37b879579e6f54e26ef35d92f3f5f22

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6bbee183abc334b782a38bd3292b0a23604dcbcee015d9483597bfe0c921dd45
MD5 19a9c5b789693fe061c183313123eebf
BLAKE2b-256 23c98a6fb58a38f7fe0270d862985838ee3e0680a3734ffa81ac8804c4ab910e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ast_grep_py-0.40.5-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ad91fd8703d7517f8fc04abdb1e93abbaa0cea6df1591d85bf2ee7cf0661bf0d
MD5 8996a3d5369b60c925ebc0a8c275ac11
BLAKE2b-256 49e11c7d6c50d096bac16ff9aa7c9573cb19e0ff6f9795d53a3c0f5f971e8061

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