$npx skillfedfor your agent

grep-ast

A tool to grep through the AST of a source file

With conditionsPyPI Software DevelopmentReleased May 20251.8M downloads / mopermissive licensePure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — grep_ast-0.9.0-py3-none-any.whl
v0.9.0 · released 2025-05-08 · 2 runtime deps: tree-sitter-language-pack, pathspec

Yes, if you work with source code search and want to understand context. Low install friction and permissive license make it a low-risk addition. Aging maintenance (463 days since last release) is a minor concern but the repository is active and has reasonable adoption. No known vulnerabilities. Install if you need AST-aware code search; skip if you only need simple text grep.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Low install friction; pure Python wheel.
  • Maintenance status is aging—last release was 463 days ago—but the repository is active and not archived, with 362 stars.

License · maintenance · safety

permissive license (permissive) — Licensed under Apache Software License (permissive), so you can use, modify, and distribute the package freely with minimal restrictions.

last release 2025-05-08 (463 days) · last repo commit 2025-05-08 · 362 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,768,321 downloads/mo, #3,574 on PyPI

Verify before relying

pip install grep-ast

grep-ast 'pattern' /path/to/code
# or with options:
grep-ast -i --color 'pattern' src/
  • Whether Python version support is truly unspecified or if there is a practical minimum version requirement
  • How well the tool handles very large codebases or deeply nested syntax trees
  • Whether the .gitignore-respecting behavior works correctly across all supported operating systems
Same gist for agents: .md · .json

What it is and what it does

grep-ast is a command-line search tool that finds patterns in source code and displays matching lines along with their syntactic context—the enclosing functions, classes, loops, and other code blocks they belong to. It uses tree-sitter to parse code into an abstract syntax tree, then shows you not just the match but how it fits into the broader structure of the file. This is useful when you need to understand not just where a pattern appears, but what code context surrounds it.

The tool respects .gitignore by default and recurses through directories, so you can run it from a repository root without specifying files. It supports many popular programming languages via tree-sitter-language-pack and can be invoked as either `grep-ast` or `gast`. It offers basic options like case-insensitive matching, color control, and encoding specification.

Use it for

  • Find all uses of a function name and see which functions or classes call it and in what context
  • Search for a variable name and understand the scope and surrounding logic where it appears
  • Locate a specific pattern across a codebase and see the class or method definitions that contain each match
  • Explore a large unfamiliar codebase by searching for key terms and seeing their structural context
  • Refactor code by finding all occurrences of a pattern and understanding their relationships to surrounding code

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you work with source code search and want to understand context.

Low install friction and permissive license make it a low-risk addition. Aging maintenance (463 days since last release) is a minor concern but the repository is active and has reasonable adoption. No known vulnerabilities. Install if you need AST-aware code search; skip if you only need simple text grep.

Install

grep-ast on PyPI

Before you install

Low install friction; pure Python wheel. Maintenance status is aging—last release was 463 days ago—but the repository is active and not archived, with 362 stars.

License in practice

Licensed under Apache Software License (permissive), so you can use, modify, and distribute the package freely with minimal restrictions.

Quickstart

pip install grep-ast

grep-ast 'pattern' /path/to/code
# or with options:
grep-ast -i --color 'pattern' src/

Verify before relying

  • Whether Python version support is truly unspecified or if there is a practical minimum version requirement
  • How well the tool handles very large codebases or deeply nested syntax trees
  • Whether the .gitignore-respecting behavior works correctly across all supported operating systems

Package facts

Licensepermissive license permissive
Python supportNot specified
Install frictionLow. Pure-Python wheel
Runtime dependencies
2 packages
tree-sitter-language-packpathspec
MaintenanceAging 463 days since the last release
Last repo commit
First released
Downloads1,768,321 / month, #3,574 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
License :: OSI Approved :: Apache Software License

Evidence: grep_ast-0.9.0-py3-none-any.whl

Tags

Capabilities
grep source code ast contextsearch code with syntax treefind code patterns with contextgrep-like tool for astcode search with structuresearch functions and classespattern matching in code
Topics
code-searchast-parsingcli-tool

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “grep source code ast context”

  • grep-astSearch source code files by pattern and display matching lines with…
  • jcodemunch-mcpAn MCP server that retrieves precise source code symbols and context…
  • tensor-grepA high-performance grep-compatible command-line search tool with…

Give your agent the search over MCP, or paste the wish link into any chat.

More Software Development packages

typing-extensions Worth it
PyPI · Software Development · released Jul 2026

Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.

PSF-2.0pure Python · 3.9+
1.9Bdownloads / mo
numpy Worth it
PyPI · Software Development · released Aug 2026

NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.

BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0compiled wheel · 3.12+
1.1Bdownloads / mo
fastapi Worth it
PyPI · Software Development · released Jul 2026

FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.

MITpure Python · 3.10+
568.6Mdownloads / mo
annotated-doc With conditions
PyPI · Software Development · released Jul 2026

Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.

MITpure Python · 3.9+
456.2Mdownloads / mo
typer Worth it
PyPI · Software Development · released Aug 2026

Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.

Install it if you are building CLIs in Python.

MITpure Python · 3.10+
369.3Mdownloads / mo
distlib With conditions
PyPI · Software Development · released Jun 2026

Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.

permissive licensepure Python
323.3Mdownloads / mo

See also ast-grep-cli · tensor-grep · gron · tree-sitter-zig · trailmark · ast-grep-py · ripgrep · tree-sitter-powershell · tree-sitter-julia · tree-sitter-groovy