Registry / devops / gritql

gritql

JSON →
library0.2.0pypypi✓ verified 79d ago

GritQL is a query language for searching and transforming code. The `gritql` package provides Python bindings to run GritQL queries programmatically. Version 0.2.0 is experimental and under active development.

pip install gritql
INSTALL
IMPORT
SIG · GRITQL
G
gritql
devopspythonv0.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GritQuery
import gritql
from gritql import GritQuery

Basic usage: compile a GritQL pattern and run it against a string or file.

from gritql import GritQuery # Compile a simple query query = GritQuery('`console.log`') # Run against a code snippet (returns True if matched) result = query.run('console.log("hello")') print(result) # True # With file path result = query.run('console.log("hello")', path='test.js') print(result) # True
grit --version
Debug
Known issues
breakingAPI instability: The Python API is still experimental (0.x) and may change without notice. Expect breaking changes in minor versions.
fix
Pin to exact version: `pip install gritql==0.2.0`. Check changelog before upgrading.
affects: <1.0.0
gotchaQuery result is boolean only: `run()` returns `True` if the pattern matched, not a match object or location info. To get detailed matches, you may need to use the CLI or Rust API.
fix
If you need match metadata, consider using the GritQL CLI tool directly with subprocess.
affects: all
gotchaRequires installed GritQL binary: The Python bindings expect a `grit` binary on PATH. Without it, import succeeds but `GritQuery()` will fail at runtime with a `FileNotFoundError`.
fix
Install the GritQL CLI: `curl -fsSL https://docs.grit.io/install | bash` or download from GitHub releases.
affects: all
Upgrade
Version history
0.2.0latest on PyPI · released Oct 26, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
gritql — pip install gritql · libregistry