Tree-sitter SPARQL
Python bindings for the tree-sitter SPARQL grammar.
This is based on the original repo here: https://github.com/GordianDziwis/tree-sitter-sparql - but updated to work with more recent versions of tree-sitter.
Installation
Install from source:
git clone https://github.com/yourusername/tree_sitter_sparql
cd tree_sitter_sparql
pip install .
Usage (tree-sitter 0.21.0+)
If you're using tree-sitter version 0.21.0 or later:
import tree_sitter_sparql
from tree_sitter import Language, Parser
# Initialize the language
SPARQL_LANGUAGE = Language(tree_sitter_sparql.language())
# Create parser
parser = Parser(SPARQL_LANGUAGE)
# Parse SPARQL query
query = b"""
SELECT ?subject ?predicate ?object
WHERE {
?subject ?predicate ?object .
}
LIMIT 10
"""
tree = parser.parse(query)
# Walk the syntax tree
cursor = tree.walk()
def walk_tree(cursor, depth=0):
node = cursor.node
print(" " * depth + f"{node.type}: {node.text.decode('utf8')[:50]}")
if cursor.goto_first_child():
walk_tree(cursor, depth + 1)
cursor.goto_parent()
if cursor.goto_next_sibling():
walk_tree(cursor, depth)
walk_tree(cursor)
Requirements
- Python 3.8+
- tree-sitter
Development
To build from source:
# Install in development mode
pip install -e .
# Run tests (if available)
pytest
License
MIT
Metadata
Release files for tree-sitter-sparql 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| tree_sitter_sparql-0.1.0.tar.gz | 103.9 kB | Without provenance | Details |
Built distributions (wheels)
Total release size: 1.3 MB
Release files / tree_sitter_sparql-0.1.0.tar.gz
| Download URL | tree_sitter_sparql-0.1.0.tar.gz |
|---|---|
| Size | 103.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ab96caa8b123661d81f53fe6491a1ba631b4a9b8e2171cb07d58bc3c72d44e91
|
|
BLAKE2b-256 checksum How to use checksums |
6f9e9122d41adb037ea0d08c580264d608b16e26abd01bf94536c673b342d67c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / tree_sitter_sparql-0.1.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
| Download URL | tree_sitter_sparql-0.1.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 97.0 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
bf55f69fb87d627db847d44d7e780282a3963fc859220f9df8e66206bca752b5
|
|
BLAKE2b-256 checksum How to use checksums |
8834d94508de6fd496de99a5abe37c80d358e6c4d99a541545f98017101bf2f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / tree_sitter_sparql-0.1.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | tree_sitter_sparql-0.1.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 92.5 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
3e3a5e1b0bf711a3a13620ca7eeb1d252813c40ef10decc1ffae4ce793b5e58c
|
|
BLAKE2b-256 checksum How to use checksums |
57f9b30fdc35d20103ebff26ece0b365ca0809256396d1f97d857226604df499
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / tree_sitter_sparql-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | tree_sitter_sparql-0.1.0-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 49.5 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
9e2fc6530ca28330587e224ca3c535b09611be600257ab0426a10e8c28ec7d4a
|
|
BLAKE2b-256 checksum How to use checksums |
5fac2e8caa3b716433eed7d65dbe833af53da0527fae2b39be00f4ff3c0178a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / tree_sitter_sparql-0.1.0-cp312-cp312-macosx_10_9_x86_64.whl
| Download URL | tree_sitter_sparql-0.1.0-cp312-cp312-macosx_10_9_x86_64.whl |
|---|---|
| Size | 48.5 kB |
| Tags | CPython 3.12 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
9566a809d9073aec1cf734fd7b3481b7d18524cde21f64c1c491c8419c5d78d1
|
|
BLAKE2b-256 checksum How to use checksums |
6219b28f45eb1a10d5bbe093716e02bf341618ffa36dc3d3f19f0e4eddd7460c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / tree_sitter_sparql-0.1.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
| Download URL | tree_sitter_sparql-0.1.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 98.5 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
2d8706c82667c5396f01edb01d5bfa7872b37f47d20f25ff2fb15a7d078ba877
|
|
BLAKE2b-256 checksum How to use checksums |
838e7c4819ef8ed0f629a4862b1533c4e6930a48207e31aef5fcb2db08e2c930
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / tree_sitter_sparql-0.1.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | tree_sitter_sparql-0.1.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 96.3 kB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
cd4b89e566a4864c248e7cf77877009a16ead99c92f7acfa07fe8233679f2f24
|
|
BLAKE2b-256 checksum How to use checksums |
07807be01317c592f48c829aa0d3b4bdf8d1aada1982f3f38dd570cdcd0e767d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / tree_sitter_sparql-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | tree_sitter_sparql-0.1.0-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 49.5 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
0383eb5e0f8c1cf880d15ecefe4a63cf6676560af70bfb626891f26acb222888
|
|
BLAKE2b-256 checksum How to use checksums |
dc85a3fb09ec3fe7dbb83eac73cf3b5e9e7219d6403ba12cc8abaa69c135504c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / tree_sitter_sparql-0.1.0-cp311-cp311-macosx_10_9_x86_64.whl
| Download URL | tree_sitter_sparql-0.1.0-cp311-cp311-macosx_10_9_x86_64.whl |
|---|---|
| Size | 48.5 kB |
| Tags | CPython 3.11 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
3da9b0a474908f3b226354cfe8f5e7aa385e65f55b0d8351f368bb0edaeced22
|
|
BLAKE2b-256 checksum How to use checksums |
a5134c195bad25e6f79739b6586c215e8f694cbdae85faa3128259276ca212a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / tree_sitter_sparql-0.1.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
| Download URL | tree_sitter_sparql-0.1.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 98.5 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
4744ad72a9382404582def7a30da8f598edf724a6f3ba1f23e4f3d2ed5b4a60a
|
|
BLAKE2b-256 checksum How to use checksums |
0a610ebd666bb0139347e496eeaffd6661d0005d546c4089b2a45c90545a9e65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / tree_sitter_sparql-0.1.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | tree_sitter_sparql-0.1.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 96.3 kB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
609f0eb45b2123c6c95cb96675711ab284d7a9931b6e06581c665dfa5aebdfee
|
|
BLAKE2b-256 checksum How to use checksums |
a8d039830bd171e32af477f6bb6629a04d1419dfefcbd4f7af0e17d073a6e437
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / tree_sitter_sparql-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | tree_sitter_sparql-0.1.0-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 49.5 kB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
237fec9e171ba0b690518df33e643a4da2c0c58a316b4007e98e251999bfb038
|
|
BLAKE2b-256 checksum How to use checksums |
03e8bb14752a7788d2bc37a7d5ac1d42d0432bc28eecec6a516bf943b7995d25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / tree_sitter_sparql-0.1.0-cp310-cp310-macosx_10_9_x86_64.whl
| Download URL | tree_sitter_sparql-0.1.0-cp310-cp310-macosx_10_9_x86_64.whl |
|---|---|
| Size | 48.5 kB |
| Tags | CPython 3.10 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
ae07fb07ec653e2b7412fef8ccc65b99543fd7396ddc9c8182d8cfab3e82f7e0
|
|
BLAKE2b-256 checksum How to use checksums |
b6c1df3c8c06a669ad028e8a4f5caaf51997ca550eeba691a1e86ef4fcf65df2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / tree_sitter_sparql-0.1.0-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
| Download URL | tree_sitter_sparql-0.1.0-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 98.4 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
6bcb3f0ab96e0557d76ac3c3c2bc8f04036405449847c30cc87aad78fe215f3c
|
|
BLAKE2b-256 checksum How to use checksums |
16131bbf6fa4dd27eedae0624177d1f66289c91cc7be8b0ce65f4272da51d1ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / tree_sitter_sparql-0.1.0-cp39-cp39-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | tree_sitter_sparql-0.1.0-cp39-cp39-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 96.1 kB |
| Tags | CPython 3.9 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
86c22cf8ff2cd6c403e8898446043a592ab1da54e16978fc7cb8e14aa03829e1
|
|
BLAKE2b-256 checksum How to use checksums |
da90c3cda56d4ce8600cb3ee5f3abb2f33586b42e1ceef99167f573e3b6f5223
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / tree_sitter_sparql-0.1.0-cp39-cp39-macosx_11_0_arm64.whl
| Download URL | tree_sitter_sparql-0.1.0-cp39-cp39-macosx_11_0_arm64.whl |
|---|---|
| Size | 49.5 kB |
| Tags | CPython 3.9 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1173e0984291dbf5bae7842b7d316d18fa8dbe94f5be2d2bc390838e4c053fdd
|
|
BLAKE2b-256 checksum How to use checksums |
7ae1490fac5f7d8d8fad2411742a7de9d8f56fa74c0488aee8fc85c00412273b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / tree_sitter_sparql-0.1.0-cp39-cp39-macosx_10_9_x86_64.whl
| Download URL | tree_sitter_sparql-0.1.0-cp39-cp39-macosx_10_9_x86_64.whl |
|---|---|
| Size | 48.5 kB |
| Tags | CPython 3.9 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
d6ff4b9ea246f1947a97497c6c00cc33e014f02fde68128e310cb29c368e4e12
|
|
BLAKE2b-256 checksum How to use checksums |
55095e38581adb01d1a7b6c47f7b9bfc25f1aab1e95f725f439cb0997be99291
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Security for tree-sitter-sparql 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.