Skip to main content

Money package for Python

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

moneymoney

Money package for Python

PyPI GitHub release (latest by date) PyPI - Python Version PyPi downloads

Installation

pip install moneymoney

Usage

Base usages

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!

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

License

GPLv3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

moneymoney-1.1.2.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

moneymoney-1.1.2-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file moneymoney-1.1.2.tar.gz.

File metadata

  • Download URL: moneymoney-1.1.2.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.18

File hashes

Hashes for moneymoney-1.1.2.tar.gz
Algorithm Hash digest
SHA256 813e48e90383ea895712cb609dec0262b6105f0eeca1804fb6f993c0fb1ed612
MD5 afe8bd276506f46982f9b878032b76c1
BLAKE2b-256 fa83021a02993d464bababd2ee6ca76bdb4c7595f5a3a42ea318aa5149c3271d

See more details on using hashes here.

File details

Details for the file moneymoney-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: moneymoney-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.18

File hashes

Hashes for moneymoney-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e840d4e92609e0dd904ca99e5747f81dd7baefc90a9c76b805a57c23f43c7343
MD5 b16deee7b401038fbcf06b5068efc186
BLAKE2b-256 b4e9c1eb195b593b58e51067be5738f70d81492b12439b9480118bfaf1412277

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page