Python gRPC client for Janus
Project description
janus-ledger
Python gRPC client for the Janus double-entry accounting engine.
Install
pip install janus-ledger
Quick Start
from janus import Janus
ledger = Janus(server_url="your-janus-server:50051")
# Create an entity — every book belongs to an entity
entity = ledger.create_entity(external_id="org-1", name="Acme Corp")
# Create books
ledger.create_book(name="Cash", book_type="asset", currency="USD", entity_external_id="org-1")
ledger.create_book(name="Revenue", book_type="liability", currency="USD", entity_external_id="org-1")
entry = ledger.create_journal_entry(
idempotency_key="sale-001",
book_entries=[
{"book": "cash", "debit": 10000},
{"book": "revenue", "credit": 10000},
],
)
balance = ledger.get_balance("cash")
print(f"Cash balance: {balance.balance} {balance.currency}")
# => Cash balance: 10000 USD
Configuration
| Parameter | Description |
|---|---|
server_url |
gRPC server address (e.g., your-janus-server:50051) |
API Reference
Janus(server_url)
Create a client connected to your Janus server.
Entities
| Method | Description |
|---|---|
create_entity(external_id, name, description?, metadata?) |
Create a new entity. Returns Entity. |
get_entity(external_id_or_id) |
Get an entity by external ID or UUID. Returns Entity or None. |
list_entities() |
List all entities. Returns list[Entity]. |
Books
| Method | Description |
|---|---|
create_book(name, book_type, currency, entity_external_id, metadata?) |
Create a new book. Returns Book. |
get_book(type_or_id) |
Get a book by type or ID. Returns Book or None. |
list_books(book_type?, limit?, offset?) |
List books with optional filters. Returns list[Book]. |
Journal Entries
| Method | Description |
|---|---|
create_journal_entry(idempotency_key, book_entries, ...) |
Create a journal entry. Returns JournalEntry. |
reverse_journal_entry(entry_id, idempotency_key, reason?) |
Reverse a journal entry. Returns JournalEntry. |
get_journal_entry(entry_id) |
Get a journal entry by ID. Returns JournalEntry or None. |
get_journal_entry_by_key(idempotency_key) |
Get by idempotency key. Returns JournalEntry or None. |
Balances
| Method | Description |
|---|---|
get_balance(book, as_of?) |
Get the balance of a book. Returns BalanceResult. |
get_balances(books, as_of?) |
Get balances for multiple books. Returns list[BalanceResult]. |
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
janus_ledger-0.1.3.tar.gz
(10.9 kB
view details)
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 janus_ledger-0.1.3.tar.gz.
File metadata
- Download URL: janus_ledger-0.1.3.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
593a883e8b94ac036388b661775fa647442e47fc19ade9b4108b0915e9d7c107
|
|
| MD5 |
006444d448374cb4ebf9324e75820423
|
|
| BLAKE2b-256 |
d567d13f57efccf620e701ae67c221d64e4ae38a7e59876b85f82040bf29c49b
|
File details
Details for the file janus_ledger-0.1.3-py3-none-any.whl.
File metadata
- Download URL: janus_ledger-0.1.3-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
adf600cb028315d590089a898f706bbedd8525e32d113ae2b931d3992dae0130
|
|
| MD5 |
6c80dcd3ff21d4c82f3b9b48a3672add
|
|
| BLAKE2b-256 |
327163bfd099cd45c557882b80ca647e5ac4b4a860af8ac88e0c97fd7884c126
|