Skip to main content

Beanclerk

version on pypi license python versions ci tests pre-commit.ci status

Automation for Beancount.

Features (for rationale see Notes):

  • network downloads (via APIs),
  • automated categorization,
  • insertion of new transactions.

Supported data sources:

Project status: rough prototype; tested on Linux only.

Example

Create a config file and save it alongside your existing ledger:

$ ls
beanclerk-config.yml  my_ledger.beancount

Import new transactions:

$ bean-clerk import --from-date 2023-01-01
Account: 'Assets:Banks:Fio:Checking'
  New transactions: 3, balance OK: 9830.00 CZK
Account: 'Assets:Banks:Fio:Savings'
  New transactions: 0, balance OK: 50001.97 CZK

Once Beanclerk encounters a transaction without a matching categorization rule, it prompts you for resolution:

$ bean-clerk import
Account: 'Assets:Banks:Fio:Checking'
...
No categorization rule matches the following transaction:
2023-01-03 *
  id: "10000000002"
  account_id: "2345678901"
  account_name: "Pavel, Žák"
  bank_id: "2010"
  bank_name: "Fio banka, a.s."
  type: "Příjem převodem uvnitř banky"
  specification: "test specification"
  bic: "TESTBICXXXX"
  order_id: "30000000002"
  payer_reference: "test payer reference"
  Assets:Banks:Fio:Checking  500.0 CZK

Available actions:
'r': reload config (you should add a new rule first)
'i': import as-is (transaction remains unbalanced)
...

Installation

pip install beanclerk

Confirm successful installation by running:

bean-clerk -h

Notes

Beanclerk automates some areas not addressed by Beancount:

  1. Network downloads: As financial institutions start to provide access to their services via APIs, it is more convenient and less error-prone to use them instead of a manual download and multi-step import from CSV (or similar) reports. Compared to these reports, APIs usually have a stable specification and provide transaction IDs, making the importing process (e.g. checking for duplicates) much easier. Therefore, inspired by Beancount Importer Protocol, Beanclerk proposes a simple API Importer Protocol to support virtually any API.
  2. Automated categorization: With growing number of new transactions, manual categorization quickly becomes repetitive, boring and error-prone. At the moment, Beanclerk provides a way to define rules for automated categorization. However, it might be interesting to augment it by machine-learning capabilities (e.g. via the Smart Importer).
  3. Insertion of new transactions: Beanclerk appends transactions to the Beancount input file (i.e. the ledger) defined in the config. It saves the step of doing this manually. (With reporting tools like Fava I don't care about the precise position of a new transaction in the file.) Consider to keep your ledger under a version control to make any changes easy to review.

Similar projects

I started Beanclerk to try out some Python packages and programming concepts. Actually, there are a couple of interesting projects of similar sort:

  • beancount-import: Web UI for semi-automatically importing external data into beancount.
  • finance-dl: Tools for automatically downloading/scraping personal financial data.
  • beancount_reds_importers: Simple ingesting tools for Beancount (plain text, double entry accounting software). More importantly, a framework to allow you to easily write your own importers.
  • smart_importer: Augment Beancount importers with machine learning functionality.
  • autobean: A collection of plugins and scripts that help automating bookkeeping with beancount.

Contributing

Set up a development environment:

pipenv sync --dev
pipenv run pre-commit install

Run tests:

pytest

Follow Conventional Commits.

License

Following the Beancount license, this code is distributed under the terms of the "GNU GPLv2 only".

Metadata

Release files for beanclerk 0.0.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for beanclerk 0.0.13
File Size Uploaded
beanclerk-0.0.13.tar.gz 67.2 kB Details

Built distribution (wheel)

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

Total release size: 98.4 kB

Release files / beanclerk-0.0.13.tar.gz

Download URL beanclerk-0.0.13.tar.gz
Size 67.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a44fe340e3d3f32aad338ba44416579f2f906c42fc8a2de48928946886852a52
BLAKE2b-256 checksum
How to use checksums
7065c961d3e841ff0c7868e999a70621a6b98f08d212cbc3e6a6e53b8a326b83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.5

Release files / beanclerk-0.0.13-py3-none-any.whl

Download URL beanclerk-0.0.13-py3-none-any.whl
Size 31.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f70ae7ae1f31edeb6345334742b753e173f8b345c64f9c14c876dd48c1ca0a2
BLAKE2b-256 checksum
How to use checksums
8f023dc89390821eeb1ce144b29cf92e16b4ee5c530c0fc90e297770183dcd8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.5

Release history Release notifications | RSS feed

This release

0.0.13 This release

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release 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