Skip to main content

Ledger Reader

A simple parser for hledger journal files. It's always fun to play with rply and use a simple grammar. PR's welcome :).

Example usage

Read a journal

reader = LedgerReader()
journal = reader.parse_file('bank.journal')

for entry in journal:
    print(entry.date, entry.description)
    for transaction in entry.transactions:
        print(f'{transaction.account} {transaction.currency} {transaction.amount}')

    print()

Append to a journal

from datetime import date
from ledger_reader import Entry, Transaction

entry = Entry(
    date(2022, 3, 5),
    'Cash Transfer',
    transactions=[
        Transaction('assets:bank:boa:checking', '$', -5000),
        Transaction('assets:bank:boa:savings')
    ]
)

with open('bank.journal', 'a') as fp:
    fp.write(f'\n{entry}')

Download files

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

Source Distribution

ledger_reader-0.1.tar.gz (1.6 kB view details)

Uploaded Source

Built Distribution

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

ledger_reader-0.1-py3-none-any.whl (1.6 kB view details)

Uploaded Python 3

File details

Details for the file ledger_reader-0.1.tar.gz.

File metadata

  • Download URL: ledger_reader-0.1.tar.gz
  • Upload date:
  • Size: 1.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.7

File hashes

Hashes for ledger_reader-0.1.tar.gz
Algorithm Hash digest
SHA256 278a167163942acb1e067cf22e33ef974f77d2687b54f3d23f87c8658e0036b5
MD5 01b13f0ceb738707945259b512da87ca
BLAKE2b-256 ecc21442656bcaa3db531b1e9670d942285ef9c0652043295a4b568ad08760fd

See more details on using hashes here.

File details

Details for the file ledger_reader-0.1-py3-none-any.whl.

File metadata

  • Download URL: ledger_reader-0.1-py3-none-any.whl
  • Upload date:
  • Size: 1.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.7

File hashes

Hashes for ledger_reader-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9ca8a90dec35223a70e7ebfea6bdd2ded74c9cd34d2e23e990525d3c8dc05c0a
MD5 0b41330823b8dcf7ed90244919a2ef80
BLAKE2b-256 d3082169ca26e373987f7477f955fe2d63b705d534b1929169bffb1844ad6d7c

See more details on using hashes here.

Release history Release notifications | RSS feed

0.7

2 files

0.5

2 files

0.4

2 files

0.3

2 files

0.2

2 files

This release

0.1 This release

2 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