formatparse
A Rust-backed reimplementation of the parse library for Python. It targets the same parse / search / findall workflow with substantially lower overhead on hot paths (performance guide). Use it as a drop-in replacement for common parse patterns; see the migration guide for edge-case differences.
Documentation
Full documentation: https://formatparse.readthedocs.io/
- Getting Started
- User Guides — patterns, datetime, custom types, validation, security
- API Reference
- FAQ / Troubleshooting
- Security — read before parsing untrusted input
- Changelog
Features
- Fast: Rust backend with pattern caching and batch APIs (benchmarks)
- Drop-in replacement: Compatible with common
parseusage (migration guide) - Pattern matching: Named and positional fields, custom types, nested specs
- DateTime parsing: ISO 8601, log timestamps, strftime, and more
- Case-sensitive and case-insensitive matching (matching behavior)
- Validation and bidirectional patterns for round-trip format/parse workflows
Installation
pip install formatparse
From source, see Installation in the docs.
Quick Start
from formatparse import parse, search, findall
result = parse("{name}: {age:d}", "Alice: 30")
print(result.named["name"], result.named["age"]) # Alice 30
More examples: Getting Started.
Malformed patterns: parse vs compile
For some invalid patterns (for example a missing } after a field), parse returns None while compile raises PatternParseMismatch. See the migration guide.
Custom types (extra_types)
Use @with_pattern and an extra_types dict — see the Custom types guide. Caching and pickling notes are documented there and in FAQ.
Contributing
See CONTRIBUTING.md and the Contributing docs page.
Testing
- Python: 740+ tests (
pytest tests/), coverage enforced at 86%+ in CI - Rust:
formatparse-coreandformatparse-pyo3tests (cargo test -p formatparse-core --all-targets)
export PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
pytest tests/
License
MIT License — see LICENSE.
Credits
Based on the parse library by Richard Jones.
Metadata
Release files for formatparse 0.8.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| formatparse-0.8.7.tar.gz | 103.6 kB | Without provenance | Details for formatparse-0.8.7.tar.gz |
Release files / formatparse-0.8.7.tar.gz
| Download URL | formatparse-0.8.7.tar.gz |
|---|---|
| Size | 103.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a427d4e0771e3a032324e8c0b4bd3608d84b08685b580446bede7d2a733191df
|
|
BLAKE2b-256 checksum How to use checksums |
5c0821439da10b6570662d481514c20ead0ad4cce32f54f917be868b740a8bb6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Security for formatparse 0.8.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.