--- id: parsimonious version: "0.11.0" license: MIT license_treatment: permissive maintenance: aging --- # parsimonious — (Soon to be) the fastest pure-Python PEG parser I could muster License: permissive · Maintenance: aging · Downloads: 6.9M/mo ## What it is and what it does Parsimonious is a parsing library built on parsing expression grammars (PEGs)—a simplified EBNF notation you write as strings to define what text patterns to recognize. You give it a grammar and text, and it returns an abstract syntax tree (AST) representing the structure it found. The library separates parsing from interpretation: once you have a tree, you walk it with a NodeVisitor subclass to extract data or transform it however you need—render to HTML, extract key-value pairs, build an intermediate representation, or anything else. The package is designed for speed and low memory use in pure Python, with no external parser generator or lexer step required. It handles arbitrary lookahead and right recursion automatically, making grammars simpler to write than with tools like Yacc. The library is mature in core functionality (test coverage is good, error reporting works), though marked as alpha and with a note that API changes are possible before 1.0. Use it for: - Parse configuration files (INI, TOML-like formats) and extract structured data into Python dicts or objects - Build a domain-specific language (DSL) parser for custom query syntax, template languages, or markup formats - Parse wiki markup or other text formats and transform them to HTML, plain text, or other output formats - Validate and extract data from semi-structured text (logs, reports, data feeds) according to a grammar you define - Implement a simple expression evaluator or calculator by parsing arithmetic or logical expressions into an AST ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Parsimonious is a pure-Python PEG (parsing expression grammar) parser that builds abstract syntax trees from text according to grammar rules you define, with no external lexer or parser generator required. Yes, if you need to parse text with a grammar you can define in code and don't want to depend on external tools or compiled parsers. The low install friction, permissive license, and lack of security issues make it a safe choice. The aging maintenance status and alpha classifier mean you should pin the version and be prepared for potential API changes if you upgrade—but the current 0.11.0 is stable for production use if your grammar needs are straightforward. ## Install pip install parsimonious uv add parsimonious poetry add parsimonious ## Installing parsimonious Before you install: Low friction: pure-Python wheel with a single runtime dependency (regex). Last release 275 days ago; repository active with 1914 stars and recent commits, though marked as aging rather than actively developed. License in practice: MIT license (permissive): you can use, modify, and distribute Parsimonious in commercial and private projects with minimal restrictions, provided you include the license notice. Quickstart: from parsimonious.grammar import Grammar from parsimonious.nodes import NodeVisitor grammar = Grammar(r""" expr = ~"[a-z]+" """) tree = grammar.parse('hello') print(tree) Verify before relying: - Whether performance meets the stated goal of being 'fastest arbitrary-lookahead parser' in practice for real-world grammars - Current RAM usage characteristics and whether optimization work mentioned in 'Coming Soon' has been completed - Stability of API before 1.0 release and whether pinning to 0.11.0 is necessary to avoid breakage ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: aging - Downloads: 6.9M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags peg parser python, parsing expression grammar, text parsing library, grammar-based parser, ast tree builder, ebnf parser pure python, packrat parsing, parser-generator, grammar-based, ast-builder [View on SkillFed](https://skillfed.io/packages/parsimonious) · [View on PyPI](https://pypi.org/project/parsimonious/)