Skip to main content

A query tool for Python abstract syntax trees

Project description

https://badge.fury.io/py/pyastgrep.svg https://github.com/spookylukey/pyastgrep/actions/workflows/tests.yml/badge.svg https://readthedocs.org/projects/pyastgrep/badge/?version=latest

A command-line utility for grepping Python files using XPath syntax (or CSS selectors) against the Python AST (Abstract Syntax Tree).

In other words, this allows you to search Python code against specific syntax elements (function definitions, arguments, assignments, variables etc), instead of grepping for string matches.

The interface and behaviour is designed to match grep and ripgrep as far as it makes sense to do so.

See the documentation for more information, or the docs folder.

History

This project was forked from https://github.com/hchasestevens/astpath by H. Chase Stevens. Main changes:

  • Added a test suite

  • Many bugs fixed

  • Significant rewrite of parts of code

  • Changes to match grep/ripgrep, including formatting and automatic filtering.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyastgrep-1.3.2.tar.gz (27.7 kB view details)

Uploaded Source

Built Distribution

pyastgrep-1.3.2-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file pyastgrep-1.3.2.tar.gz.

File metadata

  • Download URL: pyastgrep-1.3.2.tar.gz
  • Upload date:
  • Size: 27.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for pyastgrep-1.3.2.tar.gz
Algorithm Hash digest
SHA256 1eece34aff30842bf0b1225489a80d325c33bfa14f18612f495780d711c13ab7
MD5 00b4610003c55e4fadb5e30e5ce2bc20
BLAKE2b-256 f97fbe447fc8c3b468ca545a24f732a75178afdcc136c966ba5cb0e3883a556c

See more details on using hashes here.

File details

Details for the file pyastgrep-1.3.2-py3-none-any.whl.

File metadata

  • Download URL: pyastgrep-1.3.2-py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for pyastgrep-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e5498674adfd7740e3e85db790101117f5f4e1194ceafd44c7922f5aed9138ac
MD5 ebd4c64b6199b4a4a4d55768ff91babd
BLAKE2b-256 b62606c3a518d9d548c8165ded469ab4dddcdced072a699eb0e2cf68f2a09fdf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page