Skip to main content

TSQuery

Run Tree Sitter queries from the command line.

Installation

pip install tsquery

Usage

Parsers (.so files) should be installed somewhere in $XDG_DATA_HOME or $XDG_DATA_DIRS. Use the official Tree Sitter CLI tool to compile a grammar to parser source.

For example, this command prints the names of functions defined in a toy Python program:

# Write a toy Python program
cat > example.py <<EOF
def baz():
    return 1

def foo(bar):
    if bar:
        baz()
EOF

# Run a query against it
tsquery '(function_definition name: (identifier) @func.name)' example.py

See also example.sh in this repository.

Metadata

Release files for tsquery 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tsquery 0.1.1
File Size Uploaded
tsquery-0.1.1.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tsquery 0.1.1
File Interpreter ABI Platform
tsquery-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 25.8 kB

Release files / tsquery-0.1.1.tar.gz

Download URL tsquery-0.1.1.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d9e8fda8744d12be39475ebd2138201e4c6428dc586624e70cd726ec7d9d2bfe
BLAKE2b-256 checksum
How to use checksums
3bc001b831ac80d4ca3c408a3fc86c8d614db3f4d661a057d84272e8363fe966
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0

Release files / tsquery-0.1.1-py3-none-any.whl

Download URL tsquery-0.1.1-py3-none-any.whl
Size 19.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
009cad8516357551df89e283b43a26625cf5ad718a56eb2fdb8fe565074afeb8
BLAKE2b-256 checksum
How to use checksums
61348c7c233301295fa1ff2f8a64f0ed1b2528afca10da9aa767112bc7eb35e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page