Format Numbers as Currencies
A no-frill currency formatting library.
Table of Contents
Installation
pip install format-currency
Usage
from format_currency import format_currency
# format currency by country code, using the selected country's local monetary number formatting
formatted = format_currency(1234567.89, 'US') # returns $ 1,234,567.89
formatted = format_currency(1234567.89, 'ID') # returns Rp 1.234.567,89
# format currency by currency code
formatted = format_currency(1234567.89, currency_code='USD') # returns $ 1,234,567.89
formatted = format_currency(1234567.89, currency_code='IDR') # returns Rp 1.234.567,89
# smart formatting
formatted = format_currency(value, country_code='CN', smart_number_formatting=True) # returns ¥ 123.46 万
# format currency by country code, respecting global locale settings
import locale
locale.setlocale(locale.LC_ALL, '')
formatted = format_currency(1234567.89, 'US', use_current_locale=True) # returns $ 1,234,567.89
formatted = format_currency(1234567.89, 'ID', use_current_locale=True) # returns Rp 1,234,567.89
Testing
Install dependencies:
python -m pip install --upgrade pip build hatch
Run the test runner:
./test_runner.sh
License
format-currency is distributed under the terms of the MIT license.
References
Metadata
Release files for format-currency 0.0.10
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 |
|---|---|---|---|---|
| format_currency-0.0.10.tar.gz | 169.7 kB | Without provenance | Details for format_currency-0.0.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| format_currency-0.0.10-py3-none-any.whl | Python 3 | none | any | Details for format_currency-0.0.10-py3-none-any.whl |
Total release size: 337.6 kB
Release files / format_currency-0.0.10.tar.gz
| Download URL | format_currency-0.0.10.tar.gz |
|---|---|
| Size | 169.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
15f01e5aaecf7c636815911cf0cbab0b117c8a6bd992d61a666f5e038cce32d9
|
|
BLAKE2b-256 checksum How to use checksums |
3d18ee5527f52565bd79f3111e7fac7fbfe384f5b9bf909431814c2dc0457815
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.27.0
|
Release files / format_currency-0.0.10-py3-none-any.whl
| Download URL | format_currency-0.0.10-py3-none-any.whl |
|---|---|
| Size | 167.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eedecf0b2c4d21b2435eff3eed95658160d0602c444f921dd22ce4bfab7735c7
|
|
BLAKE2b-256 checksum How to use checksums |
94cb788941330c524422c87583121b0d589636a982fad0685f9f3b7c7588c2f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.27.0
|
Security for format-currency 0.0.10
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.