tree-sitter
Python bindings to the Tree-sitter parsing library
Decision gist · record as of 2026-08-14
Yes. tree-sitter is actively maintained, has no runtime dependencies, ships pre-built wheels for all major platforms, carries a permissive license, and ranks in the top 1000 PyPI packages by downloads. It is worth installing if you need syntax tree analysis, pattern matching on code, or incremental re-parsing for editor integration.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- Language implementations must be installed separately as pre-compiled wheels.
- Medium install friction due to compiled wheels, but pre-built binaries are available for all major platforms.
License · maintenance · safety
permissive license (permissive) — Permissive license treatment allows commercial and private use without restriction.
last release 2026-06-30 (45 days) · last repo commit 2026-08-08 · 1,485 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 78,950,267 downloads/mo, #430 on PyPI
Alternatives
Verify before relying
pip install tree-sitter
from tree_sitter import Language, Parser
parser = Parser()
tree = parser.parse(b'def foo():\n pass')- Performance characteristics for parsing large files or deeply nested syntax trees
- Memory overhead compared to other parsing approaches
- How language implementations are loaded and configured after installation
What it is and what it does
tree-sitter is a Python wrapper around the tree-sitter incremental parsing library, which builds and maintains syntax trees for source code. It provides a low-level interface to parse code into abstract syntax trees, traverse those trees efficiently using cursors, and re-parse edited code incrementally without rebuilding from scratch. The library itself has no runtime dependencies and ships with pre-compiled wheels for modern Python versions on all major platforms.
You use tree-sitter by creating a Parser, configuring it with a language, and parsing source code as bytes. Once you have a tree, you can inspect nodes by type and position, walk the tree with a cursor for efficient traversal, apply pattern-matching queries to find specific syntax patterns, and re-parse edited code while preserving unchanged portions of the tree for speed.
Use it for
- Build code analysis tools that need to understand syntax structure without full compilation
- Implement incremental parsing in editors or IDEs to keep syntax trees in sync with live edits
- Search for specific syntax patterns across codebases using tree queries
- Implement linters, formatters, or refactoring tools that operate on syntax trees
- Traverse and inspect syntax trees to extract semantic information from source code
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
tree-sitter is actively maintained, has no runtime dependencies, ships pre-built wheels for all major platforms, carries a permissive license, and ranks in the top 1000 PyPI packages by downloads. It is worth installing if you need syntax tree analysis, pattern matching on code, or incremental re-parsing for editor integration.
Install
tree-sitter on PyPI
Before you install
Medium install friction due to compiled wheels, but pre-built binaries are available for all major platforms. Active maintenance with a release 45 days ago and 1485 repository stars.
Requires Python 3.10 or later. Language implementations must be installed separately as pre-compiled wheels.
License in practice
Permissive license treatment allows commercial and private use without restriction.
Quickstart
pip install tree-sitter
from tree_sitter import Language, Parser
parser = Parser()
tree = parser.parse(b'def foo():\n pass')
Verify before relying
- Performance characteristics for parsing large files or deeply nested syntax trees
- Memory overhead compared to other parsing approaches
- How language implementations are loaded and configured after installation
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 45 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 78,950,267 / month, #430 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: CProgramming Language :: PythonTopic :: Software Development :: CompilersTopic :: Text Processing :: LinguisticTyping :: Typed |
Evidence: tree_sitter-0.26.0-cp310-cp310-macosx_10_9_x86_64.whl; tree_sitter-0.26.0-cp310-cp310-macosx_11_0_arm64.whl; tree_sitter-0.26.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; tree_sitter-0.26.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; tree_sitter-0.26.0-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl; tree_sitter-0.26.0-cp310-cp310-musllinux_1_2_x86_64.whl; tree_sitter-0.26.0-cp310-cp310-win_amd64.whl; tree_sitter-0.26.0-cp310-cp310-win_arm64.whl; tree_sitter-0.26.0-cp311-cp311-macosx_10_9_x86_64.whl; tree_sitter-0.26.0-cp311-cp311-macosx_11_0_arm64.whl; tree_sitter-0.26.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; tree_sitter-0.26.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; tree_sitter-0.26.0-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl; tree_sitter-0.26.0-cp311-cp311-musllinux_1_2_x86_64.whl; tree_sitter-0.26.0-cp311-cp311-win_amd64.whl; tree_sitter-0.26.0-cp311-cp311-win_arm64.whl; tree_sitter-0.26.0-cp312-cp312-macosx_10_13_x86_64.whl; tree_sitter-0.26.0-cp312-cp312-macosx_11_0_arm64.whl; tree_sitter-0.26.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; tree_sitter-0.26.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “tree-sitter python bindings”
- tree-sitterPython bindings to the tree-sitter parsing library, enabling…
- tree-sitter-languagesProvides pre-compiled Python bindings for tree-sitter language…
- tree-sitter-objcProvides a tree-sitter grammar for parsing Objective-C code into…
Give your agent the search over MCP, or paste the wish link into any chat.
More Linguistic packages
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
tiktoken is a fast BPE tokenizer that converts text into token sequences compatible with OpenAI models, supporting multiple encoding schemes including o200k_base and model-specific encodings.
Install it if you work with OpenAI APIs or need to understand token boundaries in GPT-family models.
Detects character encoding and language in byte sequences with high accuracy, supporting 99 encodings and returning confidence scores, language tags, and MIME types.
Install it if you need to detect character encoding or language in byte data; the rewrite makes it substantially faster and more accurate than its predecessors.
Converts Unicode text to ASCII by transliterating non-ASCII characters into their closest ASCII equivalents, with no runtime dependencies.
However, if transliteration quality or ongoing maintenance matters, consider unidecode instead despite its GPL-only license.
Lark is a parsing library that builds abstract syntax trees from context-free grammars, supporting multiple parsing algorithms (Earley, LALR(1), CYK) with automatic line and column tracking.
NLTK is a Python library for natural language processing tasks including tokenization, parsing, tagging, and linguistic analysis, with built-in datasets and educational resources.
Install it if you need foundational NLP tools, linguistic datasets, or are learning the field; consider specialized libraries (spaCy, transformers) if you need…
See also tree-sitter-languages · tree-sitter-python · tree-sitter-swift · tree-sitter-cmake · tree-sitter-java · tree-sitter-go · tree-sitter-ruby · tree-sitter-groovy · tree-sitter-zig · tree-sitter-c-sharp