Double-entry ledger engine with pluggable storage backends
Project description
TigerStar
A double-entry ledger engine with pluggable storage backends.
Features
- Double-entry bookkeeping — every transfer debits one account and credits another
- Two-phase transfers — reserve funds (pending), then post or void
- Linked transfers — atomic chains that all succeed or all fail
- Balance constraints — prevent overdrafts with account flags
- Multi-currency — separate ledgers per currency with configurable precision
- Financial reporting — trial balance, balance sheet, general ledger
- Storage adapters — swap between Firestore and PostgreSQL without changing application code
- Concurrent-safe — row-level locking (Postgres) or optimistic transactions (Firestore)
Install
pip install tigerstar[postgres] # PostgreSQL only
pip install tigerstar[firestore] # Firestore only
pip install tigerstar[all] # both backends
Quick Start
With Firestore
from tigerstar import TigerStar, FirestoreStorage
storage = FirestoreStorage(credentials_path="path/to/firebase-adminsdk.json")
engine = TigerStar(storage=storage)
With PostgreSQL
from tigerstar import TigerStar, PostgresStorage
storage = PostgresStorage(dsn="postgresql://user:pass@localhost:5432/dbname")
storage.migrate()
engine = TigerStar(storage=storage)
Create a ledger and move money
from tigerstar import Ledger, Account, AccountType, AccountFlags, Transfer, TransferCode
ledger = Ledger(currency="TZS", precision=0, max_transfer_amount=10_000_000)
engine.create_ledger(ledger)
cash = Account(ledger_id=ledger.id, code=AccountType.ASSET)
user = Account(
ledger_id=ledger.id,
code=AccountType.LIABILITY,
flags=AccountFlags(debits_must_not_exceed_credits=True),
)
engine.create_accounts([cash, user])
engine.create_transfers([
Transfer(
debit_account_id=cash.id,
credit_account_id=user.id,
ledger_id=ledger.id,
amount=50000,
code=TransferCode.PAYMENT,
),
])
Storage Adapters
| Adapter | Database | Best For |
|---|---|---|
FirestoreStorage |
Google Cloud Firestore | Serverless, zero-ops, auto-scaling |
PostgresStorage |
PostgreSQL | Financial-grade ACID, SQL flexibility, cost control |
Both adapters implement the same interface — swap one for the other with zero application changes. See docs/adapters.md for connection pooling, migrations, and writing custom adapters.
Documentation
- Usage Guide — ledgers, accounts, transfers, reporting
- Storage Adapters — setup, configuration, custom adapters
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tigerstar-0.1.1.tar.gz.
File metadata
- Download URL: tigerstar-0.1.1.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
098377a28b7ca1df83b271fb7d103dd3078835f7cebc05a7daf007613411daba
|
|
| MD5 |
0fb004f661c4cc18b691a7e590e1e39b
|
|
| BLAKE2b-256 |
a3388f19b753bbfdb3c722f691cb8835f6acb2354e5c5ec80ccfc864cd96cef3
|
Provenance
The following attestation bundles were made for tigerstar-0.1.1.tar.gz:
Publisher:
publish.yml on erickweyunga/tigerstar
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tigerstar-0.1.1.tar.gz -
Subject digest:
098377a28b7ca1df83b271fb7d103dd3078835f7cebc05a7daf007613411daba - Sigstore transparency entry: 1563718643
- Sigstore integration time:
-
Permalink:
erickweyunga/tigerstar@1593f67013dac1cb348ab258f0353173b578d8b3 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/erickweyunga
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1593f67013dac1cb348ab258f0353173b578d8b3 -
Trigger Event:
release
-
Statement type:
File details
Details for the file tigerstar-0.1.1-py3-none-any.whl.
File metadata
- Download URL: tigerstar-0.1.1-py3-none-any.whl
- Upload date:
- Size: 19.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a2b28d8d68ac8917df2ac623cb2f2c8f72d8a9d58434a3cbfccd954f12f33e7
|
|
| MD5 |
92d52b67ff4aaeec6b793089b2f511d1
|
|
| BLAKE2b-256 |
7c2a3f91e5c8c69154be43177934a6aaaf4764a42bc504941afa9271eaf0b624
|
Provenance
The following attestation bundles were made for tigerstar-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on erickweyunga/tigerstar
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tigerstar-0.1.1-py3-none-any.whl -
Subject digest:
1a2b28d8d68ac8917df2ac623cb2f2c8f72d8a9d58434a3cbfccd954f12f33e7 - Sigstore transparency entry: 1563718655
- Sigstore integration time:
-
Permalink:
erickweyunga/tigerstar@1593f67013dac1cb348ab258f0353173b578d8b3 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/erickweyunga
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1593f67013dac1cb348ab258f0353173b578d8b3 -
Trigger Event:
release
-
Statement type: