--- id: tree-sitter-python version: "0.25.0" license: MIT license_treatment: permissive maintenance: aging --- # tree-sitter-python — Python grammar for tree-sitter License: permissive · Maintenance: aging · Downloads: 9.6M/mo ## 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 above — verify before relying. Provides a Python grammar for tree-sitter, enabling incremental parsing and syntax tree analysis of Python code. 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 pip install tree-sitter-python uv add tree-sitter-python poetry add tree-sitter-python ## Installing tree-sitter-python 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. 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 Requires Python 3.10 or later. 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_current - Install friction: medium - Maintenance: aging - Downloads: 9.6M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags python parser tree-sitter, incremental parsing python, syntax tree analysis, python grammar parser, code parsing tree-sitter, ast generation python, python language grammar, parsing, syntax-analysis, incremental-parsing [View on SkillFed](https://skillfed.io/packages/tree-sitter-python) · [View on PyPI](https://pypi.org/project/tree-sitter-python/)