Skip to main content

iouopt

iouopt simplifies group IOU settlement. If you've used Splitwise or similar apps, you're familiar with the concept.

Usage

import iouopt import Journal

j = Journal[str]()

j.append(borrower="A", lender="B", amount=5)
j.append("A", "C", 15)
j.append("B", "A", 10)
j.append("B", "C", 5)
j.append("C", "A", 20)
j.append("C", "B", 15)

for borrower, lender, amount in j.simplify():
    print(f"#=> {borrower} pays {lender} {amount}")

#=> C pays A 10
#=> C pays B 5

Note: iouopt requires that all amounts are represented as an int. This is a constraint of the underlying minimum-cost flow algorithm. If you need to express partial units, such as 15.78, multiply amounts by a suitable constant factor (e.g., 100) and then convert them to an int.

Install

Install the latest version from the Python Package Index (PyPI).

$ pip install iouopt

Release files for iouopt 0.2.0

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

Source distribution (sdist)

Source distribution for iouopt 0.2.0
File Size Uploaded
iouopt-0.2.0.tar.gz 3.8 kB Details

Built distribution (wheel)

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

Total release size:8.7 kB

Release files / iouopt-0.2.0.tar.gz

Download URL iouopt-0.2.0.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2bec4128a9bf4e8b5a0015303a202ae8fb12998cd5f9354a798e500c51ab05e7
BLAKE2b-256 checksum
How to use checksums
3aa53237eed5d585b289b7067cec33060071b11a9cddccbd2f2f4144a2947d99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.5

Release files / iouopt-0.2.0-py3-none-any.whl

Download URL iouopt-0.2.0-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a1860c18c9f6090656ea35ce90be94e126bd7cfbe0e3b6f2b4b9452204ca41fd
BLAKE2b-256 checksum
How to use checksums
ea7e7a7d240f9d22003aaa8e1f19b38f84e9ebf0ff747343be5f3bf5aecaed47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.5

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

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