types-tree-sitter-languages
raw JSON → 1.10.0.20250530 verified Mon Apr 27 auth: no python
PEP 561 stub-only package providing type annotations for tree-sitter-languages, enabling type-checking of grammar definitions and language bindings. As of version 1.10.0.20250530, it supports Python >=3.9 and is maintained by the typeshed project. Releases track tree-sitter-languages versions with a date suffix for stub updates.
pip install types-tree-sitter-languages Common errors
error ImportError: cannot import name 'Language' from 'tree_sitter_languages' ↓
cause The Language class is not directly importable in newer versions of tree-sitter-languages; use get_language and get_parser functions.
fix
Use 'from tree_sitter_languages import get_language, get_parser'.
error ModuleNotFoundError: No module named 'tree_sitter_languages' ↓
cause The runtime package tree-sitter-languages is not installed.
fix
pip install tree-sitter-languages
Warnings
gotcha Stub package only provides type hints; you must install tree-sitter-languages separately for runtime use. ↓
fix pip install tree-sitter-languages
deprecated The 'Language' class import path was deprecated in favor of direct use according to typeshed updates; the correct way is to use get_language and get_parser functions. ↓
fix Use 'from tree_sitter_languages import get_language, get_parser' instead.
Imports
- Language
from tree_sitter_languages import Language - get_parser
from tree_sitter_languages import get_parser - get_language
from tree_sitter_languages import get_language
Quickstart
from tree_sitter_languages import get_language, get_parser
language = get_language('python')
parser = get_parser('python')
tree = parser.parse(bytes('print(1)', 'utf8'))
print(tree.root_node.child(0).type) # expression_statement