camt053-loader-mt942
Converts legacy SWIFT MT942 interim transaction reports into the camt053 model as ISO 20022 camt.052 account reports.
Contents
Getting started
- Install —
pip install, one runtime dependency - Requirements — toolchain floor, platforms
- Quick Start — one call from MT942 text to a camt.052
ParsedDocument
The camt053-loader-mt942 ecosystem
- The camt053-loader-mt942 ecosystem — the six packages of the camt053 suite
Library reference
- Capabilities at a glance — the current surface by theme
- Ecosystem comparison — short matrix; full table at
docs/COMPARISON.md - Benchmarks — headline numbers; full table at
docs/BENCHMARKS.md - Features — module-level capability list
- Configuration — core options
- Examples — runnable example index
Operational
- When not to use camt053-loader-mt942 — limitations
- Development — make targets, fuzzing, CI
- Security — guarantees and compliance
- Documentation — all reference docs
- Stability guarantees — SemVer axis, output stability, minimum toolchain discipline
- License
Install
As a Python library
pip install camt053-loader-mt942
Latest release: v0.0.23. SWIFT MT942 (the intraday sibling of MT940) is scheduled for retirement in November 2028. This loader covers the window where banks still produce MT942 but downstream tooling expects camt.052.
The package pulls in camt053 and has no other runtime
dependency. It is pure Python and runs wherever camt053 does.
Requirements
- Python 3.10 or newer, tested in CI on 3.10, 3.11, 3.12, 3.13 and 3.14 on Linux (toolchain policy).
camt0530.0.23 or newer, below 1.0. The camt053 suite releases at one version, so install the matchingcamt053release alongside this one.
Quick Start
from camt053_loader_mt942 import parse_mt942
mt942 = """:20:INTRA-REF-1
:25:COBADEFFXXX/DE89370400440532013000
:28C:42/1
:34F:EURD1000,00
:34F:EURC500,00
:13D:2606211430+0200
:61:2606210621CR500,00NMSCREF1//CREF1
:86:Customer payment for invoice 123
:61:2606210621D200,00NMSCREF2//CREF2
:86:Card settlement
:90D:1EUR200,00
:90C:1EUR500,00
"""
document = parse_mt942(mt942)
print(document.message_type) # camt.052.001.08
print(document.msg_id) # INTRA-REF-1
print(document.statements[0].account.iban) # DE89370400440532013000
print(document.creation_date_time) # 2026-06-21T14:30:00+02:00
parse_mt942 returns a camt053.models.ParsedDocument, the same shape the
camt053 camt.052 XML parser produces, tagged camt.052.001.08. Every
consumer in the suite (the Excel writer, the validator, the MCP and LSP
servers) reads it unchanged. A malformed or incomplete report raises
ValueError naming the field.
The camt053-loader-mt942 ecosystem
camt053-loader-mt942 is one of six independently installable packages
built around the camt053 ISO 20022 cash-management library. The
suite ships one version number across all six and releases them together,
core first; a scheduled job compares every member against PyPI.
| Component | Purpose | Use case |
|---|---|---|
camt053 |
Core library, CLI and FastAPI REST API for camt.052/053/054 | You parse, validate or generate ISO 20022 statements |
camt053-mcp |
Model Context Protocol server over the core | An AI agent works with bank statements |
camt053-lsp |
Language Server Protocol server | You author statement data in an editor |
camt053-writer-xlsx |
Excel .xlsx writer for a ParsedDocument |
You hand statements to people who use spreadsheets |
camt053-loader-mt940 |
SWIFT MT940 to camt.053 loader | Your bank still sends end-of-day MT940 |
camt053-loader-mt942 |
SWIFT MT942 to camt.052 loader: this package | Your bank still sends intraday MT942 |
flowchart LR
A["MT942 text"] -->|parse_mt942| B["camt053-loader-mt942"]
B -->|ParsedDocument (camt.052)| C["camt053"]
C -->|writer / validator / MCP / LSP| D["Downstream consumers"]
Capabilities at a glance
| Area | Capability | Status |
|---|---|---|
| Parsing | :20:, :25:, :28C:, :34F:, :13D:, :61:, :86:, :90D:, :90C: |
Released |
| Output | camt053.models.ParsedDocument, message_type="camt.052.001.08" |
Released |
| Reversals | RC / RD marks set Entry.reversal_indicator |
Released |
| Interim data | Floor limits and entry summaries as proprietary type_code balances |
Released; see Features |
| Line endings | CRLF and LF parse identically | Fixed in 0.0.23 |
:61: subfield 9 |
Supplementary details kept as the entry's first detail | Fixed in 0.0.23 |
| Validation | Missing :20:, :25: or :28C: and malformed fields raise ValueError |
Released |
Ecosystem comparison
The suite reads interim and end-of-day reports through one model. What each entry point accepts and produces, from each package's source:
| Project | Input | Output message_type |
Booked balances | Floor limits and entry summaries |
|---|---|---|---|---|
| camt053-loader-mt942 | SWIFT MT942 text | camt.052.001.08 |
none (MT942 has none) | yes, proprietary codes |
camt053-loader-mt940 |
SWIFT MT940 text | camt.053.001.08 |
OPBD, CLBD, CLAV, FWAV |
no |
camt053 XML parser |
camt.052/053/054 XML | as in the document | as in the document | no |
See docs/COMPARISON.md for the evidence and complete matrix.
Benchmarks
Parse time grows linearly with both entries per report and reports per
file; the growth exponent is the number to read. Measured with
python benches/bench_parse_mt942.py on 2026-10-20.
| Scenario | Result | Environment |
|---|---|---|
| One report, 1,000 entries | 6.32 ms | Apple A18 Pro, Python 3.12.15, camt053 0.0.20 |
| One report, 5,000 entries | 34.68 ms | Apple A18 Pro, Python 3.12.15, camt053 0.0.20 |
| Growth exponent, entries per report | 0.96 (linear) | Apple A18 Pro, Python 3.12.15 |
| Growth exponent, reports per file | 1.04 (linear) | Apple A18 Pro, Python 3.12.15 |
See docs/BENCHMARKS.md for methodology and full results.
Features
The public API is one function, camt053_loader_mt942.parse_mt942(text).
Each MT942 tag maps onto the camt053 model:
| Tag | Meaning | Mapped to |
|---|---|---|
:20: |
Transaction reference number (mandatory) | ParsedDocument.msg_id |
:25: |
Account identification (mandatory; BIC/account or account) |
Statement.account (IBAN or proprietary other_id + optional servicer_bic) |
:28C: |
Statement / sequence number (mandatory) | Statement.id + Statement.electronic_seq_nb |
:34F: |
Floor limit indicator (debit / credit) | Balance with type_code="FLIMD" / "FLIMC" |
:13D: |
Date/time indication (report timestamp) | ParsedDocument.creation_date_time + Statement.creation_date_time (ISO-8601) |
:61: |
Statement line (movement) | Entry with amount, credit_debit_indicator, value_date, booking_date, reference, account_servicer_ref; line 2 (supplementary details) as the first TransactionDetails |
:86: |
Information to account owner | TransactionDetails.additional_info appended to the preceding entry |
:90D: |
Number and sum of debit entries | Balance with type_code="SUMD:<count>", amount=<sum> |
:90C: |
Number and sum of credit entries | Balance with type_code="SUMC:<count>", amount=<sum> |
- Reversals. A
:61:mark ofRD(reversal of debit) orRC(reversal of credit) setsEntry.reversal_indicator=True. - Unknown tags are ignored, so a future SWIFT addition does not break parsing.
- Interim reports carry no booked balances. MT942 has no
:60F:/:62F:. It reports movements above a floor limit (:34F:) and the number and sum of debit and credit movements (:90D:/:90C:), which camt.052 holds in<Lmt>and<TxsSummry>. - Model limitations. The
camt053model is statement-oriented: it has no field for<Lmt>,<TxsSummry>, an integer entry count, or an entry-levelAddtlNtryInf. Rather than invent fields or drop data, the loader puts floor limits and summaries onStatement.balanceswith the proprietary codes above (the:90x:count follows the colon), and:61:supplementary details on the entry's details list, ahead of any:86:text. Consumers that expect only booked balances (OPBD,CLBD) can filter the proprietary codes by prefix.
Configuration
None. parse_mt942 takes the payload and no options, reads no
environment variables and touches no files or network.
Examples
examples/01_minimal_parse.py: the smallest valid MT942, parsed and inspected (the demo above).examples/02_round_trip_to_dict.py: MT942 in,camt053to_dict()JSON out, the same shape a camt.052 XML source produces.benches/bench_parse_mt942.py: parse throughput along the two axes that grow in production.
CI runs every example and the benchmark (--quick) on every change.
When not to use camt053-loader-mt942
- You already receive camt.052 XML. Parse it with the
camt053core; this loader is the bridge for MT942-only sources. - You need MT940 (end-of-day statements). Use
camt053-loader-mt940. - You need bank-specific
:86:sub-fields (for example?20/?30structures). The raw:86:text is preserved inTransactionDetails.additional_infofor you to parse downstream. - Your MT942 arrives encrypted or inside a SWIFT FIN envelope. Decrypt and unwrap upstream and pass the report text.
- You need first-class camt.052
<Lmt>or<TxsSummry>fields. The model carries them as proprietary balance codes (see Features).
Development
git clone https://github.com/sebastienrousseau/camt053-loader-mt942
cd camt053-loader-mt942
python -m venv .venv && . .venv/bin/activate
make dev # hash-pinned toolchain from requirements/ci.txt, package editable
make check # every CI gate
make demo # re-render .github/demo.gif (needs vhs)
make check runs ruff (lint and format), mypy in strict mode, pytest with
a 100% line and branch coverage gate, the 100% docstring gate, the
complexity ceilings against complexity-baseline.json, reuse lint, the
version-source check, the benchmark and the examples. CI also runs the
test matrix on Python 3.10 to 3.14, pip-audit over the pinned
requirements, CodeQL, OpenSSF Scorecard, Atheris fuzzing of parse_mt942
(two minutes per change, 30 minutes weekly) and a daily suite-consistency
check against PyPI. Hypothesis property tests in the suite assert the same
contract: a document or a ValueError, never another exception. See
CONTRIBUTING.md.
Security
The whole attack surface is the text the parser is handed. MT942 is a flat
text format with no XML envelope, so the XXE and entity-expansion surface
lives in the camt053 core (defusedxml and its XML guard), not here. Field
regexes are anchored, and parse time is linear in input size (see
Benchmarks). A malformed report raises ValueError rather
than returning partial data, and fuzzing (Atheris, coverage-guided, on
every change) holds the parser to raising nothing else. Releases are built by a hash-pinned toolchain
from a signed tag and published with PyPI trusted publishing, SLSA build
provenance and keyless sigstore signatures.
Report vulnerabilities according to SECURITY.md.
Documentation
User manual · API reference: parse_mt942 ·
Developer guide · Family map ·
Benchmarks · Toolchain policy ·
Changelog
Stability guarantees
The project is pre-1.0 and versions advance in 0.0.1 steps, in lockstep
with the camt053 suite. The breaking axis is the document parse_mt942
returns: which fields a tag fills, the proprietary type_code values, the
message_type, and which inputs raise. A change to any of these is
breaking even when the function signature does not move, and is called out
in the changelog; 0.0.23 changes where :61:
supplementary details land. The Python floor moves only as described in the
toolchain policy.
License
This project is dual-licensed under either:
- Apache License, Version 2.0 (
LICENSE-APACHEor https://www.apache.org/licenses/LICENSE-2.0) - MIT License (
LICENSE-MITor https://opensource.org/licenses/MIT)
at your option. Dependencies keep their own licences.
Metadata
Release files for camt053-loader-mt942 0.0.23
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 | |
|---|---|---|---|---|
| camt053_loader_mt942-0.0.23.tar.gz | 383.2 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| camt053_loader_mt942-0.0.23-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 402.6 kB
Release files / camt053_loader_mt942-0.0.23.tar.gz
| Download URL | camt053_loader_mt942-0.0.23.tar.gz |
|---|---|
| Size | 383.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c522189b4a5b91c6caacc5d1641b5faa5edab0d6024d701be61775f24e23998
|
|
BLAKE2b-256 checksum How to use checksums |
90b599edd6d130393ce1a10efcddc2a66ff9effd022bef0a71276674257d0dc5
|
| 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 21, 2026.
Transparency logRelease files / camt053_loader_mt942-0.0.23-py3-none-any.whl
| Download URL | camt053_loader_mt942-0.0.23-py3-none-any.whl |
|---|---|
| Size | 19.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9a9414394ba88dbf6d9e05be91fc6b6145fac1b738ca1fd670bfa35288ba1a58
|
|
BLAKE2b-256 checksum How to use checksums |
d57ecd1d29097e64f08999d9b0557259d197dfdcc259c046b2796f3e73d9e4dc
|
| 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 21, 2026.
Transparency logSecurity for camt053-loader-mt942 0.0.23
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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for camt053_loader_mt942-0.0.23.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 21, 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.