Python modules and scripts to download bank statements and import them into Beancount.
I'm using uv to create a virtual environment and install the dependencies:
$ uv venv
$ source .venv/bin/activate
$ uv syncI recommend using (direnv)[https://direnv.net/] to automatically activate the environment in your shell when entering the directory. Setup for this project:
$ echo 'export VIRTUAL_ENV=".venv"\nlayout python' > .envrc
$ direnv allow
Two entry points, pybank-import and pybank-fetch. Run either with
--help for details.
$ uv run pybank-import --config "$config" extract "$statements" > "$outfile"The config is TOML, mostly one section per institution. The optional
[accounts] table names the accounts that several importers book to. Each
key is optional:
[accounts]
bank_fees = "Expenses:Fees:Bank"
fx_fees = "Expenses:Fees:ForeignExchange" # The spread of a conversion.
opening_balances = "Equity:Opening-Balances"
withholding_tax = "Expenses:Taxes:Withholding"[ibkr] needs cash and securities. [ibkr], [schwab.brokerage] and
[schwab.eac] take withholding_tax from [accounts] unless they name
their own.
$ uv run pytest
$ uv run ruff check
$ uv run ruff formatThe review page of pybank-import review-ui is a React app in web/. Its
build goes into src/pybank/web/static/:
$ cd web && npm install && npm run buildThe selenium scrapers under src/pybank/download are unmaintained. They are
kept for reference until replaced, see docs/plans. They need:
$ brew install geckodriver chromedriver