# -*- coding: utf-8 -*-
from distutils.core import setup

packages = \
['stockholm']

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

setup_kwargs = {
    'name': 'stockholm',
    'version': '0.3.2',
    'description': 'An up to date human friendly and flexible approach for development with any kind of monetary amounts',
    'long_description': '# `stockholm` — `Money` for Python 3\n[![pypi](https://badge.fury.io/py/stockholm.svg)](https://pypi.python.org/pypi/stockholm/)\n[![Made with Python](https://img.shields.io/pypi/pyversions/stockholm)](https://www.python.org/)\n[![Type hinted - mypy validated](https://img.shields.io/badge/typehinted-yes-teal)](https://github.com/kalaspuff/stockholm)\n[![MIT License](https://img.shields.io/github/license/kalaspuff/stockholm.svg)](https://github.com/kalaspuff/stockholm/blob/master/LICENSE)\n[![Code coverage](https://codecov.io/gh/kalaspuff/stockholm/branch/master/graph/badge.svg)](https://codecov.io/gh/kalaspuff/stockholm/tree/master/stockholm)\n\n*Library for formatting and performing arithmetic and comparison operations on monetary amounts. Also with support for currency handling, exchange and network transport structure generation as well as parsing.*\n\nAn up to date human friendly and flexible approach for development with any kind of monetary amounts.\n\nAt its bone a `Money` class for Python 3.x. This is a library to be used by backend and frontend API coders of fintech companies, web merchants and subscription services. A simple, yet powerful way of coding with money.\n\n---\n\n#### `from stockholm import Money`\nThe `stockholm.Money` object has full arithmetic support together with `int`, `float`, `Decimal`, other `Money` objects as well as `string`. The `stockholm.Money` object also supports complex string formatting functionality for easy debugging and a clean coding pattern.\n\n#### `from stockholm import Currency`\nCurrencies to monetary amounts can be specified using either currencies built with the `stockholm.Currency` metaclasses or simply by specifying the currency ticker as a string (for example `"SEK"` or `"EUR"`) when creating a new `Money` object.\n\nCurrencies using the `stockholm.Currency` metaclasses can hold additional options, such as default number of decimals in string output. Note that the amounts are usually never behind the scenes and uses the same precision and backend as `Decimal` values and can as well be interchangable with such values.\n\n\n## Installation with `pip`\nLike you would install any other Python package, use `pip`, `poetry`, `pipenv` or your weapon of choice.\n```\n$ pip install stockholm\n```\n\n\n## Examples\n\n#### Arithmetics - fully supported\n*Full arithmetic support with different types, backed by `Decimal` for dealing with rounding errors, while also keeping the monetary amount fully currency aware.*\n```python\nfrom stockholm import Money\n\nmoney = Money("4711.50", currency="SEK")\nprint(money)\n# 4711.50 SEK\n\noutput = (money + 100) * 3 + Money(50)\nprint(output)\n# 14484.50 SEK\n\nprint(output / 5)\n# 2896.90 SEK\n\nprint(round(output / 3, 4))\n# 4828.1667 SEK\n\nprint(round(output / 3, 1))\n# 4828.20 SEK\n```\n\n#### Formatting / Advanced string formatting\n*Advanced string formatting functionality.*\n```python\nfrom stockholm import Money\n\njpy_money = Money(1352953, "JPY")\nexchange_rate = Money("0.08861326")\nsek_money = Money(jpy_money * exchange_rate, "SEK")\n\nprint(f"I have {jpy_money:,.0m} which equals around {sek_money:,.2m}")\nprint(f"The exchange rate is {exchange_rate} ({jpy_money:c} -> {sek_money:c})")\n# I have 1,352,953 JPY which equals around 119,889.58 SEK\n# The exchange rate is 0.08861326 (JPY -> SEK)\n\n# Standard string format uses default min decimals up to 9 decimals\nprint(f"{sek_money}")  # 119889.57595678 SEK\n\n# Format type "f" works the same way as formatting a float or Decimal\nprint(f"{jpy_money:.0f}")  # 1352953\nprint(f"{sek_money:.2f}")  # 119889.58\nprint(f"{sek_money:.1f}")  # 119889.6\nprint(f"{sek_money:.0f}")  # 119890\n\n# Format type "m" works as "f" but includes the currency in string output\nprint(f"{sek_money:.2m}")  # 119889.57 SEK\nprint(f"{sek_money:.4m}")  # 119889.5760 SEK\nprint(f"{sek_money:+,.4m}")  # +119,889.5760 SEK\n\n# An uppercase "M" puts the currency ticker in front of the amount\nprint(f"{sek_money:.4M}")  # SEK 119889.5760\n\n# Format type "c" will just output the currency used in the monetary amount\nprint(f"{sek_money:c}")  # SEK\n```\n\n*Use `stockholm.Currency` types for proper defaults of minimum number of decimal digits to output in strings, etc. All ISO 4217 currency codes implemented, see https://github.com/kalaspuff/stockholm/blob/master/stockholm/currency.py for the full list.*\n```python\nfrom stockholm import Currency, Money, get_currency\nfrom stockholm.currency import JPY, SEK, EUR, IQD, USDCoin, Bitcoin\n\n# Most currencies has a minimum default digits set to 2 in strings\nprint(Money(4711, SEK))  # 4711.00 SEK\nprint(Money(4711, EUR))  # 4711.00 EUR\n\n# The stockholm.currency.JPY has a minimum default digits set to 0\nprint(Money(4711, JPY))  # 4711 JPY\n\n# Some currencies even has a minimum default of 3 or 4 digits\nprint(Money(4711, IQD))  # 4711.000 IQD\n\n# Some complex non ISO 4217 currencies, assets or tokens may define\n# their own ticker, for example a "USD Coin" uses the ticker "USDC"\nprint(Money(4711, USDCoin))  # 4711.00 USDC\nprint(Money(4711, Bitcoin))  # 4711.00 BTC\n\n# You can also use the shorthand stockholm.Currency object which\n# holds all ISO 4217 three character codes as objects.\nprint(Money(1338, Currency.JPY))  # 1338 JPY\n\n# or call the get_currency function\nprint(Money(1338, get_currency("JPY")))  # 1338 JPY\n\n```\n\n#### Input data types in flexible variants\n*Flexible ways for assigning values to a monetary amount using many different input data types and methods.*\n```python\nfrom decimal import Decimal\nfrom stockholm import Money\n\nMoney(100, currency="EUR")\n# <stockholm.Money: "100.00 EUR">\n\nMoney("1338 USD")\n# <stockholm.Money: "1338.00 USD">\n\nMoney("0.5")\n# <stockholm.Money: "0.50">\n\namount = Decimal(5000) / 3\nMoney(amount, currency="XDR")\n# <stockholm.Money: "1666.666666667">\n\nmoney = Money("0.30285471")\nMoney(money, currency="BTC")\n# <stockholm.Money: "0.30285471 BTC">\n\ncents_as_str = "471100"\nMoney(cents_as_str, currency="USD", from_sub_units=True)\n# <stockholm.Money: "4711.00 USD">\n```\n\n#### List arithmetics - summary of monetary amounts in list\n*Adding several monetary amounts from a list.*\n```python\nfrom stockholm import Money\n\namounts = [\n    Money(1),\n    Money("1.50"),\n    Money("1000"),\n]\n\n# Use Money.sum to deal with complex values of different data types\nMoney.sum(amounts)\n# <stockholm.Money: "1002.50">\n\n# Built-in sum may also be used (if only working with monetary amounts)\nsum(amounts)\n# <stockholm.Money: "1002.50">\n```\n\n#### Conversion for other transport medium (for example Protocol Buffers)\n*Easily splittable into `units` and `nanos` for transport in network medium, for example using the [`google.type.Money` protobuf definition](https://github.com/googleapis/googleapis/blob/master/google/type/money.proto) when using Protocol Buffers.*\n```python\nfrom stockholm import Money\n\nmoney = Money("22583.75", "SEK")\nmoney.units, money.nanos, str(money.currency)\n# (22583, 750000000, \'SEK\')\n\n# or vice versa\nMoney(units=22583, nanos=750000000, currency="SEK")\n# <stockholm.Money: "22583.75 SEK">\n```\n\n\n## Acknowledgements\nBuilt with inspiration from https://github.com/carlospalol/money and https://github.com/vimeo/py-money\n',
    'author': 'Carl Oscar Aaro',
    'author_email': 'hello@carloscar.com',
    'url': 'https://github.com/kalaspuff/stockholm',
    'packages': packages,
    'package_data': package_data,
    'python_requires': '>=3.6,<4.0',
}


setup(**setup_kwargs)
