pyPEG2
An intrinsic PEG Parser-Interpreter for Python
What it is and what it does
pyPEG2 is a PEG parser library that allows you to define grammars declaratively and use them to parse text in Python. It's designed for building custom parsers when standard parsing tools (like XML or template parsers) don't fit your needs, and it includes Unicode support.
The package is production-stable according to its classifier but has been unmaintained since October 2015. It targets both Python 2.7 and Python 3.x, though the long gap since its last release raises questions about compatibility with recent Python versions. The description indicates it depends on lxml, though the exact dependency relationship is not fully documented in the fact sheet.
Use it for:
- Building domain-specific language (DSL) parsers for configuration files or custom syntax.
- Parsing structured text formats where regex or simple string splitting is insufficient.
- Creating grammar-based interpreters for small languages or query syntaxes.
- Prototyping language parsers before committing to a full parser generator like ANTLR.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
pyPEG2 is a PEG (Parsing Expression Grammar) parser generator that lets you write your own parsers in Python, supporting both Python 2.7 and Python 3.x with Unicode handling.
No, unless you have a specific legacy requirement. The package is abandoned (last release 2015) with no maintenance for over 3964 days, creating risk for Python 3.10+ compatibility issues. The GPLv2 copyleft license also constrains derivative work. For new projects, consider actively maintained PEG libraries like lark or parsley instead.
Install
pypeg2 on PyPI
pip
pip install pypeg2uv
uv add pypeg2poetry
poetry add pypeg2Installing pyPEG2
Before you install
High install friction: the package is abandoned (last release 2015-10-07, over 3964 days ago) with no maintenance activity. It targets Python 2.7 alongside Python 3.x, which may cause compatibility issues in modern environments.
License in practice
Licensed under GPLv2 (copyleft). Any derivative work or modification must be released under the same license, and you must distribute source code alongside binaries.
Quickstart
pip install pypeg2
from pypeg2 import parse
# Define a simple grammar and parse input
result = parse("input_string", grammar_rule)
The description states pyPEG 2 depends on lxml; verify this dependency is available in your environment. Python 2.7 support may conflict with modern Python 3 toolchains.
Verify before relying
- Whether lxml is automatically installed as a dependency or must be manually installed separately.
- Actual Python version compatibility in modern Python 3 releases (3.10+) given the 2015 last release date.
- Whether the package works reliably with current versions of its stated dependency (lxml).
Package facts
| License | LICENSE.txt (copyleft) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 3,964 days since the last release |
| First released | |
| Downloads | 83,606/month — #14,061 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyPEG2-2.15.2.tar.gz
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
PyMeta3PyMeta3 compiles pattern-matching grammars…
permissive · top 15,000 on PyPI
textXtextX is a meta-language for building…
permissive · top 15,000 on PyPI
pyparsingpyparsing provides a library for building text…
permissive · top 1,000 on PyPI
TatSuTatSu compiles extended EBNF grammars into…
permissive · top 5,000 on PyPI
parsimoniousParsimonious is a pure-Python PEG (parsing…
permissive · top 5,000 on PyPI
ParsleyParsley is a PEG-based parsing library that…
permissive · top 5,000 on PyPI
mo-parsingmo-parsing is a PEG parser generator that lets…
permissive · top 15,000 on PyPI
pygmarsPygmars builds lightweight lexers and parsers…
permissive · top 15,000 on PyPI
textparserA fast text parser library that lets you define…
permissive · top 5,000 on PyPI
PyJSGGenerates Python 3 classes from JSON Schema…
permissive · top 15,000 on PyPI