moneyparse
Parse, find and format money strings as exact Decimal amounts with their ISO 4217
currency. It reads 1.234,56 €, $1,234.56, CHF-1'234.50, (1,234.00),
₹1,23,45,678.90 and 1 234,56 kr, finds amounts inside free text with their
positions, and writes amounts back the way a locale does. Separator rules, minus
signs and currency patterns come from Unicode CLDR 48.2; codes, numeric codes and minor
units come from the ISO 4217 list published on 2026-09-17. No dependencies, no floats.
Install
pip install moneyparse
Quick start
from decimal import Decimal
from moneyparse import Money, find_money, format_money, parse
parse("1.234,56 €") # Money(amount=Decimal('1234.56'), currency='EUR')
parse("$1,234.56", locale="en-US") # Money(amount=Decimal('1234.56'), currency='USD')
parse("$1,234.56", locale="en-CA") # ... currency='CAD'
parse("(1,234.00)", currency="USD", locale="en-US") # Decimal('-1234.00'), 'USD'
parse("₹1,23,45,678.90", locale="en-IN") # Decimal('12345678.90'), 'INR'
parse("$1.2k", currency="USD", magnitude=True) # Decimal('1200'), 'USD'
[(m.text, m.start, m.end) for m in find_money("Paid €12,50 and 3 USD.")]
# [('€12,50', 5, 11), ('3 USD', 16, 21)]
format_money(Decimal("1234.5"), "EUR", locale="de-DE") # '1.234,50\xa0€'
format_money(Decimal("-1234"), "USD", accounting=True) # '($1,234.00)'
Money("10.50", "EUR") + Money("0.25", "EUR") # Money(... Decimal('10.75'), 'EUR')
Money("100.00", "EUR").allocate([1, 1, 1]) # 33.34, 33.33, 33.33 EUR
No guessing
Two things in a money string can be genuinely ambiguous, and moneyparse raises a
typed error instead of guessing:
- Separators.
1,234is one thousand two hundred thirty-four inen-USand one point two three four inde-DE. Withoutlocale=ordecimal=it raisesAmbiguousSeparatorError. Strings with both marks (1.234,56), repeated groups (1,234,567) or a fraction that is not three digits (12,50) are read directly. - Symbols.
$is the narrow symbol of 29 currencies,¥of JPY and CNY,krof four. Withoutcurrency=or alocale=that gives the symbol a meaning ($is CAD inen-CA,kris SEK insv-SE), it raisesAmbiguousCurrencyErrorwith the candidate codes. Unambiguous symbols (€,£,₹,R$,zł,CA$) and ISO codes need nothing.
Command line
moneyparse parse "1.234,56 EUR" # 1234.56 EUR
moneyparse parse '$1,234.56' --locale en-US --json
echo "Paid 12,50 EUR and USD 3.99" | moneyparse find
moneyparse format 1234.5 --currency EUR --locale de-DE
moneyparse currency KWD JPY CLF
Errors go to stderr with exit code 1. moneyparse --help lists every option.
Learn more
GUIDE.md covers every option: locales, explicit separators, negatives,
magnitude suffixes, minor units, finding amounts in text, formatting, the Money
type, the error hierarchy and where the data comes from.
parse_money, the tuple-returning function of the first release, is unchanged:
from moneyparse import parse_money
parse_money("$1,234.56") # (Decimal('1234.56'), 'USD')
Why
Amounts arrive as strings from invoices, spreadsheets, scraped pages and user input,
in whatever locale wrote them. py-moneyed models money but does not parse locale
strings; babel formats and parses numbers but is heavy, does not find amounts in
text and leaves currency symbols to you; price-parser targets scraped text and
returns floats, which lose cents. moneyparse turns money text into an exact
Decimal plus its currency, refuses to guess, and writes it back.
License
MIT. See LICENSE.
Links
- Website: https://lianes8studio.com
- GitHub: https://github.com/JaviLianes8
- LinkedIn: https://www.linkedin.com/in/jlianes/
Metadata
Release files for moneyparse 0.2.0
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 |
|---|---|---|---|---|
| moneyparse-0.2.0.tar.gz | 47.3 kB | Without provenance | Details for moneyparse-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| moneyparse-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for moneyparse-0.2.0-py3-none-any.whl |
Total release size: 82.6 kB
Release files / moneyparse-0.2.0.tar.gz
| Download URL | moneyparse-0.2.0.tar.gz |
|---|---|
| Size | 47.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
faf36fb1a1fe165a43625a44e9ce8083ddabb90cbc9b7a4ab470c8e34cb8a5ab
|
|
BLAKE2b-256 checksum How to use checksums |
db63dbc81a7ae0d6ab2ea2eb427257655966a547e13ed6a671d9709eab4f8c74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.2
|
Release files / moneyparse-0.2.0-py3-none-any.whl
| Download URL | moneyparse-0.2.0-py3-none-any.whl |
|---|---|
| Size | 35.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
028640df6d6cb4cd3c28a520a0c21553146964e09eaf361e32e6e1f56da61e33
|
|
BLAKE2b-256 checksum How to use checksums |
66361f63482eb814d7bf8463df22f01ba6ac3730d486096325246c9c38dd7791
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.2
|
Security for moneyparse 0.2.0
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.