Pyastgrep
Grep Python Abstract Syntax Trees (AST) using XPath
Install / Use
/learn @spookylukey/PyastgrepREADME
pyastgrep
|badge_fury| |badge_tests| |badge_rtd|
.. |badge_fury| image:: https://badge.fury.io/py/pyastgrep.svg :target: https://badge.fury.io/py/pyastgrep
.. |badge_tests| image:: https://github.com/spookylukey/pyastgrep/actions/workflows/tests.yml/badge.svg :target: https://github.com/spookylukey/pyastgrep/actions/workflows/tests.yml
.. |badge_rtd| image:: https://readthedocs.org/projects/pyastgrep/badge/?version=latest :target: https://pyastgrep.readthedocs.org/en/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 <https://pyastgrep.readthedocs.io/>_ for more
information, or the docs folder.
History
This project was forked from https://github.com/hchasestevens/astpath by H. Chase Stevens <http://www.chasestevens.com>__. 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.
Related Skills
node-connect
349.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
claude-opus-4-5-migration
109.4kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
frontend-design
109.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
model-usage
349.0kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
