parsy
Easy-to-use parser combinators, for parsing in pure Python
What it is and what it does
Parsy is a parser combinator library that builds complex parsers from simple, composable pieces. Instead of writing grammar rules or regex patterns, you define small parsers and combine them using operators—much like building expressions in functional programming. It's inspired by Haskell's Parsec and similar libraries, but designed for readability and ease of use in Python.
The library has zero external dependencies, ships as a single module under 800 lines of code, and has been stable for over a decade. It's actively maintained and supports current Python versions (3.9 through 3.13). You can use it to parse structured text like JSON, SQL, configuration files, or domain-specific languages—anywhere you need to turn unstructured input into structured data without the overhead of a full parser generator.
Use it for:
- Parse JSON or other structured data formats by defining grammar rules as composable parser functions.
- Build a SQL SELECT statement parser or similar domain-specific language parser.
- Extract and validate structured fields from log files or configuration text.
- Create a simple expression evaluator or calculator that respects operator precedence.
- Parse custom query languages or filter syntax in applications.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parsy is a parser combinator library that lets you build complex text parsers by combining small, reusable parser functions together in a declarative style.
Yes. Parsy is a mature, zero-dependency library with active maintenance, no known vulnerabilities, and a permissive MIT license. It's well-suited for any project needing declarative text parsing without external build tools. Install it if you need to parse structured text and prefer a functional, composable approach over regex or hand-rolled parsing logic.
Install
parsy on PyPI
pip
pip install parsyuv
uv add parsypoetry
poetry add parsyInstalling parsy
Before you install
Installation is straightforward with zero runtime dependencies outside the standard library. The project is actively maintained with a last commit on 2026-06-22, and has remained stable over its decade-long history with few backwards incompatibilities.
License in practice
MIT license is permissive, allowing use in commercial and private projects with minimal restrictions—you need only include the license text in distributions.
Quickstart
pip install parsy
from parsy import string, regex
parser = string('hello') >> regex(r'\s+') >> string('world')
result = parser.parse('hello world')
Requires Python 3.9 or later.
Verify before relying
- Whether the library's LL(infinity) grammar support covers all parsing scenarios you need.
- Performance characteristics for very large or deeply nested input structures.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 336 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,848,299/month — #2,478 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: parsy-2.2-py3-none-any.whl
Keywords: parser, parsers, parsing, monad, combinators
Tags
More Text Processing packages
A drop-in replacement for Python's standard…
permissive · top 100 on PyPI
pyparsingpyparsing provides a library for building text…
permissive · top 1,000 on PyPI
docutilsDocutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
RapidFuzzRapidFuzz provides fast fuzzy string matching…
permissive · top 1,000 on PyPI
tinycss2tinycss2 parses CSS strings into token and…
permissive · top 1,000 on PyPI
llama-parseLlamaParse parses complex documents (PDFs,…
permissive · top 1,000 on PyPI
textparserA fast text parser library that lets you define…
permissive · top 5,000 on PyPI
funcparserlibFuncparserlib is a recursive descent parsing…
permissive · top 15,000 on PyPI
parsimoniousParsimonious is a pure-Python PEG (parsing…
permissive · top 5,000 on PyPI
ArpeggioArpeggio is a recursive descent parser with…
permissive · top 5,000 on PyPI
pygmarsPygmars builds lightweight lexers and parsers…
permissive · top 15,000 on PyPI
ParsleyParsley is a PEG-based parsing library that…
permissive · top 5,000 on PyPI
tree-sitter-haskellProvides a tree-sitter parser grammar for…
permissive · top 15,000 on PyPI
pluralizerConverts English words between singular and…
permissive · top 15,000 on PyPI
chzchz is a configuration management library that…
permissive · top 5,000 on PyPI