pyparsing
Build recursive-descent parsers in Python without a separate grammar file
Repository Health
Technical Analysis
pyparsing lets you build parsers for structured or semi-structured text entirely in Python, by combining small parser-element objects (literals, words, numbers, quoted strings) with operators like + (sequence), | (first match), and ^ (longest match) into a grammar object that parses directly. There’s no separate grammar DSL, code-generation step, or external parser-generator tool to run — the grammar is ordinary Python code, which makes it easy to debug, extend, and combine with the rest of an application.
It predates most modern PEG-parser libraries in the Python ecosystem and remains widely used for config-file formats, small DSLs, log-line extraction, and search-query grammars where a full parser-generator toolchain would be overkill.
What You Get
- A library of composable parser-element primitives (
Word,Literal,Regex,QuotedString,Combine, and more) usable directly as Python objects - Operator-based grammar composition (
+for sequence,|for first-match-wins,^for longest-match,~for negation) - Parse actions - attach Python callables to grammar elements to transform or validate matched tokens during parsing
ParseResultsobjects supporting both positional and named-field access to parsed tokens, plus nested/grouped results- A
pyparsing.diagrammodule for generating railroad-diagram visualizations of a grammar, plus acommonmodule of ready-made tokens (numbers, identifiers, comments)
Common Use Cases
- Parsing small domain-specific languages or config-file formats without introducing a separate grammar-generator build step
- Extracting structured fields from semi-structured log lines or command output
- Building custom search-query or filter-expression grammars for an application’s search bar
- Validating and transforming input during parsing itself via attached parse actions, rather than in a separate post-processing pass
Under The Hood
Architecture - core.py implements the parser-combinator engine: every grammar element is a ParserElement subclass with a parseImpl method, and composite elements (And, Or, MatchFirst, Each) recursively call into their children’s parseImpl during a scan over the input string, with results.py’s ParseResults accumulating matched tokens (including named results set via .set_results_name()) as parsing proceeds; actions.py implements the parse-action callback mechanism that lets grammar authors hook into successful matches.
Tech Stack - Pure Python with no runtime dependencies, distributed with inline type stubs (py.typed) for static type checkers; the pyparsing/tools and pyparsing/diagram subpackages add optional railroad-diagram grammar visualization (built on railroad-diagrams) as an extra rather than a hard dependency, keeping the core install lightweight.
Code Quality - The library ships an explicit testing.py module with TestParseResultsAsserts-style helpers specifically to make grammars written with pyparsing easier for consumers to unit-test, on top of its own large internal test suite; exceptions.py and warnings.py provide structured parse-error reporting with line/column context rather than generic Python exceptions, which matters a lot for a parsing library’s usability.
API Design - Composing grammars via Python operator overloading (Word(alphas) + '=' + Word(nums)) is the library’s signature ergonomic choice — grammars read close to the structure they describe and stay debuggable with ordinary Python tooling (breakpoints, print statements), at some cost of operator-precedence surprises that the docs and cookbook examples work to head off.
Used by 11 apps in this directory
Apache Airflow
Data Engineering
Define, schedule, and monitor complex data workflows as Python code — with a powerful UI, 80+ provider integrations, and battle-tested scalability across thousands of production deployments.
argilla
AI Development · Data Engineering
Collaborate on high-quality AI training data with a self-hosted annotation platform built for LLMs, NLP, and multimodal models.
ClearML
Devops · Automation
Auto-magical MLOps platform that tracks experiments, versions data, orchestrates pipelines, and serves models with just two lines of code.
ClickHouse
Databases · Analytics · Data Engineering
Open-source column-oriented database that delivers real-time analytical queries on petabyte-scale data with millisecond latency.
Dokku
Devops · Hosting Control Panel
The smallest PaaS implementation you've ever seen — deploy apps via git push using Docker and Heroku buildpacks on your own server.
Dragonfly
Databases · Developer Tools · Devops
A modern Redis and Memcached replacement engineered for multi-core servers — delivering 25x more throughput, better cache hit rates, and up to 80% lower memory consumption with full API compatibility.
Flagsmith
Developer Tools · Devops · Ab Testing Experimentation
Open-source feature flagging, remote config, and A/B/multivariate testing platform for web, mobile, and server-side apps — self-host or use the hosted SaaS.
Helicone
Monitoring · AI Development · Analytics
An open-source AI gateway and LLM observability platform that routes requests to 100+ models while logging cost, latency, and full traces for every call.
Memgraph
Databases · AI Development
High-performance in-memory graph database for AI context and real-time analytics