# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['dinero', 'dinero.currencies']

package_data = \
{'': ['*']}

install_requires = \
['typing-extensions>=4.4.0,<5.0.0']

setup_kwargs = {
    'name': 'dinero',
    'version': '0.1.7',
    'description': 'Dinero is a library for working with monetary values in Python.',
    'long_description': '<h1 align="center"> Dinero: Make exact monetary calculations</h1>\n\n<p align="center">\n<a href="https://pypi.org/project/dinero/">\n  <img alt="PyPI" src="https://img.shields.io/pypi/v/dinero">\n</a>\n<a href="https://pypi.org/project/dinero/">\n  <img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/dinero">\n</a>\n<a href="https://github.com/wilfredinni/dinero/actions">\n  <img alt="Build status" src="https://github.com/wilfredinni/dinero/actions/workflows/test.yml/badge.svg" data-canonical-src="https://img.shields.io/github/workflow/status/Delgan/loguru/Tests/master" style="max-width: 100%;">\n</a>\n<a href="https://codecov.io/github/wilfredinni/dinero" >\n <img alt="Codecov" src="https://img.shields.io/codecov/c/github/wilfredinni/dinero">\n</a>\n<a href="https://www.codacy.com/gh/wilfredinni/dinero/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=wilfredinni/dinero&amp;utm_campaign=Badge_Grade">\n <img alt="Codacy grade" src="https://img.shields.io/codacy/grade/d6b13235aec14905968fb4b0e9a5e8fd">\n</a>\n<a href="https://github.com/wilfredinni/dinero/blob/master/LICENSE">\n  <img alt="PyPI - License" src="https://img.shields.io/pypi/l/dinero">\n</a>\n</p>\n\n<p align="center">\n  <img width="300" height="200" src="https://media.tenor.com/EWRvErYGzPUAAAAC/bugs-bunny-looney-tunes.gif">\n</p>\n\nThis project is inspired by the excellent [dinero.js](https://github.com/dinerojs/dinero.js) library.\n\nPython Decimal instances are enough for basic monetary calculations, but when you face more complex use-cases they often show limitations and are not so intuitive to work with. Dinero provides a cleaner and easier to use API while still relying on the standard library. So it\'s still Decimal, but easier.\n\n[Read the Documentation](https://wilfredinni.github.io/dinero/)\n\n## Why Dinero?\n\nA `Dinero` object is an immutable data structure representing a specific monetary value. It comes with methods for creating, parsing, manipulating, testing and formatting.\n\n## Install\n\n```bash\npip install dinero\n```\n\n## Initialization\n\nTo create a `Dinero` object, you need an `amount` that can be an `int`, `float`, `str` or `Decimal`, and a `currency`:\n\n```python\nfrom dinero import Dinero\nfrom dinero.currencies import USD\n\namount = Dinero(100.4, USD)\n```\n\n## Properties\n\nEvery `Dinero` object has the following properties:\n\n```python\n>>> amount.raw_amount\nDecimal(\'100.40\')\n```\n\n```python\n>>> amount.symbol\n\'$\'\n```\n\n```python\n>>> amount.code\n\'USD\'\n```\n\n```python\n>>> amount.exponent\n2\n```\n\n```python\n>>> amount.precision\n10\n```\n\n## Formatting\n\n### String\n\nYou can return a formatted string representation of `Dinero` with the `format` method:\n\n```python\n>>> Dinero(2.32, EUR).format()\n\'2.32\'\n```\n\n```python\n>>> Dinero(2.32, EUR).format(symbol=True)\n\'€2.32\'\n```\n\n```python\n>>> Dinero(2.32, EUR).format(currency=True)\n\'2.32 EUR\'\n```\n\n```python\n>>> Dinero(2.32, EUR).format(symbol=True, currency=True)\n\'€2.32 EUR\'\n```\n\n### Dictionary\n\nReturn a `Dinero` instance as a Python Dictionary:\n\n```python\n>>> Dinero("3333.259", USD).to_dict()\n{\n    \'amount\': \'3333.26\',\n    \'currency\':\n        {\n            \'code\': \'USD\',\n            \'base\': 10,\n            \'exponent\': 2,\n            \'symbol\': \'$\'\n        }\n}\n```\n\n```python\n>>> Dinero(\'3333.26\', USD).to_dict(amount_with_format=True)\n{\n    \'amount\': \'3,333.26\',\n    \'currency\':\n        {\n            \'code\': \'USD\',\n            \'base\': 10,\n            \'exponent\': 2,\n            \'symbol\': \'$\'\n        }\n}\n```\n\n### Json\n\nReturn a `Dinero` instance as a `JSON` string:\n\n```python\n>>> Dinero(\'2,00\', USD).to_json()\n\'{"amount": "3333.20", "currency": {"code": "USD", "base": 10...\'\n```\n\n```python\n>>> Dinero(\'2,00\', USD).to_json(amount_with_format=True)\n\'{"amount": "3,333.26", "currency": {"code": "USD", "base": 10...\'\n```\n\n## Operations\n\nIf the addend or subtrahend is an `str`, `int`, `float` or `Decimal`, it will be transformed, under the hood, to a Dinero instance using the same currency:\n\n```python\n# those operations\nDinero(1000, USD).add(Dinero(1000, USD))\nDinero(1000, USD) + Dinero(1000, USD)\n\n# are equivalent to\nDinero(1000, USD).add(1000)\nDinero(1000, USD) + 1000\n```\n\n```python\n# those operations\nDinero(1000, USD).subtract(Dinero(100, USD))\nDinero(1000, USD) - Dinero(100, USD)\n\n# are equivalent to\nDinero(1000, USD).subtract(1000)\nDinero(1000, USD) - 100\n```\n\nAdditions and subtractions must be between instances with the same `currency`:\n\n```python\n>>> total = Dinero(100, USD) + Dinero(100, EUR)\nTraceback (most recent call last):\n  File "<stdin>", line 1, in <module>\n  File "/home/.../dinero/_dinero.py", line 120, in __add__\n    addend_obj = self._get_instance(addend)\n                 ^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/home/.../dinero/_dinero.py", line 74, in _get_instance\n    raise DifferentCurrencyError("Currencies can not be different")\ndinero.exceptions.DifferentCurrencyError: Currencies can not be different\n```\n\nThe multiplicand and divisor can be `int`, `float` or of `Decimal` type:\n\n```python\nDinero(1000, USD).multiply(2)\nDinero(1000, USD) * 2\n```\n\n```python\nDinero(1000, USD).divide(2)\nDinero(1000, USD) / 2\n```\n\n## Comparisons\n\n```python\nDinero(1000, USD).equals_to(Dinero(1000, USD))\nDinero(1000, USD) == Dinero(1000, USD)\n```\n\n```python\nDinero(1000, USD).less_than(Dinero(1000, USD))\nDinero(1000, USD) < Dinero(1000, USD)\n```\n\n```python\nDinero(1000, USD).less_than_or_equal(Dinero(1000, USD))\nDinero(1000, USD) <= Dinero(1000, USD)\n```\n\n```python\nDinero(1000, USD).greater_than(Dinero(1000, USD))\nDinero(1000, USD) > Dinero(1000, USD)\n```\n\n```python\nDinero(1000, USD).greater_than_or_equal(Dinero(1000, USD))\nDinero(1000, USD) >= Dinero(1000, USD)\n```\n\nYou can only compare to other `Dinero` objects:\n\n```python\n>>> Dinero(100, USD) == 100\nTraceback (most recent call last):\n  File "<stdin>", line 1, in <module>\n  File "/home/.../dinero/_dinero.py", line 146, in __eq__\n    self._comparison_amount(amount)\n  File "/home/.../dinero/_dinero.py", line 103, in _comparison_amount\n    raise InvalidOperationError(InvalidOperationError.comparison_msg)\ndinero.exceptions.InvalidOperationError: You can only compare against other Dinero instances.\n```\n\n## Currencies\n\nThe currency is one of the two pieces necessary to create a Dinero object.\n\nA Dinero currency is composed of:\n\n- A unique code.\n- A base, or radix.\n- An exponent.\n- A symbol (optional)\n\n```python\nEUR: Currency = {\n    "code": "EUR",\n    "base": 10,\n    "exponent": 2,\n    "symbol": "€",\n}\n```\n\nDinero give you access to [more than 100 different currencies](/dinero/currencies/):\n\n```python\n>>> from dinero.currencies import USD, EUR, GBP, INR, CLP\n```\n\n```python\n>>> Dinero(2.32, EUR)\nDinero(amount=2.32, currency={\'code\': \'EUR\', \'base\': 10, \'exponent\': 2, \'symbol\': \'€\'})\n```\n\n```python\n>>> Dinero(2.32, EUR).format(symbol=True, currency=True)\n\'€2.32 EUR\'\n```\n\n```python\n>>> Dinero(2.32, EUR).raw_amount\nDecimal(\'2.32\')\n```\n\n### Custom Currencies\n\nYou can easily create custom currencies:\n\n```python\nfrom dinero import Dinero\n\nBTC = {\n    "code": "BTC",\n    "base": 10,\n    "exponent": 2,\n    "symbol": "₿",\n}\n\nDinero(1000.5, BTC)\n```\n\n### Type hints\n\nIf you are using `type hints` in your project you would want to import `dinero.types.Currency` to prevent warnings:\n\n```python\nclass Currency(TypedDict):\n    code: str\n    base: int\n    exponent: int\n    symbol: NotRequired[str]\n```\n\n```python\nfrom dinero.types import Currency\n\nBTC: Currency = {\n    "code": "BTC",\n    "base": 10,\n    "exponent": 2,\n    "symbol": "₿",\n}\n\nDinero(1000.5, BTC)\n```\n',
    'author': 'Carlos Montecinos Geisse',
    'author_email': 'carlos@pythoncheatsheet.org',
    'maintainer': 'None',
    'maintainer_email': 'None',
    'url': 'https://github.com/wilfredinni/dinero',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'python_requires': '>=3.10,<4.0',
}


setup(**setup_kwargs)
