skillfed

pyPEG2

An intrinsic PEG Parser-Interpreter for Python

pypeg2 v2.15.2 83.6K downloads/30d#14,061 on PyPI
Copyleft license LICENSE.txt Abandoned released

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 pypeg2

uv

uv add pypeg2

poetry

poetry add pypeg2

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: GNU General Public License v2 (GPLv2)Operating System :: OS IndependentProgramming Language :: Python :: 2Programming Language :: Python :: 3Topic :: Software Development :: CompilersTopic :: Software Development :: InterpretersTopic :: Software Development :: Libraries :: Python Modules

Tags

PEG parser generatorparsing expression grammarcustom parser pythonlanguage parser librarygrammar-based parsingtext parsing toolDSL parser
parser-generatorabandonedcopyleft

More Python Modules packages