Skip to main content

No project description provided

Project description

sharepay — split expenses, settle debts, and convert currencies

sharepay is a Python expense-splitting library and command-line tool for group trips, shared bills, and reimbursements. Import expenses from CSV or Google Sheets, split each payment across members, convert currencies with live exchange rates, and print the transactions needed to settle up.

Features

  • Split group expenses equally across payment members.
  • Calculate who owes whom and produce settlement transactions.
  • Import payments from CSV files or public Google Sheets.
  • Convert multi-currency expenses into one settlement currency.
  • Merge duplicate people with aliases such as johnny=john.
  • Use as a Typer CLI or as a Python library.

Installation

Requires Python 3.11 or newer.

pip install sharepay

For local development from this repository:

uv sync
uv run sharepay --help

Quick start: settle expenses from CSV

Create an expenses.csv file with the required columns: amount, payer, members, and currency.

amount,payer,members,currency
300,alice,"alice,bob,cara",TWD
200,bob,"bob,cara",TWD

Run the settlement calculator:

sharepay settle --file expenses.csv --currency TWD

sharepay prints member balances and the transactions needed to settle the group.

Google Sheets import

Use a public Google Sheets sharing URL, CSV URL, or export URL with the same payment columns:

sharepay settle \
  --sheet "https://docs.google.com/spreadsheets/d/<sheet-id>/edit#gid=0" \
  --currency TWD

The sheet is read as CSV. Make sure it contains:

Column Description
amount Payment amount, with optional thousands separators
payer Person who paid
members Comma-separated people sharing the payment
currency Payment currency code

Common CLI options

sharepay settle --file expenses.csv
sharepay settle \
  --sheet "https://docs.google.com/spreadsheets/d/<sheet-id>/edit#gid=0"
sharepay settle --file expenses.csv --currency USD
sharepay settle --file expenses.csv --alias "johnny=john" --alias "jon=john"

Supported settlement currencies are EUR, GBP, JPY, TWD, USD, and CAD. The default settlement currency is TWD.

Python API example

from sharepay import Currency
from sharepay import ExpenseGroup

group = ExpenseGroup(name="trip", currency=Currency.TWD)
group.add_payment(
    amount=300,
    currency=Currency.TWD,
    payer="alice",
    members=["alice", "bob", "cara"],
)
group.add_payment(
    amount=200,
    currency=Currency.TWD,
    payer="bob",
    members=["bob", "cara"],
)

for transaction in group.settle_up():
    print(transaction)

Output:

cara   -> alice      200.00 TWD

How sharepay works

  1. Each payment is split equally among the listed members.
  2. The payer is credited for the shares paid on behalf of others.
  3. Expenses in other currencies are converted into the settlement currency with live exchange rates.
  4. Optional aliases canonicalize repeated names before balances are settled.
  5. settle_up() returns the transactions needed to bring balances back to zero.

Development

Useful commands from the repository root:

uv sync
just lint
just type
just test
prek run -a

CI runs Ruff, ty, and pytest on Python 3.13. Before publishing, build a wheel with:

uv build --wheel

License

MIT License.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

sharepay-0.4.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file sharepay-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: sharepay-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.20 {"installer":{"name":"uv","version":"0.11.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for sharepay-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6070d01650498a5e6b91339eb1f00478bc9117e649db670dc7efa62e7197e865
MD5 324fcec7112c07fbd1ddf9afbc335c66
BLAKE2b-256 d6d79f30c36f8246e4b76de0acd2a9e4ed0262448e3252a900ef9998cb27712c

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