skillfed

parsy

Easy-to-use parser combinators, for parsing in pure Python

parsy v2.2 3.8M downloads/30d#2,478 on PyPI451
Permissive license MIT Active released

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 parsy

uv

uv add parsy

poetry

poetry add parsy

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Software Development :: CompilersTopic :: Software Development :: InterpretersTopic :: Text Processing

Tags

parser combinators pythontext parsing librarymonadic parserLL grammar parserdeclarative parsingparser compositiongrammar parsing
parsingparser-combinatorsfunctional-programming

More Text Processing packages