tree-sitter-python
Python grammar for tree-sitter
Decision gist · record as of 2026-08-14
Yes, if you need incremental parsing of Python code or are building tools that work with tree-sitter. The package is permissively licensed, has no dependencies, and ships with precompiled binaries for most platforms. However, the last release was 337 days ago—verify that the grammar version meets your Python syntax requirements before committing to it in production.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- Medium install friction due to precompiled binary wheels across multiple platforms.
- No runtime dependencies.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution with minimal attribution requirements.
last release 2025-09-11 (337 days) · last repo commit 2025-09-15 · 561 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 9,640,716 downloads/mo, #1,515 on PyPI
Alternatives
Verify before relying
pip install tree-sitter-python
import tree_sitter_python
# Use with tree-sitter parser to analyze Python code- Whether the grammar covers all Python 3 syntax features or has known limitations.
- Performance characteristics compared to standard parsing approaches for typical workloads.
- Whether incremental parsing updates are efficient for large files or repeated edits.
What it is and what it does
tree-sitter-python is a language grammar binding that integrates Python syntax parsing into the tree-sitter incremental parser framework. It allows you to build and query abstract syntax trees for Python code with support for incremental updates—useful when you need to re-parse only the parts of a file that changed rather than the entire file each time.
The package requires Python 3.10 or later and ships as precompiled binaries for common platforms (macOS, Linux, Windows, including ARM variants). It has no runtime dependencies. It's typically used in code analysis tools, linters, IDE plugins, or any system that needs to parse Python source code and work with its syntactic structure.
Use it for
- Build a code linter or formatter that needs to parse and analyze Python syntax trees incrementally.
- Implement IDE features like syntax highlighting, code completion, or refactoring that benefit from incremental parsing.
- Analyze Python codebases to extract metrics, dependencies, or structural information from the AST.
- Create a code transformation or code generation tool that manipulates Python syntax trees.
- Develop a static analysis tool that traverses Python code structure to detect patterns or violations.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need incremental parsing of Python code or are building tools that work with tree-sitter.
The package is permissively licensed, has no dependencies, and ships with precompiled binaries for most platforms. However, the last release was 337 days ago—verify that the grammar version meets your Python syntax requirements before committing to it in production.
Install
tree-sitter-python on PyPI
Before you install
Medium install friction due to precompiled binary wheels across multiple platforms. No runtime dependencies. Last release was 337 days ago; repository is active but aging.
Requires Python 3.10 or later.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal attribution requirements.
Quickstart
pip install tree-sitter-python
import tree_sitter_python
# Use with tree-sitter parser to analyze Python code
Verify before relying
- Whether the grammar covers all Python 3 syntax features or has known limitations.
- Performance characteristics compared to standard parsing approaches for typical workloads.
- Whether incremental parsing updates are efficient for large files or repeated edits.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Aging 337 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 9,640,716 / month, #1,515 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersTopic :: Software Development :: CompilersTopic :: Text Processing :: LinguisticTyping :: Typed |
Evidence: tree_sitter_python-0.25.0-cp310-abi3-macosx_10_9_x86_64.whl; tree_sitter_python-0.25.0-cp310-abi3-macosx_11_0_arm64.whl; tree_sitter_python-0.25.0-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl; tree_sitter_python-0.25.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; tree_sitter_python-0.25.0-cp310-abi3-musllinux_1_2_aarch64.whl; tree_sitter_python-0.25.0-cp310-abi3-musllinux_1_2_x86_64.whl; tree_sitter_python-0.25.0-cp310-abi3-win_amd64.whl; tree_sitter_python-0.25.0-cp310-abi3-win_arm64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
An agent finds packages by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language. Give your agent the search over MCP.
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.
Python bindings to the tree-sitter parsing library, enabling incremental parsing and syntax tree analysis for source code.
See also tree-sitter-bash · tree-sitter-cmake · tree-sitter-elixir · tree-sitter-groovy · tree-sitter-haskell · tree-sitter-java · tree-sitter-julia · tree-sitter-kotlin · tree-sitter-lua · tree-sitter-objc