Name | moneymoney JSON |
Version |
1.1.1
JSON |
| download |
home_page | |
Summary | Money package for Python |
upload_time | 2023-07-05 14:44:10 |
maintainer | |
docs_url | None |
author | w0rmr1d3r |
requires_python | >=3.9.0 |
license | GPLv3 |
keywords |
currency
python
money
finance
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# moneymoney
Money package for Python
[![PyPI](https://img.shields.io/pypi/v/moneymoney)](https://pypi.org/project/moneymoney/)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/w0rmr1d3r/moneymoney)](https://github.com/w0rmr1d3r/moneymoney/releases)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/moneymoney)
[![PyPi downloads](https://img.shields.io/pypi/dm/moneymoney?label=PyPi%20downloads)](https://pypistats.org/packages/moneymoney)
## Installation
```bash
pip install moneymoney
```
## Usage
### Base usages
```python
from moneymoney.currency_codes import CurrencyCodes
from moneymoney.defaults import ONE_EUR
from moneymoney.money import Money
from moneymoney.presets import EUR
# using a string as currency code
quantity = Money(amount=1000, currency_code="EUR")
# using currency codes from this package
quantity_two = Money(amount=1000, currency_code=CurrencyCodes.EUR)
# using defaults
my_price = ONE_EUR
# using presets
my_euro = EUR(amount=1.0)
```
### Some possible operations
You can `add`, `subtract`, `multiply` and `divide` money!
```python
from moneymoney.money import Money
# add
money_a = Money(currency_code="EUR", amount=3.0)
money_b = Money(currency_code="EUR", amount=2.0)
money_c = money_a + money_b # equal to Money(currency_code="EUR", amount=5.0)
# subtract
money_a = Money(currency_code="EUR", amount=3.0)
money_b = Money(currency_code="EUR", amount=2.0)
money_c = money_a - money_b # equal to Money(currency_code="EUR", amount=1.0)
# multiply
money_a = Money(currency_code="EUR", amount=3.0)
money_b = money_a * 3 # equal to Money(currency_code="EUR", amount=9.0)
# divide
money_a = Money(currency_code="EUR", amount=3.0)
money_b = money_a / 3 # equal to Money(currency_code="EUR", amount=1.0)
```
## Contributing
Pull requests are welcome. For major changes, please open an issue first
to discuss what you would like to change.
Please make sure to update tests as appropriate.
## Sponsors
Become a sponsor [here](https://github.com/sponsors/w0rmr1d3r)
## License
[GPLv3](LICENSE)
Raw data
{
"_id": null,
"home_page": "",
"name": "moneymoney",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9.0",
"maintainer_email": "",
"keywords": "currency,python,money,finance",
"author": "w0rmr1d3r",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/11/24/f9597bb0eeba20272cd2f92eb60466f6b8f9d5828e1e5b1e4e7e30a20207/moneymoney-1.1.1.tar.gz",
"platform": null,
"description": "# moneymoney\n\nMoney package for Python\n\n[![PyPI](https://img.shields.io/pypi/v/moneymoney)](https://pypi.org/project/moneymoney/)\n[![GitHub release (latest by date)](https://img.shields.io/github/v/release/w0rmr1d3r/moneymoney)](https://github.com/w0rmr1d3r/moneymoney/releases)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/moneymoney)\n[![PyPi downloads](https://img.shields.io/pypi/dm/moneymoney?label=PyPi%20downloads)](https://pypistats.org/packages/moneymoney)\n\n## Installation\n\n```bash\npip install moneymoney\n```\n\n## Usage\n\n### Base usages\n\n```python\nfrom moneymoney.currency_codes import CurrencyCodes\nfrom moneymoney.defaults import ONE_EUR\nfrom moneymoney.money import Money\nfrom moneymoney.presets import EUR\n\n# using a string as currency code\nquantity = Money(amount=1000, currency_code=\"EUR\")\n\n# using currency codes from this package\nquantity_two = Money(amount=1000, currency_code=CurrencyCodes.EUR)\n\n# using defaults\nmy_price = ONE_EUR\n\n# using presets\nmy_euro = EUR(amount=1.0)\n```\n\n### Some possible operations\n\nYou can `add`, `subtract`, `multiply` and `divide` money!\n```python\nfrom moneymoney.money import Money\n\n# add\nmoney_a = Money(currency_code=\"EUR\", amount=3.0)\nmoney_b = Money(currency_code=\"EUR\", amount=2.0)\nmoney_c = money_a + money_b # equal to Money(currency_code=\"EUR\", amount=5.0)\n\n# subtract\nmoney_a = Money(currency_code=\"EUR\", amount=3.0)\nmoney_b = Money(currency_code=\"EUR\", amount=2.0)\nmoney_c = money_a - money_b # equal to Money(currency_code=\"EUR\", amount=1.0)\n\n# multiply\nmoney_a = Money(currency_code=\"EUR\", amount=3.0)\nmoney_b = money_a * 3 # equal to Money(currency_code=\"EUR\", amount=9.0)\n\n# divide\nmoney_a = Money(currency_code=\"EUR\", amount=3.0)\nmoney_b = money_a / 3 # equal to Money(currency_code=\"EUR\", amount=1.0)\n```\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first\nto discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\n## Sponsors\n\nBecome a sponsor [here](https://github.com/sponsors/w0rmr1d3r)\n\n## License\n\n[GPLv3](LICENSE)\n",
"bugtrack_url": null,
"license": "GPLv3",
"summary": "Money package for Python",
"version": "1.1.1",
"project_urls": {
"Bug Tracker": "https://github.com/w0rmr1d3r/moneymoney/issues",
"Changelog": "https://github.com/w0rmr1d3r/moneymoney/releases",
"Documentation": "https://github.com/w0rmr1d3r/moneymoney",
"Funding": "https://github.com/sponsors/w0rmr1d3r",
"Homepage": "https://github.com/w0rmr1d3r/moneymoney",
"Repository": "https://github.com/w0rmr1d3r/moneymoney"
},
"split_keywords": [
"currency",
"python",
"money",
"finance"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3439d3881165e695e20c961b12b4d5990c24631e89224e7d39c4ae98b90aa329",
"md5": "4053d514ae470e9f78971d1e576d563b",
"sha256": "59fff1ea5017e14971bdb8eb5a6ce09c73e7ea577799b327930eb21dc325b1d3"
},
"downloads": -1,
"filename": "moneymoney-1.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4053d514ae470e9f78971d1e576d563b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9.0",
"size": 16664,
"upload_time": "2023-07-05T14:44:08",
"upload_time_iso_8601": "2023-07-05T14:44:08.931784Z",
"url": "https://files.pythonhosted.org/packages/34/39/d3881165e695e20c961b12b4d5990c24631e89224e7d39c4ae98b90aa329/moneymoney-1.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1124f9597bb0eeba20272cd2f92eb60466f6b8f9d5828e1e5b1e4e7e30a20207",
"md5": "f5adc4060dd53495a9591821d1aca062",
"sha256": "765c596de879e27db4d2c2513cc014893d0df4f865e1fa9ebba85b1a93157efa"
},
"downloads": -1,
"filename": "moneymoney-1.1.1.tar.gz",
"has_sig": false,
"md5_digest": "f5adc4060dd53495a9591821d1aca062",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9.0",
"size": 16330,
"upload_time": "2023-07-05T14:44:10",
"upload_time_iso_8601": "2023-07-05T14:44:10.299542Z",
"url": "https://files.pythonhosted.org/packages/11/24/f9597bb0eeba20272cd2f92eb60466f6b8f9d5828e1e5b1e4e7e30a20207/moneymoney-1.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-05 14:44:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "w0rmr1d3r",
"github_project": "moneymoney",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "moneymoney"
}