Metadata-Version: 2.1
Name: format-currency
Version: 0.0.10
Summary: A no-frill currency formatting library.
Project-URL: Documentation, https://github.com/arifwn/format-currency#readme
Project-URL: Issues, https://github.com/arifwn/format-currency/issues
Project-URL: Source, https://github.com/arifwn/format-currency
Author-email: Arif Widi Nugroho <arif@sainsmograf.com>
License-Expression: MIT
License-File: LICENSE.txt
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Text Processing :: Filters
Classifier: Topic :: Utilities
Requires-Python: >=3.7
Description-Content-Type: text/markdown

# Format Numbers as Currencies

A no-frill currency formatting library.

-----

**Table of Contents**

- [Installation](#installation)
- [License](#license)

## Installation

```console
pip install format-currency
```

## Usage

```python
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:

```bash
python -m pip install --upgrade pip build hatch
```

Run the test runner:

```bash
./test_runner.sh
```

## License

`format-currency` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.

## References

- https://en.wikipedia.org/wiki/Decimal_separator
