Registry / serialization / tree-sitter-elixir

tree-sitter-elixir

JSON →
library0.3.5pypypi✓ verified 85d ago

Elixir grammar for tree-sitter, providing parsing, syntax highlighting, and code navigation for Elixir files. Current version 0.3.5, requires Python >=3.9. Released irregularly, tied to tree-sitter updates.

pip install tree-sitter-elixir
INSTALL
IMPORT
SIG · TREE-SITTER-ELIXIR
T
tree-sitter-elixir
serializationpythonv0.3.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Language
from tree_sitter_elixir import language
from tree_sitter_elixir import Language
The correct symbol is a function 'language()', not a class. Importing 'Language' gives the tree-sitter built-in class, not this grammar.

Basic usage: load the Elixir language, parse a source string, and print the syntax tree.

from tree_sitter import Language, Parser # Load the Elixir language as a shared object ELIXIR_LANGUAGE = Language('tree_sitter_elixir', 'elixir') # Create a parser and set the language parser = Parser() parser.set_language(ELIXIR_LANGUAGE) # Parse some Elixir code tree = parser.parse(b""" defmodule MyModule do def hello do :world end end """) print(tree.root_node.sexp())
Debug
Known issues
breakingVersion 0.3.0 changed the Rust crate dependency to tree-sitter-language instead of tree-sitter. Python package may require tree-sitter >=0.21.
fix
Ensure tree-sitter is installed at version 0.21 or later: pip install 'tree-sitter>=0.21'
affects: >=0.3.0
deprecatedThe built-in queries in 0.3.4 replaced #match? predicates with #any-of?. Custom queries using #match? may need updating.
fix
Update custom queries to use #any-of? instead of #match? when matching multiple values.
affects: >=0.3.4
gotchaThe language() function from tree_sitter_elixir is misspelled as 'language' (lowercase 'l') while the official tree-sitter Python binding uses 'Language' (uppercase). This causes confusion.
fix
Use 'from tree_sitter_elixir import language' (lowercase) and call language() to get the language object.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'tree_sitter_elixir'
Package not installed.
fix
Run: pip install tree-sitter-elixir
AttributeError: module 'tree_sitter' has no attribute 'Language'
Outdated tree-sitter version (<0.20).
fix
Upgrade tree-sitter: pip install --upgrade tree-sitter
Upgrade
Version history
0.3.5latest on PyPI · released Mar 2, 2026
Audit
Dependencies
tree-sitterrequiredCore library for parser generation and execution.
Agent activity
19 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources
tree-sitter-elixir — pip install tree-sitter-elixir · libregistry