Skip to main content

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.

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

  1. Clone the repo
  2. Install the system dependencies
  3. Install the full dependencies with uv sync --no-install-project
  4. Install the pre-commit hooks with:
    pre-commit install && pre-commit install --hook-type commit-msg
    
  5. Clone the vendors with uv run --no-sync scripts/clone_vendors.py
  6. 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:

  1. Install the bindings with uv add <bindings_package_name> --no-install-project.
  2. Execute the cloning script with uv run --no-sync scripts/clone_vendors.py.
  3. Update both the literal type InstalledBindings and the installed_bindings_map dictionary in the __init .py _ file.
  4. Update the code in the init file as necessary.
  5. Build the bindings by executing: uv run --no-sync setup.py build_ext --inplace.
  6. Execute the tests (see above).
  7. If the tests pass, commit your changes and open a pull request.

Adding a Binary Wheel Language

  1. 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
      },
    }
    
    • repo is the URL of the tree-sitter repository. This value is mandatory
    • branch the branch of the repository to checkout. 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 an 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 build in the repository.
  2. Update the SupportedLanguage literal type in the init.py file.
  3. Install the dev dependencies with uv sync --no-install-project -v
  4. Execute the cloning script with uv run --no-sync scripts/clone_vendors.py.
  5. Build the bindings by executing: PROJECT_ROOT=. uv run setup.py build_ext --inplace.
  6. Execute the tests (see above).
  7. If the tests pass, commit your changes and open a pull request.

Metadata

Release files for dom-tree-sitter-language-pack 0.4.0

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

Source distribution (sdist)

Source distribution for dom-tree-sitter-language-pack 0.4.0
File Size Uploaded
dom_tree_sitter_language_pack-0.4.0.tar.gz 17.3 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for dom-tree-sitter-language-pack 0.4.0
File Interpreter ABI Platform
dom_tree_sitter_language_pack-0.4.0-cp39-abi3-macosx_14_0_arm64.whl CPython 3.9 abi3 macOS 14.0+ ARM64 Details
dom_tree_sitter_language_pack-0.4.0-cp39-abi3-macosx_10_16_universal2.whl CPython 3.9 abi3 macOS 10.16+ universal2 (ARM64, x86-64) Details

Total release size: 26.8 MB

Release files / dom_tree_sitter_language_pack-0.4.0.tar.gz

Download URL dom_tree_sitter_language_pack-0.4.0.tar.gz
Size 17.3 MB
Tags Source
SHA-256 checksum
How to use checksums
99df898a5a1062f72d8f6d3b413b32ec296eebed0fa2b31848f0006dab010b2a
BLAKE2b-256 checksum
How to use checksums
438f3c18eed5c05a36440a38d3663f866b113867c1de6f3b4d986d3a211f2281
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.4

Release files / dom_tree_sitter_language_pack-0.4.0-cp39-abi3-macosx_14_0_arm64.whl

Download URL dom_tree_sitter_language_pack-0.4.0-cp39-abi3-macosx_14_0_arm64.whl
Size 4.8 MB
Tags CPython 3.9 abi3 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
36e0bd4bd4d51ece5877a26f64b181dae6e319c4085a558a81b94d70afa9d81e
BLAKE2b-256 checksum
How to use checksums
6501597a3d553c2071d90e4ceeb76bf4fce0f54e6f6c35ccbe82be2afcbdaffb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.4

Release files / dom_tree_sitter_language_pack-0.4.0-cp39-abi3-macosx_10_16_universal2.whl

Download URL dom_tree_sitter_language_pack-0.4.0-cp39-abi3-macosx_10_16_universal2.whl
Size 4.8 MB
Tags CPython 3.9 abi3 macOS 10.16+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
29638fe2c7df1d264abb38632e41e5a0da0b7ea5e927d78f5b332533eb672af0
BLAKE2b-256 checksum
How to use checksums
c53c1af8e27cf8405ba438424654856993a9eea659957e653e26f5ebf5f4938e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.4.0 This release

3 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