Skip to main content

Kùdí 💰 (WIP)

“Kùdí” (also spelled “kudi”) is a Hausa word that means money 💰. Kudi is a python implementation of Fowler's Money pattern inspired by Rhymond/go-money

Installation

uv add kudi

Usage

from kudi import Money, CurrencyCode

m1 = Money(50, 'USD')  # Fifty cents
m2 = Money('1.50', 'USD')  # One dollar and fifty cents
m3 = Money(-100, 'usd')
m4 = Money(0, CurrencyCode.EUR)

# Arithmetic
print(m2 + m1)
print(m2 - m2)
print(m2 + m1 - m2)
print(m1 + m4) # will raise an exception, arithmetic on monies in different currencies is not allowed
print(m1 * 4)
print(-m2)
print(abs(m3))  # Absolute
print(m1.negative())  # Not to be confused with `-m1`, `.negative` will
# always result in a negative value

# Assertions
print(m3.is_negative)
print(m4.is_zero)
print(m1.is_positive)

# Allocations
# In order to split Money for parties without losing any pennies due
# to rounding differences, use `split`.
# After division leftover pennies will be distributed round-robin amongst
# the parties. This means that parties listed first will likely receive
# more pennies than ones that are listed later.
pound = Money(100, 'GBP')
allocations = pound.split(3)
print(allocations)

# To perform splits in ratios, use `allocate`.
# It splits money using the given ratios without losing pennies and as
# Split operations distributes leftover pennies amongst the parties
# with round-robin principle.
allocations = pound.allocate([33,33,33])

Metadata

Release files for kudi 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kudi 0.0.1
File Size Uploaded Provenance
kudi-0.0.1.tar.gz 9.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for kudi 0.0.1
File Interpreter ABI Platform
kudi-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 20.3 kB

Release files / kudi-0.0.1.tar.gz

Download URL kudi-0.0.1.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f836ff62f1219beee85c0c29e15c634af20a51f25daefa6eaed83b101b93aa61
BLAKE2b-256 checksum
How to use checksums
9c40a42482a3bebaac8e0f60f442e69d1bf83a003d8cd10e6d7ce0134d03fcba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.3

Release files / kudi-0.0.1-py3-none-any.whl

Download URL kudi-0.0.1-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7275b3032e66df1efd200ae05cefc705e532819a1b95caf7542228d49784019b
BLAKE2b-256 checksum
How to use checksums
c002b2bfa510bb2721fbb97748f81bda3a9f688a90fa65ff36b717ae0adadf5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.3

Security for kudi 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page