{"id":27031,"library":"gritql","title":"GritQL","description":"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.","status":"active","version":"0.2.0","language":"python","source_language":"en","source_url":"https://github.com/getgrit/gritql","tags":["code-search","codemod","pattern-matching","AST"],"install":[{"cmd":"pip install gritql","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"wrong":"from gritql import GritQuery","symbol":"GritQuery","correct":"import gritql"}],"quickstart":{"code":"from gritql import GritQuery\n\n# Compile a simple query\nquery = GritQuery('`console.log`')\n\n# Run against a code snippet (returns True if matched)\nresult = query.run('console.log(\"hello\")')\nprint(result)  # True\n\n# With file path\nresult = query.run('console.log(\"hello\")', path='test.js')\nprint(result)  # True\n","lang":"python","description":"Basic usage: compile a GritQL pattern and run it against a string or file."},"warnings":[{"fix":"Pin to exact version: `pip install gritql==0.2.0`. Check changelog before upgrading.","message":"API instability: The Python API is still experimental (0.x) and may change without notice. Expect breaking changes in minor versions.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"If you need match metadata, consider using the GritQL CLI tool directly with subprocess.","message":"Query 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.","severity":"gotcha","affected_versions":"all"},{"fix":"Install the GritQL CLI: `curl -fsSL https://docs.grit.io/install | bash` or download from GitHub releases.","message":"Requires 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`.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'0.2.0':24 'activ':29 'ast':38 'bind':17 'code':11,32 'code-search':31 'codemod':34 'develop':30 'experiment':26 'gritql':1,2,13,20 'languag':6 'match':37 'packag':14 'pattern':36 'pattern-match':35 'programmat':22 'provid':15 'python':16 'queri':5,21 'run':19 'search':8,33 'transform':10 'version':23","created_at":"2026-05-01T17:44:09.728850+00:00","updated_at":"2026-05-01T17:44:09.728850+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"grit","cli_version":"sh: 1: grit: not found","type":"library","homepage":"https://docs.grit.io","github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/gritql/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-08-02","install_tag":null}}