textparser
A text parser library for python.
What it is and what it does
textparser is a Python library for building fast text parsers by defining token specifications and grammar rules. You subclass textparser.Parser, specify how to tokenize input (using regex patterns), and define the grammar structure using combinators like Sequence. The parser then converts text into a parse tree. The library emphasizes speed—benchmarks show it parsing JSON significantly faster than alternatives like pyparsing, lark, and parsy—and takes design cues from PyParsing for a familiar interface.
It has no external runtime dependencies and installs as a pure Python wheel, making it lightweight and easy to integrate. The project is actively maintained and supports modern Python versions (3.10+). It's useful when you need to parse domain-specific languages, configuration files, or structured text formats where performance matters and you want direct control over tokenization and grammar rules.
Use it for:
- Parse custom configuration or data file formats where you control both the syntax and the grammar rules.
- Build domain-specific language (DSL) parsers for internal tools or scripting systems.
- Extract structured data from text when regex alone is insufficient but you need faster parsing than general-purpose parser generators.
- Implement protocol or message parsers where performance and predictable behavior are important.
- Create educational or embedded parsers where you want minimal dependencies and direct control over the parsing process.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A fast text parser library that lets you define grammars using token specs and parsing rules, then parse text into structured parse trees.
Yes, if you need to parse structured text and performance matters. The library is actively maintained, has no dependencies, requires only Python 3.10+, and benchmarks show it substantially faster than comparable alternatives. MIT license is permissive. Install it if you're building a parser and speed is a priority; skip it if you need error recovery, detailed diagnostics, or support for older Python versions.
Install
textparser on PyPI
pip
pip install textparseruv
uv add textparserpoetry
poetry add textparserInstalling textparser
Before you install
Low friction—pure Python wheel with no runtime dependencies and active maintenance (last release 55 days ago). Requires Python 3.10 or later.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects.
Quickstart
pip install textparser
import textparser
from textparser import Sequence
class MyParser(textparser.Parser):
def token_specs(self):
return [('WORD', r'\w+'), ('SKIP', r'[ \t]+')]
def grammar(self):
return Sequence('WORD', 'WORD')
tree = MyParser().parse('hello world')
Requires Python 3.10 or later.
Verify before relying
- Whether the parser handles recursive grammars or has depth/complexity limits.
- Error recovery and reporting capabilities beyond the basic parse tree output.
- Memory footprint for large input files or deeply nested grammars.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 55 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,477,089/month — #2,607 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: textparser-0.26.2-py3-none-any.whl
Keywords: parser, parsing
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
pyleriPyleri is a left-right parser generator that…
permissive · top 15,000 on PyPI
parsyParsy is a parser combinator library that lets…
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
mo-parsingmo-parsing is a PEG parser generator that lets…
permissive · top 15,000 on PyPI
lark-parserLark is a parsing library that builds abstract…
permissive · top 5,000 on PyPI
textXtextX is a meta-language for building…
permissive · top 15,000 on PyPI
lark-jsLark-js is a command-line tool that generates…
permissive · top 15,000 on PyPI
larkLark is a parsing library that builds abstract…
permissive · top 1,000 on PyPI