Modern Python 3.9+ Money Class with Currency Exchange
Project description
Money-Py3: Modern Python Money Library
A modern Python 3.9+ money handling library with currency exchange support and optional locale-aware formatting.
This is a modernized fork of the original money
package by Carlos Palol, completely rewritten for Python 3.9+ with all Python 2 compatibility code removed.
Features
- Python 3.9+ only - Modern, clean codebase
- Decimal precision - No floating-point arithmetic errors
- Currency exchange - Extensible exchange rate backends
- Locale-aware formatting - Optional CLDR formatting via Babel
- Immutable objects - Thread-safe money objects
- Type hints ready - Modern Python development
Installation
Using pip:
pip install money-py3
For locale-aware formatting support:
pip install money-py3[formatting]
Using Poetry:
poetry add money-py3
For locale-aware formatting support:
poetry add money-py3[formatting]
Quick Start
from money import Money, XMoney, xrates
from money.exchange import SimpleBackend
from decimal import Decimal
# Basic usage
price = Money('10.50', 'USD')
tax = Money('0.98', 'USD')
total = price + tax
print(total) # USD 11.48
# Currency exchange
xrates.install(SimpleBackend)
xrates.base = 'USD'
xrates.setrate('EUR', Decimal('0.85'))
eur_total = total.to('EUR')
print(eur_total) # EUR 9.76
# XMoney with automatic conversion
x1 = XMoney('10', 'USD')
x2 = XMoney('5', 'EUR')
result = x1 + x2 # Automatically converts EUR to USD
print(result) # USD 15.88
Requirements
- Python 3.9+
packaging
(automatically installed)babel
(optional, for formatting)
License
MIT License - see original project for details.
Credits
This package is based on the original money
library by Carlos Palol (carlos.palol@awarepixel.com), modernized for Python 3.9+.
Original Project
- Author: Carlos Palol
- Original Repository: https://github.com/carlospalol/money
- License: MIT
Modernization by Fever
This modernized version is maintained by Fever (https://github.com/feverup/).
Changes made:
- Removed all Python 2 compatibility code (six library)
- Updated to use modern Python 3.9+ features
- Replaced deprecated imports with current alternatives
- Improved packaging configuration
- Updated dependencies to current versions
Contact: engineering@feverup.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file money_py3-2.0.0.tar.gz
.
File metadata
- Download URL: money_py3-2.0.0.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.4 CPython/3.11.13 Linux/6.11.0-1018-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
bc5a22badf6154b6957b0016bb8721d5034422ea7e968b5f52156cde21d23f3e
|
|
MD5 |
e3a21c2b6b36ab2b71719129eec64f74
|
|
BLAKE2b-256 |
f6644f9f91b86540f93f0d31e22b057fd7ebe41d35a84fe539f166b4e80d8e02
|
File details
Details for the file money_py3-2.0.0-py3-none-any.whl
.
File metadata
- Download URL: money_py3-2.0.0-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.4 CPython/3.11.13 Linux/6.11.0-1018-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
e15b2e92f3f1ca4aafb83a992ddb7cb17b98a00919a51a6f37f85d918a0a892b
|
|
MD5 |
5a1b4f9676c5efbcbbe87e1e495e3346
|
|
BLAKE2b-256 |
97cd7fcbdb7f6c12ff497fd7cb3d32145a71b955ea938235baa8f8784ebe00bf
|