Skip to main content

larzledger

Exact double-entry accounting in pure Python. Zero dependencies.

A correct ledger: every transaction is balanced debits and credits (rejected if they don't balance), account balances follow real accounting's normal-side rules, and money is exact Decimal — never a float, so the books never drift by a cent.

from larzledger import Ledger

led = Ledger(currency="$")
led.account("cash", "asset")
led.account("revenue", "income")
led.account("rent", "expense")

led.transaction("Sale").debit("cash", "250.00").credit("revenue", "250.00").commit()
led.post("Rent", debit=("rent", "1200.00"), credit=("cash", "1200.00"))

led.balance("cash")                 # Decimal('-950.00')
led.trial_balance()                 # debits == credits, guaranteed
led.accounting_equation_holds()     # True

Why

  • Actually double-entry. Debits must equal credits or the transaction is refused — the core invariant that keeps books trustworthy.
  • Exact money. Decimal throughout; floats are rejected on purpose. Balances, trial balance, and the accounting equation always reconcile to the cent.
  • Real accounting semantics. Asset/expense accounts are debit-normal; liability/equity/income are credit-normal — balances read positive on the right side.
  • Money-native, zero-dep. Amounts accept strings, ints, Decimal, or larzmoney Money objects. No dependency, no database — bring your own storage.

Install

pip install larzledger

Usage

led.account(name, "asset"|"liability"|"equity"|"income"|"expense")

# transaction builder (any number of legs; must balance)
led.transaction("desc").debit("a", "10").credit("b", "10").commit()

# convenience for simple entries (amounts can be dicts of account->amount)
led.post("Split", debit={"rent": "50", "cash": "50"}, credit={"revenue": "100"})

# reporting
led.balance("cash")
led.trial_balance()                 # [(name, type, debit, credit), ...]
led.total("asset")                  # sum of an account type
led.statement("cash")               # every posting touching an account
led.accounting_equation_holds()     # assets == liabilities + equity + income - expense
led.format("1234.5")                # "$1,234.50"

Tests

python -m unittest discover -s tests -v   # 17 tests, zero deps

The Larz stack

Part of a family of pure-Python, zero-dependency libraries — money-native (larzmoney, larzpdf), and 30+ more at github.com/larz-scripter.

License

MIT © larz-scripter

Metadata

Release files for larzledger 0.1.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 larzledger 0.1.0
File Size Uploaded Provenance
larzledger-0.1.0.tar.gz 6.9 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 13.8 kB

Release files / larzledger-0.1.0.tar.gz

Download URL larzledger-0.1.0.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5791da3944aadeabb6ec92d378d630a218d108d666586833111dd0f1d279f2fc
BLAKE2b-256 checksum
How to use checksums
49d358a36bbf8c163d6d4c18952f63aeaab0ef2b1ba2ac93c1e46f9841a617fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / larzledger-0.1.0-py3-none-any.whl

Download URL larzledger-0.1.0-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eba7cdc0bb33492ef8800e5d4244ab1b12235634066cb370642a5eae6d7848ad
BLAKE2b-256 checksum
How to use checksums
7e90f0812e4e40893d1e574136bab1a6943fab1ea5ed51b7578f1da21e60dc8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Security for larzledger 0.1.0

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.1.0 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