Extensive Language Pack for Tree-Sitter
Project description
Tree Sitter Language Pack
This package bundles a comprehensive collection of tree-sitter languages as both source distribution and pre-built wheels.
Installation
pip install tree-sitter-language-pack
Important Notes:
- This package started life as a maintained and updated fork of tree-sitter-languages by Grant Jenks, and it incorporates code contributed by ObserverOfTime (see this PR).
- This package is MIT licensed and the original package of which this is a fork has an Apache 2.0 License. Both licenses are available in the LICENSE file.
- All languages bundled by this package are licensed under permissive open-source licenses (MIT, Apache 2.0 etc.) only - no GPL licensed languages are included.
- This library is compatible with tree-sitter v0.22.0 and above.
Features
- 100+ Languages: Support for all major programming languages and many domain-specific languages
- Pre-built Wheels: Easy installation with no compilation required
- Type-Safe: Full typing support for better IDE integration and code safety
- Zero GPL Dependencies: All bundled languages use permissive licenses (MIT, Apache 2.0, etc.)
Usage
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 an int 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.
Available Languages:
Each language below is identified by the key used to retrieve it from the get_language and get_parser functions.
- actionscript - MIT License
- ada - MIT License
- agda - MIT License
- arduino - MIT License
- asm - MIT License
- astro - MIT License
- bash - MIT License
- beancount - MIT License
- bibtex - MIT License
- bicep - MIT License
- bitbake - MIT License
- c - MIT License
- cairo - MIT License
- capnp - MIT License
- chatito - MIT License
- clarity - MIT License
- clojure - CC0 1.0 Universal License
- cmake - MIT License
- comment - MIT License
- commonlisp - MIT License
- cpon - MIT License
- cpp - MIT License
- csharp - MIT License
- css - MIT License
- csv - MIT License
- cuda - MIT License
- d - MIT License
- dart - MIT License
- dockerfile - MIT License
- doxygen - MIT License
- elisp - MIT License
- elixir - MIT License
- elm - MIT License
- embeddedtemplate - MIT License
- erlang - MIT License
- fennel - MIT License
- firrtl - Apache License 2.0
- fish - Unlicense license
- fortran - MIT License
- func - MIT License
- gdscript - MIT License
- gitattributes - MIT License
- gitcommit - WTFPL License
- gitignore - MIT License
- gleam - Apache-2.0 license
- glsl - MIT License
- gn - MIT License
- go - MIT License
- gomod - MIT License
- gosum - MIT License
- groovy - MIT License
- gstlaunch - MIT License
- hack - MIT License
- hare - MIT License
- haskell - MIT License
- haxe - MIT License
- hcl - Apache License 2.0
- heex - MIT License
- hlsl - MIT License
- html - MIT License
- hyprlang MIT License
- ispc - MIT License
- janet - BSD-3-Clause license
- java - MIT License
- javascript - MIT License
- jsdoc - MIT License
- json - MIT License
- jsonnet - MIT License
- julia - MIT License
- kconfig - MIT License
- kdl - MIT License
- kotlin - MIT License
- linkerscript - MIT License
- llvm - MIT License
- lua - MIT License
- luadoc - MIT License
- luap - MIT License
- luau - MIT License
- magik - MIT License
- make - MIT License
- markdown - MIT License
- matlab - MIT License
- mermaid - MIT License
- meson - MIT License
- ninja - MIT License
- nix - MIT License
- nqc - MIT License
- objc - MIT License
- odin - MIT License
- org - MIT License
- pascal - MIT License
- pem - MIT License
- perl - Artistic License 2.0
- pgn - BSD-2-Clause license
- php - MIT License
- po - MIT License
- pony - MIT License
- powershell - MIT License
- printf - ISC License
- prisma - MIT License
- properties - MIT License
- proto - MIT License
- psv - MIT License
- puppet - MIT License
- purescript - MIT License
- pymanifest - MIT License
- python - MIT License
- qmldir - MIT License
- query - Apache License 2.0
- r - MIT License
- racket - MIT License
- rbs - MIT License
- re2c - MIT License
- readline - MIT License
- requirements - MIT License
- ron - Apache License 2.0
- rst - MIT License
- ruby - MIT License
- rust - MIT License
- scala - MIT License
- scheme - MIT License
- scss - MIT License
- slang - MIT License
- smali - MIT License
- smithy - MIT License
- solidity - MIT License
- sparql - MIT License
- sql - MIT License
- squirrel - MIT License
- starlark - MIT License
- svelte - MIT License
- swift - MIT License
- tablegen - MIT License
- tcl - MIT License
- test - MIT License
- thrift - MIT License
- toml - MIT License
- tsv - MIT License
- twig - WTFPL License
- typescript - MIT License
- typst - MIT License
- udev - MIT License
- ungrammar - MIT License
- uxntal - MIT License
- v - MIT License
- verilog - MIT License
- vhdl - MIT License
- vim - MIT License
- vue - MIT License
- wgsl - MIT License
- xcompose - MIT License
- xml - MIT License
- yaml - MIT License
- yuck - MIT License
- zig - MIT License
Contribution
This library is open to contribution. Feel free to open issues or submit PRs. Its better to discuss issues before submitting PRs to avoid disappointment.
Local Development
- 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
Running Tests
To run the tests, execute the following command:
PROJECT_ROOT=. uv run --no-sync pytest tests
Adding a new language
Install
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:
- Install the bindings with
uv add <bindings_package_name> --no-install-project. - Execute the cloning script with
uv run --no-sync scripts/clone_vendors.py. - Update both the literal type
InstalledBindingsand theinstalled_bindings_mapdictionary in the __init .py _ file. - Update the code in the init file as necessary.
- Build the bindings by executing:
uv run --no-sync setup.py build_ext --inplace. - Execute the tests (see above).
- If the tests pass, commit your changes and open a pull request.
Adding a Binary Wheel Language
- 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/...", "branch": "master", // not mandatory "directory": "sub-dir/something", // not mandatory "generate": true, // not mandatory }, }repois the URL of the tree-sitter repository. This value is mandatorybranchthe branch of the repository to checkout. You should specify this only when the branch is not calledmain( i.e. formasteror other names, specify this).directoryis the directory under which there is ansrcfolder. This should be specified only in cases where thesrcfolder is not immediately under the root folder.generateis a flag that dictates whether thetree-sitter-cligenerate command should be executed in the given repository / directory combo. This should be specified only if the binding needs to be build in the repository.
- Update the
SupportedLanguageliteral 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dom_tree_sitter_language_pack-0.4.0.tar.gz.
File metadata
- Download URL: dom_tree_sitter_language_pack-0.4.0.tar.gz
- Upload date:
- Size: 17.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99df898a5a1062f72d8f6d3b413b32ec296eebed0fa2b31848f0006dab010b2a
|
|
| MD5 |
cfcc25774b759a7f86be630b4184bf71
|
|
| BLAKE2b-256 |
438f3c18eed5c05a36440a38d3663f866b113867c1de6f3b4d986d3a211f2281
|
File details
Details for the file dom_tree_sitter_language_pack-0.4.0-cp39-abi3-macosx_14_0_arm64.whl.
File metadata
- Download URL: dom_tree_sitter_language_pack-0.4.0-cp39-abi3-macosx_14_0_arm64.whl
- Upload date:
- Size: 4.8 MB
- Tags: CPython 3.9+, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36e0bd4bd4d51ece5877a26f64b181dae6e319c4085a558a81b94d70afa9d81e
|
|
| MD5 |
f853b4e11143f6db0615dda1f81cf76f
|
|
| BLAKE2b-256 |
6501597a3d553c2071d90e4ceeb76bf4fce0f54e6f6c35ccbe82be2afcbdaffb
|
File details
Details for the file dom_tree_sitter_language_pack-0.4.0-cp39-abi3-macosx_10_16_universal2.whl.
File metadata
- Download URL: dom_tree_sitter_language_pack-0.4.0-cp39-abi3-macosx_10_16_universal2.whl
- Upload date:
- Size: 4.8 MB
- Tags: CPython 3.9+, macOS 10.16+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29638fe2c7df1d264abb38632e41e5a0da0b7ea5e927d78f5b332533eb672af0
|
|
| MD5 |
04907f6758efab497cc87a5c23f06255
|
|
| BLAKE2b-256 |
c53c1af8e27cf8405ba438424654856993a9eea659957e653e26f5ebf5f4938e
|