Registry / serialization / pyleri

pyleri

JSON →
library1.5.0pypypi✓ verified 86d ago

A Python Left-Right Parser (LL(k) parser) designed for easy grammar definition and parsing. Version 1.5.0 adds typing and drops Python 3.7/3.8 support. Release cadence is irregular, with occasional patch releases.

pip install pyleri
INSTALL
IMPORT
SIG · PYLERI
P
pyleri
serializationpythonv1.5.0
Install
1.5s avg
Import
21ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.024s · 18MB
glibc
py 3.103.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)}')
Debug
Known issues
breakingDropped support for Python 3.7 and 3.8 in v1.5.0. Upgrade your Python version or pin pyleri <1.5.0 if you need these versions.
fix
Use Python >=3.9 or install pyleri==1.4.3.
affects: >=1.5.0
gotchaThe 'parse' method returns a Result object, not True/False. Check result.is_valid to determine success.
fix
Always check result.is_valid, not just the returned value.
affects: all
gotchaRegex element requires the pattern to be anchored with '^' internally. Do not add '^' at start; pyleri already prepends it.
fix
Use Regex(r'[a-zA-Z]+') not Regex(r'^[a-zA-Z]+').
affects: >=1.4.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pyleri'
pyleri is not installed or imported incorrectly.
fix
Run 'pip install pyleri' and use 'from pyleri import ...'.
AttributeError: 'Result' object has no attribute 'as_string'
Typo: use 'as_str' (without 'ing').
fix
Replace result.as_string() with result.as_str().
pyleri.errors.ParseError: Expecting ... got ...
Input does not match grammar. Check your input or grammar definition.
fix
Use 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.

Agent activity
13 hits · last 30 days
node
12
Resources
pyleri — pip install pyleri · libregistry