Skip to main content

Currencies Formatter

Python Version License

The Currencies Formatter Library (or currencies lib) is a Python library designed to simplify the formatting of monetary values for various currencies. It supports a wide range of currencies and provides options for custom formatting. Whether you need to display values with currency symbols or abbreviate large numbers, this library offers a straightforward solution.

Features

  • Format monetary values for multiple currencies.
  • Custom decimal and symbol options.
  • Allows conversion of values to percentage format.
  • Utility functions for abbreviating units.

Installing

You can install this library with:

$ pip install currencies-lib

Supports Python 3.10+

Example of use

from currencies_lib import BRL

value = 1250.50
result = BRL(value)
print(result)
# >> "R$1.250,50"

or

from currencies_lib import *

value = 1250.50
result = format_currency(value, "EUR", spaced=True) # Specify currency code
print(result)
# >> "€ 1.250,50"

Additional Examples

# Percentages
print(as_percentage(1000, 25))
# >> 250
print(as_percentage(1000, "25%", subtraction=True))
# >> 750

# Abbreviations
print(unit_abbreviator(1200000))  
# >> "1.2M"

Contributing

I welcome contributions to improve this library! If you have suggestions, bug reports, or new feature requests, please open an issue or submit a pull request on my GitHub repository.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Metadata

Release files for currencies-lib 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for currencies-lib 2.0.0
File Size Uploaded
currencies_lib-2.0.0.tar.gz 7.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for currencies-lib 2.0.0
File Interpreter ABI Platform
currencies_lib-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.7 kB

Release files / currencies_lib-2.0.0.tar.gz

Download URL currencies_lib-2.0.0.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a440e3c22561d5f3ff8df1e8ad9c627aa1fe5d6b61b581626b87676a6eb7ac3c
BLAKE2b-256 checksum
How to use checksums
42853e49d54c257cb93177e68d3560ed289d33eaa0e25e819d95ffc67f9f5780
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / currencies_lib-2.0.0-py3-none-any.whl

Download URL currencies_lib-2.0.0-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8ce5ee3b9383a9585f53c1f50e696bba63e5e9d7ba8da0f5d40416678c480a9f
BLAKE2b-256 checksum
How to use checksums
d41abf4b683710274c781ee3f5f1838e022d9449775c0735dd7df7a0bf785237
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page