beangulp-mt940
beangulp importer for SWIFT MT940
bank statements (tested against UBS Switzerland exports), built on the
mt-940 parser.
What it does
- Drafts one beancount transaction per
:61:statement line, with the bank's unique entry reference (the part after//) asmt940_ref:metadata.extract()skips references already present anywhere in the existing ledger — re-running an import is safe. A line without a reference (empty, or SWIFT'sNONREFfiller) gets no key and is never skipped; if it is imported twice, the closingbalanceassertion fails. - Refuses a file with statements for more than one account (
:25:) — export one file per account. Several statements for the same account are fine. - Books reversals with the right sign:
RC(reversal of credit) is a debit,RD(reversal of debit) a credit. - Takes the currency from the statement's balances; a statement without any
needs
currency=on the importer, otherwiseextract()raises. - Emits a
balanceassertion from the:62F:closing balance, dated the day after (beancount balances are beginning-of-day). - Skips zero-amount noise entries (e.g. UBS "Balance closing of service prices").
- Optional
payee_rulesdraft the counter leg: an iterable of(regex, account, flag)matched case-insensitively against the payee and the full:86:details. Unmatched entries keep the!review flag and the cash leg only — classification, VAT treatment, and document evidence stay a human decision.
Usage
from beangulp_mt940 import Importer
importer = Importer(
"Assets:Bank:Checking",
iban="CH93 0076 2011 6238 5295 7", # identify() filter, optional
payee_rules=(
(r"client ag", "Assets:Receivable", "*"),
(r"hosting", "Expenses:IT:Hosting", "!"),
),
)
entries = importer.extract("statement.mt940", existing=ledger_entries)
Works standalone (as above) or as a regular importer in a beangulp
import_config.py.
Notes on UBS specifics
- UBS puts the counterparty in
:86:after a transaction code and?(DE1?Google Workspace …); the importer's payee heuristic handles both this and plain details. - The supplementary line under
:61:("Debit card payment", "e-banking credit", …) becomes the narration. - Transaction dates use the value date; the entry (booking) date is available in the source if you need it.
Metadata
Release files for beangulp-mt940 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| beangulp_mt940-0.2.0.tar.gz | 13.8 kB | With provenance | Details for beangulp_mt940-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| beangulp_mt940-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for beangulp_mt940-0.2.0-py3-none-any.whl |
Total release size: 26.4 kB
Release files / beangulp_mt940-0.2.0.tar.gz
| Download URL | beangulp_mt940-0.2.0.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0973fe7d8f366e88a56769f5b3496ed3c194c06938883aa6dec9ae288ed9dd04
|
|
BLAKE2b-256 checksum How to use checksums |
6cf71758cdd6fc22a51ae648c9490f70ce48368e876ccc9e56411076e119573c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logRelease files / beangulp_mt940-0.2.0-py3-none-any.whl
| Download URL | beangulp_mt940-0.2.0-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a3cc41b86d6377739cf19fefd79a191396197a7753a497878c6c718736189835
|
|
BLAKE2b-256 checksum How to use checksums |
48397587780727fef737dd1cbcb652ea70d58fa6383203cae963585e09e17f36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logSecurity for beangulp-mt940 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for beangulp_mt940-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.