Install & Compatibility
Where this runs
tested against v1.5.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.024s · 18MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.5s · import 0.018s · 19MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Grammar
✓ from pyleri import Grammar
Always import directly from pyleri.
Define a simple grammar and parse a string.
from pyleri import Grammar, Sequence, Keyword, Regex
# Define grammar elements
class MyGrammar(Grammar):
r = Sequence(
Keyword('hello'),
Regex(r'[a-zA-Z0-9]+')
)
grammar = MyGrammar()
result = grammar.parse('hello world')
if result.is_valid:
print('Parse succeeded!')
else:
print(f'Parse error: {result.as_str(line_number=True)}')
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pyleri'
pyleri is not installed or imported incorrectly.
fixRun 'pip install pyleri' and use 'from pyleri import ...'.
AttributeError: 'Result' object has no attribute 'as_string'
Typo: use 'as_str' (without 'ing').
fixReplace result.as_string() with result.as_str().
pyleri.errors.ParseError: Expecting ... got ...
Input does not match grammar. Check your input or grammar definition.
fixUse result.as_str(line_number=True) to get a detailed error message.
Upgrade
Version history
1.5.0latest on PyPI · released Nov 15, 2025
Audit
Dependencies
No dependency data recorded yet.