bankstatementparser 0.0.27__tar.gz → 0.0.28__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/PKG-INFO +41 -17
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/README.md +38 -14
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/__init__.py +1 -1
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/pyproject.toml +3 -2
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/LICENSE +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/LICENSE-APACHE +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/LICENSE-MIT +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/_amounts.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/_llm_common.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/additional_parsers.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/analytics/__init__.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/analytics/cash_flow.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/analytics/common.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/analytics/models.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/analytics/patterns.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/api.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/api_limits.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/api_worker.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/bank_statement_parsers.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/base_parser.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/camt_parser.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/camt_reports.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/cli.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/enrichment/__init__.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/enrichment/account_mapper.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/enrichment/categorizer.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/exceptions.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/export/__init__.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/export/ledger.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/export/parquet.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/field86_parser.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/forensics.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/hybrid/__init__.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/hybrid/evaluation.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/hybrid/llm_extractor.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/hybrid/ollama_direct.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/hybrid/orchestrator.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/hybrid/pdf_text.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/hybrid/prompts.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/hybrid/scanner.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/hybrid/verification.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/hybrid/vision.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/input_validator.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/pain001_parser.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/parallel.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/parsers/__init__.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/parsers/bai2.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/parsers/common.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/parsers/csv_parser.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/parsers/mt940.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/parsers/mt942.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/parsers/ofx.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/plugins.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/privacy.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/py.typed +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/reconciliation.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/record_types.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/telemetry.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/transaction_deduplicator.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/transaction_models.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/xml_validator.py +0 -0
- {bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/zip_security.py +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bankstatementparser
|
|
3
|
-
Version: 0.0.
|
|
4
|
-
Summary: Parse bank statements (CAMT
|
|
3
|
+
Version: 0.0.28
|
|
4
|
+
Summary: Parse bank statements (CAMT, PAIN.001, MT940, MT942, OFX, BAI2, CSV, and PDF) into unified Transactions with treasury analytics, 2-way reconciliation, PDF forensics, and ledger export.
|
|
5
5
|
License: Apache-2.0 OR MIT
|
|
6
6
|
License-File: LICENSE
|
|
7
7
|
License-File: LICENSE-APACHE
|
|
8
8
|
License-File: LICENSE-MIT
|
|
9
|
-
Keywords: banking,finance,iso20022,camt053,pain001,mt940,ofx,bai2,sepa,fintech,treasury,python,reconciliation,hledger,beancount,parquet,pdf-parsing,fastapi,cli,bank-statements
|
|
9
|
+
Keywords: banking,finance,iso20022,camt053,pain001,mt940,mt942,ofx,bai2,sepa,fintech,treasury,python,reconciliation,hledger,beancount,parquet,pdf-parsing,fastapi,cli,bank-statements
|
|
10
10
|
Author: Sebastien Rousseau
|
|
11
11
|
Author-email: sebastian.rousseau@gmail.com
|
|
12
12
|
Requires-Python: >=3.10,<4.0
|
|
@@ -57,14 +57,14 @@ Description-Content-Type: text/markdown
|
|
|
57
57
|
<h1 align="center">Bank Statement Parser</h1>
|
|
58
58
|
|
|
59
59
|
<p align="center">
|
|
60
|
-
Bank statement parsing for Python —
|
|
60
|
+
Bank statement parsing for Python — eight structured formats and
|
|
61
61
|
PDFs, digital or scanned, into one auditable
|
|
62
62
|
<code>Transaction</code> model.
|
|
63
63
|
</p>
|
|
64
64
|
|
|
65
65
|
<p align="center">
|
|
66
66
|
<a href="https://github.com/sebastienrousseau/bankstatementparser/actions"><img src="https://img.shields.io/github/actions/workflow/status/sebastienrousseau/bankstatementparser/quality-gates.yml?style=for-the-badge&logo=github" alt="Build" /></a>
|
|
67
|
-
<a href="https://pypi.org/project/bankstatementparser/"><img src="https://img.shields.io/pypi/pyversions/bankstatementparser.svg?style=for-the-badge&v=0.0.
|
|
67
|
+
<a href="https://pypi.org/project/bankstatementparser/"><img src="https://img.shields.io/pypi/pyversions/bankstatementparser.svg?style=for-the-badge&v=0.0.28" alt="PyPI" /></a>
|
|
68
68
|
<a href="https://pypi.org/project/bankstatementparser/"><img src="https://img.shields.io/pypi/dm/bankstatementparser.svg?style=for-the-badge" alt="PyPI Downloads" /></a>
|
|
69
69
|
<a href="https://codecov.io/github/sebastienrousseau/bankstatementparser?branch=main"><img src="https://img.shields.io/codecov/c/github/sebastienrousseau/bankstatementparser?style=for-the-badge" alt="Codecov" /></a>
|
|
70
70
|
<a href="LICENSE"><img src="https://img.shields.io/github/license/sebastienrousseau/bankstatementparser?style=for-the-badge" alt="License" /></a>
|
|
@@ -72,8 +72,8 @@ Description-Content-Type: text/markdown
|
|
|
72
72
|
|
|
73
73
|
---
|
|
74
74
|
|
|
75
|
-
Parse bank statements across **
|
|
76
|
-
PAIN.001, CSV, OFX
|
|
75
|
+
Parse bank statements across **eight structured formats** (CAMT,
|
|
76
|
+
PAIN.001, CSV, OFX, QFX, MT940, MT942, BAI2) **and PDFs** — both digital and
|
|
77
77
|
scanned — into a single unified `Transaction` model. ISO 20022
|
|
78
78
|
files take the deterministic path; PDFs fall through to a
|
|
79
79
|
configurable LLM (Ollama by default, any LiteLLM-supported
|
|
@@ -107,7 +107,7 @@ services unless they explicitly opt in.
|
|
|
107
107
|
- [Parallel Parsing](#parallel-parsing) — multi-file batches across CPU cores
|
|
108
108
|
- [Command Line](#command-line) — console script and REST API
|
|
109
109
|
- [Deduplication](#deduplication) — exact hashes + suspected matches
|
|
110
|
-
- [Export](#export) — CSV, JSON, Excel, Polars, hledger, beancount
|
|
110
|
+
- [Export](#export) — CSV, JSON, Excel, Polars, Parquet, hledger, beancount
|
|
111
111
|
- [Examples](#examples) — 23 runnable scripts (14 deterministic + 9 hybrid)
|
|
112
112
|
- [XML Tag Mapping](#xml-tag-mapping) — ISO 20022 tags to DataFrame columns
|
|
113
113
|
- [Ecosystem](#ecosystem) — companion packages (MCP, LSP, writers, loaders)
|
|
@@ -128,12 +128,18 @@ services unless they explicitly opt in.
|
|
|
128
128
|
## Install
|
|
129
129
|
|
|
130
130
|
```bash
|
|
131
|
-
# Core install — deterministic parsers only (CAMT, PAIN.001, CSV, OFX, QFX, MT940)
|
|
131
|
+
# Core install — deterministic parsers only (CAMT, PAIN.001, CSV, OFX, QFX, MT940, MT942, BAI2)
|
|
132
132
|
pip install bankstatementparser
|
|
133
133
|
|
|
134
134
|
# Add Excel (.xlsx) export support (openpyxl)
|
|
135
135
|
pip install 'bankstatementparser[excel]'
|
|
136
136
|
|
|
137
|
+
# Add Apache Parquet export support (pyarrow)
|
|
138
|
+
pip install 'bankstatementparser[parquet]'
|
|
139
|
+
|
|
140
|
+
# Add Polars DataFrame export support
|
|
141
|
+
pip install 'bankstatementparser[polars]'
|
|
142
|
+
|
|
137
143
|
# Add the text-LLM path for digital PDFs (litellm + pypdf)
|
|
138
144
|
pip install 'bankstatementparser[hybrid]'
|
|
139
145
|
|
|
@@ -161,7 +167,7 @@ required.
|
|
|
161
167
|
- Poetry (for local development).
|
|
162
168
|
|
|
163
169
|
> **Python version note.** The deterministic core (CAMT, PAIN.001,
|
|
164
|
-
> CSV, OFX, QFX, MT940) supports Python **3.10–3.14**. The optional
|
|
170
|
+
> CSV, OFX, QFX, MT940, MT942, BAI2) supports Python **3.10–3.14**. The optional
|
|
165
171
|
> `[hybrid]`, `[hybrid-plus]`, `[hybrid-vision]`, and
|
|
166
172
|
> `[enrichment]` extras pull in `litellm`, which currently requires
|
|
167
173
|
> **Python <3.14** upstream — on Python 3.14 the LLM extras will
|
|
@@ -316,7 +322,7 @@ Gemini, …).
|
|
|
316
322
|
```mermaid
|
|
317
323
|
flowchart TD
|
|
318
324
|
A["smart_ingest(path)"] --> B{"detect_statement_format"}
|
|
319
|
-
B -->|CAMT/PAIN/OFX/MT940/CSV| C["Path A: deterministic parser<br/>$0, fastest"]
|
|
325
|
+
B -->|CAMT/PAIN/OFX/MT940/MT942/BAI2/CSV| C["Path A: deterministic parser<br/>$0, fastest"]
|
|
320
326
|
C --> Z["IngestResult<br/>source_method='deterministic'"]
|
|
321
327
|
|
|
322
328
|
B -->|pdf or unknown| D["pypdf extract_text"]
|
|
@@ -348,7 +354,7 @@ for the full surface.
|
|
|
348
354
|
|
|
349
355
|
| Feature | Description |
|
|
350
356
|
|---|---|
|
|
351
|
-
| **
|
|
357
|
+
| **8 structured formats** | CAMT (052, 053, 054), PAIN.001, MT940, MT942, BAI2, OFX, QFX, CSV |
|
|
352
358
|
| **Auto-detection** | `detect_statement_format()` identifies the format; `create_parser()` returns the right parser |
|
|
353
359
|
| **Streaming** | `parse_streaming()` at 27,000+ tx/s (CAMT) and 52,000+ tx/s (PAIN.001) with bounded memory |
|
|
354
360
|
| **Parallel** | `parse_files_parallel()` for multi-file batch processing across CPU cores |
|
|
@@ -381,7 +387,7 @@ for the full surface.
|
|
|
381
387
|
| **Categorization** *(v0.0.6)* | `bankstatementparser.enrichment.Categorizer` tags transactions with a pluggable category schema (Plaid 13-category default) and an optional `is_business_expense` flag. Wrapper model — never mutates the original `Transaction`. |
|
|
382
388
|
| **Account mapping** *(v0.0.8)* | `AccountMapper` with ordered regex rules loaded from JSON config. First match wins. Pairs with the ledger exporter for end-to-end plaintext-accounting workflows. |
|
|
383
389
|
| **hledger + beancount export** *(v0.0.8)* | `to_hledger()` and `to_beancount()` produce journal strings for plaintext-accounting workflows. Uses `Transaction.category` as the contra-account when set. |
|
|
384
|
-
| **Export** | CSV, JSON, Excel (`.xlsx`), and optional Polars DataFrames |
|
|
390
|
+
| **Export** | CSV, JSON, Excel (`.xlsx`), Apache Parquet (`.parquet`), and optional Polars DataFrames |
|
|
385
391
|
| **REST API** *(v0.0.8)* | FastAPI microservice: `POST /ingest` a file, get JSON back. `GET /health` for monitoring. `pip install 'bankstatementparser[api]'`. |
|
|
386
392
|
|
|
387
393
|
### Security & quality
|
|
@@ -597,6 +603,24 @@ lazy_df = parser.to_polars_lazy()
|
|
|
597
603
|
|
|
598
604
|
Install with `pip install bankstatementparser[polars]`.
|
|
599
605
|
|
|
606
|
+
### Apache Parquet (optional)
|
|
607
|
+
|
|
608
|
+
Export transactions to Apache Parquet columnar files in batch or streaming mode:
|
|
609
|
+
|
|
610
|
+
```python
|
|
611
|
+
from bankstatementparser.export import export_parquet, ParquetStreamWriter
|
|
612
|
+
|
|
613
|
+
# Batch export
|
|
614
|
+
export_parquet(transactions, "output.parquet")
|
|
615
|
+
|
|
616
|
+
# Streaming export with bounded memory and atomic file commits
|
|
617
|
+
with ParquetStreamWriter("output_stream.parquet", batch_size=1000) as writer:
|
|
618
|
+
for tx in transactions:
|
|
619
|
+
writer.write_record(tx)
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
Install with `pip install 'bankstatementparser[parquet]'`.
|
|
623
|
+
|
|
600
624
|
### hledger + beancount *(v0.0.8)*
|
|
601
625
|
|
|
602
626
|
Export transactions to plaintext-accounting journal formats:
|
|
@@ -701,7 +725,7 @@ results.
|
|
|
701
725
|
## XML Tag Mapping
|
|
702
726
|
|
|
703
727
|
See [`docs/MAPPING.md`](docs/MAPPING.md) for a complete reference
|
|
704
|
-
of ISO 20022 XML tags to DataFrame columns across all
|
|
728
|
+
of ISO 20022 XML tags to DataFrame columns across all structured formats.
|
|
705
729
|
Use this when integrating with ERP systems or building
|
|
706
730
|
reconciliation pipelines.
|
|
707
731
|
|
|
@@ -716,7 +740,7 @@ stays dependency-light.
|
|
|
716
740
|
|
|
717
741
|
| Package | GitHub Repository | PyPI | Role | Description |
|
|
718
742
|
|---|---|---|---|---|
|
|
719
|
-
| [`bankstatementparser`](https://github.com/sebastienrousseau/bankstatementparser) | [`sebastienrousseau/bankstatementparser`](https://github.com/sebastienrousseau/bankstatementparser) | [](https://pypi.org/project/bankstatementparser/) | Core Engine | Unified parser for CAMT (052/053), PAIN.001, CSV, OFX, QFX, MT940, and PDF statements |
|
|
743
|
+
| [`bankstatementparser`](https://github.com/sebastienrousseau/bankstatementparser) | [`sebastienrousseau/bankstatementparser`](https://github.com/sebastienrousseau/bankstatementparser) | [](https://pypi.org/project/bankstatementparser/) | Core Engine | Unified parser for CAMT (052/053/054), PAIN.001, CSV, OFX, QFX, MT940, MT942, BAI2, and PDF statements |
|
|
720
744
|
| [`bankstatementparser-mcp`](https://github.com/sebastienrousseau/bankstatementparser-mcp) | [`sebastienrousseau/bankstatementparser-mcp`](https://github.com/sebastienrousseau/bankstatementparser-mcp) | [](https://pypi.org/project/bankstatementparser-mcp/) | AI Protocol | Model Context Protocol (MCP) server exposing statement tools to LLMs & AI agents |
|
|
721
745
|
| [`bankstatementparser-lsp`](https://github.com/sebastienrousseau/bankstatementparser-lsp) | [`sebastienrousseau/bankstatementparser-lsp`](https://github.com/sebastienrousseau/bankstatementparser-lsp) | [](https://pypi.org/project/bankstatementparser-lsp/) | Developer Tooling | Language Server Protocol (LSP) with live SWIFT MT940 statement validation & diagnostics |
|
|
722
746
|
| [`bankstatementparser-transport-ebics`](https://github.com/sebastienrousseau/bankstatementparser-transport-ebics) | [`sebastienrousseau/bankstatementparser-transport-ebics`](https://github.com/sebastienrousseau/bankstatementparser-transport-ebics) | [](https://pypi.org/project/bankstatementparser-transport-ebics/) | Transport | Automated bank statement retrieval over EBICS 3.0 (`H005`) and 2.5 (`H004`) protocols |
|
|
@@ -752,7 +776,7 @@ cleanly — see each companion's README for runnable examples.
|
|
|
752
776
|
```text
|
|
753
777
|
bankstatementparser/ Source code (55 modules)
|
|
754
778
|
bankstatementparser/analytics/ Financial metrics, cash flow, cadence & anomaly detection
|
|
755
|
-
bankstatementparser/parsers/ Modular statement parsers (CSV, MT940, OFX/QFX)
|
|
779
|
+
bankstatementparser/parsers/ Modular statement parsers (CSV, MT940, MT942, BAI2, OFX/QFX)
|
|
756
780
|
bankstatementparser/hybrid/ PDF pipeline: orchestrator, llm_extractor, vision, scanner, ollama_direct, verification
|
|
757
781
|
bankstatementparser/enrichment/ Categorizer, AccountMapper, EnrichedTransaction
|
|
758
782
|
bankstatementparser/export/ hledger + beancount journal export, Apache Parquet columnar export
|
|
@@ -825,7 +849,7 @@ Signed commits required. See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
|
825
849
|
## FAQ
|
|
826
850
|
|
|
827
851
|
**What formats are supported?**
|
|
828
|
-
CAMT.053, PAIN.001,
|
|
852
|
+
CAMT (CAMT.052, CAMT.053, CAMT.054), PAIN.001, SWIFT MT940, SWIFT MT942, BAI2, OFX, QFX, CSV, and PDF.
|
|
829
853
|
|
|
830
854
|
**Does any data leave my infrastructure?**
|
|
831
855
|
No. Zero network calls. XML parsers enforce `no_network=True`. No
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
<h1 align="center">Bank Statement Parser</h1>
|
|
13
13
|
|
|
14
14
|
<p align="center">
|
|
15
|
-
Bank statement parsing for Python —
|
|
15
|
+
Bank statement parsing for Python — eight structured formats and
|
|
16
16
|
PDFs, digital or scanned, into one auditable
|
|
17
17
|
<code>Transaction</code> model.
|
|
18
18
|
</p>
|
|
19
19
|
|
|
20
20
|
<p align="center">
|
|
21
21
|
<a href="https://github.com/sebastienrousseau/bankstatementparser/actions"><img src="https://img.shields.io/github/actions/workflow/status/sebastienrousseau/bankstatementparser/quality-gates.yml?style=for-the-badge&logo=github" alt="Build" /></a>
|
|
22
|
-
<a href="https://pypi.org/project/bankstatementparser/"><img src="https://img.shields.io/pypi/pyversions/bankstatementparser.svg?style=for-the-badge&v=0.0.
|
|
22
|
+
<a href="https://pypi.org/project/bankstatementparser/"><img src="https://img.shields.io/pypi/pyversions/bankstatementparser.svg?style=for-the-badge&v=0.0.28" alt="PyPI" /></a>
|
|
23
23
|
<a href="https://pypi.org/project/bankstatementparser/"><img src="https://img.shields.io/pypi/dm/bankstatementparser.svg?style=for-the-badge" alt="PyPI Downloads" /></a>
|
|
24
24
|
<a href="https://codecov.io/github/sebastienrousseau/bankstatementparser?branch=main"><img src="https://img.shields.io/codecov/c/github/sebastienrousseau/bankstatementparser?style=for-the-badge" alt="Codecov" /></a>
|
|
25
25
|
<a href="LICENSE"><img src="https://img.shields.io/github/license/sebastienrousseau/bankstatementparser?style=for-the-badge" alt="License" /></a>
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
|
|
28
28
|
---
|
|
29
29
|
|
|
30
|
-
Parse bank statements across **
|
|
31
|
-
PAIN.001, CSV, OFX
|
|
30
|
+
Parse bank statements across **eight structured formats** (CAMT,
|
|
31
|
+
PAIN.001, CSV, OFX, QFX, MT940, MT942, BAI2) **and PDFs** — both digital and
|
|
32
32
|
scanned — into a single unified `Transaction` model. ISO 20022
|
|
33
33
|
files take the deterministic path; PDFs fall through to a
|
|
34
34
|
configurable LLM (Ollama by default, any LiteLLM-supported
|
|
@@ -62,7 +62,7 @@ services unless they explicitly opt in.
|
|
|
62
62
|
- [Parallel Parsing](#parallel-parsing) — multi-file batches across CPU cores
|
|
63
63
|
- [Command Line](#command-line) — console script and REST API
|
|
64
64
|
- [Deduplication](#deduplication) — exact hashes + suspected matches
|
|
65
|
-
- [Export](#export) — CSV, JSON, Excel, Polars, hledger, beancount
|
|
65
|
+
- [Export](#export) — CSV, JSON, Excel, Polars, Parquet, hledger, beancount
|
|
66
66
|
- [Examples](#examples) — 23 runnable scripts (14 deterministic + 9 hybrid)
|
|
67
67
|
- [XML Tag Mapping](#xml-tag-mapping) — ISO 20022 tags to DataFrame columns
|
|
68
68
|
- [Ecosystem](#ecosystem) — companion packages (MCP, LSP, writers, loaders)
|
|
@@ -83,12 +83,18 @@ services unless they explicitly opt in.
|
|
|
83
83
|
## Install
|
|
84
84
|
|
|
85
85
|
```bash
|
|
86
|
-
# Core install — deterministic parsers only (CAMT, PAIN.001, CSV, OFX, QFX, MT940)
|
|
86
|
+
# Core install — deterministic parsers only (CAMT, PAIN.001, CSV, OFX, QFX, MT940, MT942, BAI2)
|
|
87
87
|
pip install bankstatementparser
|
|
88
88
|
|
|
89
89
|
# Add Excel (.xlsx) export support (openpyxl)
|
|
90
90
|
pip install 'bankstatementparser[excel]'
|
|
91
91
|
|
|
92
|
+
# Add Apache Parquet export support (pyarrow)
|
|
93
|
+
pip install 'bankstatementparser[parquet]'
|
|
94
|
+
|
|
95
|
+
# Add Polars DataFrame export support
|
|
96
|
+
pip install 'bankstatementparser[polars]'
|
|
97
|
+
|
|
92
98
|
# Add the text-LLM path for digital PDFs (litellm + pypdf)
|
|
93
99
|
pip install 'bankstatementparser[hybrid]'
|
|
94
100
|
|
|
@@ -116,7 +122,7 @@ required.
|
|
|
116
122
|
- Poetry (for local development).
|
|
117
123
|
|
|
118
124
|
> **Python version note.** The deterministic core (CAMT, PAIN.001,
|
|
119
|
-
> CSV, OFX, QFX, MT940) supports Python **3.10–3.14**. The optional
|
|
125
|
+
> CSV, OFX, QFX, MT940, MT942, BAI2) supports Python **3.10–3.14**. The optional
|
|
120
126
|
> `[hybrid]`, `[hybrid-plus]`, `[hybrid-vision]`, and
|
|
121
127
|
> `[enrichment]` extras pull in `litellm`, which currently requires
|
|
122
128
|
> **Python <3.14** upstream — on Python 3.14 the LLM extras will
|
|
@@ -271,7 +277,7 @@ Gemini, …).
|
|
|
271
277
|
```mermaid
|
|
272
278
|
flowchart TD
|
|
273
279
|
A["smart_ingest(path)"] --> B{"detect_statement_format"}
|
|
274
|
-
B -->|CAMT/PAIN/OFX/MT940/CSV| C["Path A: deterministic parser<br/>$0, fastest"]
|
|
280
|
+
B -->|CAMT/PAIN/OFX/MT940/MT942/BAI2/CSV| C["Path A: deterministic parser<br/>$0, fastest"]
|
|
275
281
|
C --> Z["IngestResult<br/>source_method='deterministic'"]
|
|
276
282
|
|
|
277
283
|
B -->|pdf or unknown| D["pypdf extract_text"]
|
|
@@ -303,7 +309,7 @@ for the full surface.
|
|
|
303
309
|
|
|
304
310
|
| Feature | Description |
|
|
305
311
|
|---|---|
|
|
306
|
-
| **
|
|
312
|
+
| **8 structured formats** | CAMT (052, 053, 054), PAIN.001, MT940, MT942, BAI2, OFX, QFX, CSV |
|
|
307
313
|
| **Auto-detection** | `detect_statement_format()` identifies the format; `create_parser()` returns the right parser |
|
|
308
314
|
| **Streaming** | `parse_streaming()` at 27,000+ tx/s (CAMT) and 52,000+ tx/s (PAIN.001) with bounded memory |
|
|
309
315
|
| **Parallel** | `parse_files_parallel()` for multi-file batch processing across CPU cores |
|
|
@@ -336,7 +342,7 @@ for the full surface.
|
|
|
336
342
|
| **Categorization** *(v0.0.6)* | `bankstatementparser.enrichment.Categorizer` tags transactions with a pluggable category schema (Plaid 13-category default) and an optional `is_business_expense` flag. Wrapper model — never mutates the original `Transaction`. |
|
|
337
343
|
| **Account mapping** *(v0.0.8)* | `AccountMapper` with ordered regex rules loaded from JSON config. First match wins. Pairs with the ledger exporter for end-to-end plaintext-accounting workflows. |
|
|
338
344
|
| **hledger + beancount export** *(v0.0.8)* | `to_hledger()` and `to_beancount()` produce journal strings for plaintext-accounting workflows. Uses `Transaction.category` as the contra-account when set. |
|
|
339
|
-
| **Export** | CSV, JSON, Excel (`.xlsx`), and optional Polars DataFrames |
|
|
345
|
+
| **Export** | CSV, JSON, Excel (`.xlsx`), Apache Parquet (`.parquet`), and optional Polars DataFrames |
|
|
340
346
|
| **REST API** *(v0.0.8)* | FastAPI microservice: `POST /ingest` a file, get JSON back. `GET /health` for monitoring. `pip install 'bankstatementparser[api]'`. |
|
|
341
347
|
|
|
342
348
|
### Security & quality
|
|
@@ -552,6 +558,24 @@ lazy_df = parser.to_polars_lazy()
|
|
|
552
558
|
|
|
553
559
|
Install with `pip install bankstatementparser[polars]`.
|
|
554
560
|
|
|
561
|
+
### Apache Parquet (optional)
|
|
562
|
+
|
|
563
|
+
Export transactions to Apache Parquet columnar files in batch or streaming mode:
|
|
564
|
+
|
|
565
|
+
```python
|
|
566
|
+
from bankstatementparser.export import export_parquet, ParquetStreamWriter
|
|
567
|
+
|
|
568
|
+
# Batch export
|
|
569
|
+
export_parquet(transactions, "output.parquet")
|
|
570
|
+
|
|
571
|
+
# Streaming export with bounded memory and atomic file commits
|
|
572
|
+
with ParquetStreamWriter("output_stream.parquet", batch_size=1000) as writer:
|
|
573
|
+
for tx in transactions:
|
|
574
|
+
writer.write_record(tx)
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
Install with `pip install 'bankstatementparser[parquet]'`.
|
|
578
|
+
|
|
555
579
|
### hledger + beancount *(v0.0.8)*
|
|
556
580
|
|
|
557
581
|
Export transactions to plaintext-accounting journal formats:
|
|
@@ -656,7 +680,7 @@ results.
|
|
|
656
680
|
## XML Tag Mapping
|
|
657
681
|
|
|
658
682
|
See [`docs/MAPPING.md`](docs/MAPPING.md) for a complete reference
|
|
659
|
-
of ISO 20022 XML tags to DataFrame columns across all
|
|
683
|
+
of ISO 20022 XML tags to DataFrame columns across all structured formats.
|
|
660
684
|
Use this when integrating with ERP systems or building
|
|
661
685
|
reconciliation pipelines.
|
|
662
686
|
|
|
@@ -671,7 +695,7 @@ stays dependency-light.
|
|
|
671
695
|
|
|
672
696
|
| Package | GitHub Repository | PyPI | Role | Description |
|
|
673
697
|
|---|---|---|---|---|
|
|
674
|
-
| [`bankstatementparser`](https://github.com/sebastienrousseau/bankstatementparser) | [`sebastienrousseau/bankstatementparser`](https://github.com/sebastienrousseau/bankstatementparser) | [](https://pypi.org/project/bankstatementparser/) | Core Engine | Unified parser for CAMT (052/053), PAIN.001, CSV, OFX, QFX, MT940, and PDF statements |
|
|
698
|
+
| [`bankstatementparser`](https://github.com/sebastienrousseau/bankstatementparser) | [`sebastienrousseau/bankstatementparser`](https://github.com/sebastienrousseau/bankstatementparser) | [](https://pypi.org/project/bankstatementparser/) | Core Engine | Unified parser for CAMT (052/053/054), PAIN.001, CSV, OFX, QFX, MT940, MT942, BAI2, and PDF statements |
|
|
675
699
|
| [`bankstatementparser-mcp`](https://github.com/sebastienrousseau/bankstatementparser-mcp) | [`sebastienrousseau/bankstatementparser-mcp`](https://github.com/sebastienrousseau/bankstatementparser-mcp) | [](https://pypi.org/project/bankstatementparser-mcp/) | AI Protocol | Model Context Protocol (MCP) server exposing statement tools to LLMs & AI agents |
|
|
676
700
|
| [`bankstatementparser-lsp`](https://github.com/sebastienrousseau/bankstatementparser-lsp) | [`sebastienrousseau/bankstatementparser-lsp`](https://github.com/sebastienrousseau/bankstatementparser-lsp) | [](https://pypi.org/project/bankstatementparser-lsp/) | Developer Tooling | Language Server Protocol (LSP) with live SWIFT MT940 statement validation & diagnostics |
|
|
677
701
|
| [`bankstatementparser-transport-ebics`](https://github.com/sebastienrousseau/bankstatementparser-transport-ebics) | [`sebastienrousseau/bankstatementparser-transport-ebics`](https://github.com/sebastienrousseau/bankstatementparser-transport-ebics) | [](https://pypi.org/project/bankstatementparser-transport-ebics/) | Transport | Automated bank statement retrieval over EBICS 3.0 (`H005`) and 2.5 (`H004`) protocols |
|
|
@@ -707,7 +731,7 @@ cleanly — see each companion's README for runnable examples.
|
|
|
707
731
|
```text
|
|
708
732
|
bankstatementparser/ Source code (55 modules)
|
|
709
733
|
bankstatementparser/analytics/ Financial metrics, cash flow, cadence & anomaly detection
|
|
710
|
-
bankstatementparser/parsers/ Modular statement parsers (CSV, MT940, OFX/QFX)
|
|
734
|
+
bankstatementparser/parsers/ Modular statement parsers (CSV, MT940, MT942, BAI2, OFX/QFX)
|
|
711
735
|
bankstatementparser/hybrid/ PDF pipeline: orchestrator, llm_extractor, vision, scanner, ollama_direct, verification
|
|
712
736
|
bankstatementparser/enrichment/ Categorizer, AccountMapper, EnrichedTransaction
|
|
713
737
|
bankstatementparser/export/ hledger + beancount journal export, Apache Parquet columnar export
|
|
@@ -780,7 +804,7 @@ Signed commits required. See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
|
780
804
|
## FAQ
|
|
781
805
|
|
|
782
806
|
**What formats are supported?**
|
|
783
|
-
CAMT.053, PAIN.001,
|
|
807
|
+
CAMT (CAMT.052, CAMT.053, CAMT.054), PAIN.001, SWIFT MT940, SWIFT MT942, BAI2, OFX, QFX, CSV, and PDF.
|
|
784
808
|
|
|
785
809
|
**Does any data leave my infrastructure?**
|
|
786
810
|
No. Zero network calls. XML parsers enforce `no_network=True`. No
|
|
@@ -107,7 +107,7 @@ from .zip_security import (
|
|
|
107
107
|
#: so the conformance gate can compare it statically against
|
|
108
108
|
#: pyproject.toml -- that comparison is the thing that catches drift, and
|
|
109
109
|
#: a runtime lookup would make the two trivially equal and check nothing.
|
|
110
|
-
__version__ = "0.0.
|
|
110
|
+
__version__ = "0.0.28"
|
|
111
111
|
|
|
112
112
|
__all__ = [
|
|
113
113
|
"AnalyticsReport",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "bankstatementparser"
|
|
3
|
-
version = "0.0.
|
|
4
|
-
description = "Parse bank statements (CAMT
|
|
3
|
+
version = "0.0.28"
|
|
4
|
+
description = "Parse bank statements (CAMT, PAIN.001, MT940, MT942, OFX, BAI2, CSV, and PDF) into unified Transactions with treasury analytics, 2-way reconciliation, PDF forensics, and ledger export."
|
|
5
5
|
authors = ["Sebastien Rousseau <sebastian.rousseau@gmail.com>"]
|
|
6
6
|
license = "Apache-2.0 OR MIT"
|
|
7
7
|
readme = "README.md"
|
|
@@ -14,6 +14,7 @@ keywords = [
|
|
|
14
14
|
"camt053",
|
|
15
15
|
"pain001",
|
|
16
16
|
"mt940",
|
|
17
|
+
"mt942",
|
|
17
18
|
"ofx",
|
|
18
19
|
"bai2",
|
|
19
20
|
"sepa",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/_llm_common.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/additional_parsers.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/analytics/__init__.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/analytics/cash_flow.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/analytics/common.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/analytics/models.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/analytics/patterns.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/base_parser.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/camt_parser.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/camt_reports.py
RENAMED
|
File without changes
|
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/enrichment/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/export/__init__.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/export/ledger.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/export/parquet.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/field86_parser.py
RENAMED
|
File without changes
|
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/hybrid/__init__.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/hybrid/evaluation.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/hybrid/orchestrator.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/hybrid/pdf_text.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/hybrid/prompts.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/hybrid/scanner.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/hybrid/verification.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/hybrid/vision.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/input_validator.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/pain001_parser.py
RENAMED
|
File without changes
|
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/parsers/__init__.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/parsers/bai2.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/parsers/common.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/parsers/csv_parser.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/parsers/mt940.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/parsers/mt942.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/parsers/ofx.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/reconciliation.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/record_types.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/transaction_models.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/xml_validator.py
RENAMED
|
File without changes
|
{bankstatementparser-0.0.27 → bankstatementparser-0.0.28}/bankstatementparser/zip_security.py
RENAMED
|
File without changes
|