
Security News
NIST Under Federal Audit for NVD Processing Backlog and Delays
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
tree-sitter-language-pack
Advanced tools
This package bundles a comprehensive collection of tree-sitter languages as both source distribution and pre-built wheels.
pip install tree-sitter-language-pack
This library exposes two functions get_language
and get_parser
.
from tree_sitter_language_pack import get_binding, get_language, get_parser
python_binding = get_binding("python") # this is a pycapsule object pointing to the C binding
python_lang = get_language("python") # this is an instance of tree_sitter.Language
python_parser = get_parser("python") # this is an instance of tree_sitter.Parser
See the list of available languages below to get the name of the language you want to use.
Each language below is identified by the key used to retrieve it from the get_language
and get_parser
functions.
This library is open to contribution. Feel free to open issues or submit PRs. It's better to discuss issues before submitting PRs to avoid disappointment.
Clone the repo
Install the system dependencies
Install the full dependencies with uv sync --no-install-project
Install the pre-commit hooks with:
pre-commit install && pre-commit install --hook-type commit-msg
Clone the vendors with uv run --no-sync scripts/clone_vendors.py
Build the local extensions with PROJECT_ROOT=. uv run setup.py build_ext --inplace
The pin_vendors.py
script helps pin all language repositories to specific commit hashes, ensuring reproducible builds and stable dependencies. This script:
sources/language_definitions.json
rev
field in the language definition with the latest commit hashUsage:
# Update all languages with their latest commit hashes
uv run --no-sync scripts/pin_vendors.py
# Only update languages that don't already have a rev field
uv run --no-sync scripts/pin_vendors.py --only-missing
# Update specific languages (comma-separated list)
uv run --no-sync scripts/pin_vendors.py --languages=python,rust,go
To run the tests, execute the following command:
PROJECT_ROOT=. uv run --no-sync pytest tests
Some bindings are installed via UV and are added to the package dependencies in the pyproject.toml file.
To add an installed package follow these steps:
uv add <bindings_package_name> --no-install-project
.uv run --no-sync scripts/clone_vendors.py
.InstalledBindings
and the installed_bindings_map
dictionary in the
__init .py _ file.uv run --no-sync setup.py build_ext --inplace
.Add the language to the sources/language_definitions.json file at the repository's root. This file contains a mapping of language names to their respective repositories:
{
"name": {
"repo": "https://github.com/...",
"rev": "commit-hash", // required
"branch": "master", // not mandatory
"directory": "sub-dir/something", // not mandatory
"generate": true, // not mandatory
},
}
repo
is the URL of the tree-sitter repository. This value is mandatoryrev
specifies a specific commit hash to use when cloning. This ensures reproducible builds.branch
the branch of the repository to check out. You should specify this only when the branch is not called main
(
i.e. for master
or other names, specify this).directory
is the directory under which there is a src
folder. This should be specified only in cases where
the src
folder is not immediately under the root folder.generate
is a flag that dictates whether the tree-sitter-cli
generate command should be executed in the given
repository / directory combo. This should be specified only if the binding needs to be built in the repository.Update the SupportedLanguage
literal type in the init.py file.
Install the dev dependencies with uv sync --no-install-project -v
Execute the cloning script with uv run --no-sync scripts/clone_vendors.py
.
Build the bindings by executing: PROJECT_ROOT=. uv run setup.py build_ext --inplace
.
Execute the tests (see above).
If the tests pass, commit your changes and open a pull request.
FAQs
Extensive Language Pack for Tree-Sitter
We found that tree-sitter-language-pack demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
Research
Security News
Socket’s Threat Research Team has uncovered 60 npm packages using post-install scripts to silently exfiltrate hostnames, IP addresses, DNS servers, and user directories to a Discord-controlled endpoint.
Security News
TypeScript Native Previews offers a 10x faster Go-based compiler, now available on npm for public testing with early editor and language support.