bankstatementparser 0.0.27__tar.gz → 0.0.29__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.
Files changed (62) hide show
  1. bankstatementparser-0.0.27/README.md → bankstatementparser-0.0.29/PKG-INFO +114 -27
  2. bankstatementparser-0.0.27/PKG-INFO → bankstatementparser-0.0.29/README.md +64 -73
  3. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/__init__.py +1 -1
  4. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/export/__init__.py +2 -1
  5. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/pyproject.toml +22 -10
  6. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/LICENSE +0 -0
  7. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/LICENSE-APACHE +0 -0
  8. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/LICENSE-MIT +0 -0
  9. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/_amounts.py +0 -0
  10. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/_llm_common.py +0 -0
  11. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/additional_parsers.py +0 -0
  12. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/analytics/__init__.py +0 -0
  13. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/analytics/cash_flow.py +0 -0
  14. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/analytics/common.py +0 -0
  15. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/analytics/models.py +0 -0
  16. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/analytics/patterns.py +0 -0
  17. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/api.py +0 -0
  18. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/api_limits.py +0 -0
  19. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/api_worker.py +0 -0
  20. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/bank_statement_parsers.py +0 -0
  21. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/base_parser.py +0 -0
  22. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/camt_parser.py +0 -0
  23. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/camt_reports.py +0 -0
  24. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/cli.py +0 -0
  25. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/enrichment/__init__.py +0 -0
  26. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/enrichment/account_mapper.py +0 -0
  27. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/enrichment/categorizer.py +0 -0
  28. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/exceptions.py +0 -0
  29. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/export/ledger.py +0 -0
  30. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/export/parquet.py +0 -0
  31. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/field86_parser.py +0 -0
  32. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/forensics.py +0 -0
  33. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/hybrid/__init__.py +0 -0
  34. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/hybrid/evaluation.py +0 -0
  35. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/hybrid/llm_extractor.py +0 -0
  36. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/hybrid/ollama_direct.py +0 -0
  37. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/hybrid/orchestrator.py +0 -0
  38. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/hybrid/pdf_text.py +0 -0
  39. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/hybrid/prompts.py +0 -0
  40. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/hybrid/scanner.py +0 -0
  41. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/hybrid/verification.py +0 -0
  42. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/hybrid/vision.py +0 -0
  43. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/input_validator.py +0 -0
  44. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/pain001_parser.py +0 -0
  45. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/parallel.py +0 -0
  46. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/parsers/__init__.py +0 -0
  47. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/parsers/bai2.py +0 -0
  48. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/parsers/common.py +0 -0
  49. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/parsers/csv_parser.py +0 -0
  50. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/parsers/mt940.py +0 -0
  51. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/parsers/mt942.py +0 -0
  52. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/parsers/ofx.py +0 -0
  53. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/plugins.py +0 -0
  54. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/privacy.py +0 -0
  55. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/py.typed +0 -0
  56. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/reconciliation.py +0 -0
  57. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/record_types.py +0 -0
  58. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/telemetry.py +0 -0
  59. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/transaction_deduplicator.py +0 -0
  60. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/transaction_models.py +0 -0
  61. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/xml_validator.py +0 -0
  62. {bankstatementparser-0.0.27 → bankstatementparser-0.0.29}/bankstatementparser/zip_security.py +0 -0
@@ -1,3 +1,52 @@
1
+ Metadata-Version: 2.4
2
+ Name: bankstatementparser
3
+ Version: 0.0.29
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
+ License: Apache-2.0 OR MIT
6
+ License-File: LICENSE
7
+ License-File: LICENSE-APACHE
8
+ License-File: LICENSE-MIT
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
+ Author: Sebastien Rousseau
11
+ Author-email: sebastian.rousseau@gmail.com
12
+ Requires-Python: >=3.10,<4.0
13
+ Classifier: License :: Other/Proprietary License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Provides-Extra: api
21
+ Provides-Extra: enrichment
22
+ Provides-Extra: excel
23
+ Provides-Extra: hybrid
24
+ Provides-Extra: hybrid-plus
25
+ Provides-Extra: hybrid-vision
26
+ Provides-Extra: parquet
27
+ Provides-Extra: polars
28
+ Requires-Dist: aiohttp (>=3.14.4) ; (python_version < "3.14") and (extra == "hybrid" or extra == "hybrid-plus" or extra == "hybrid-vision" or extra == "enrichment")
29
+ Requires-Dist: certifi (>=2026.10.19) ; extra == "hybrid" or extra == "hybrid-plus" or extra == "hybrid-vision" or extra == "enrichment"
30
+ Requires-Dist: defusedxml (>=0.7.1,<0.8.0)
31
+ Requires-Dist: fastapi (>=0.115.0) ; extra == "api"
32
+ Requires-Dist: filelock (>=3.20.3,<3.20.4) ; (python_version < "3.14") and (extra == "hybrid" or extra == "hybrid-plus" or extra == "hybrid-vision" or extra == "enrichment")
33
+ Requires-Dist: litellm (>=1.83.10) ; (python_version < "3.14") and (extra == "hybrid" or extra == "hybrid-plus" or extra == "hybrid-vision" or extra == "enrichment")
34
+ Requires-Dist: lxml (>=5.0)
35
+ Requires-Dist: openpyxl (>=3.1.5,<4.0.0) ; extra == "excel"
36
+ Requires-Dist: pandas (>=2.3.3,<3.0.0)
37
+ Requires-Dist: pdfplumber (>=0.11.0) ; (python_version >= "3.11") and (extra == "hybrid-plus")
38
+ Requires-Dist: pillow (>=13.0.0) ; (python_version >= "3.11") and (extra == "hybrid-plus")
39
+ Requires-Dist: polars (>=1.32.0,<3) ; extra == "polars"
40
+ Requires-Dist: pyarrow (>=14.0.0) ; extra == "parquet"
41
+ Requires-Dist: pydantic (>=2.11.0,<3.0.0)
42
+ Requires-Dist: pypdf (>=6.21.2) ; extra == "hybrid" or extra == "hybrid-plus" or extra == "hybrid-vision"
43
+ Requires-Dist: pypdfium2 (>=4.30.0) ; extra == "hybrid-vision"
44
+ Requires-Dist: python-multipart (>=0.0.32) ; extra == "api"
45
+ Requires-Dist: uvicorn (>=0.34.0) ; extra == "api"
46
+ Project-URL: Homepage, https://bankstatementparser.com
47
+ Project-URL: Repository, https://github.com/sebastienrousseau/bankstatementparser
48
+ Description-Content-Type: text/markdown
49
+
1
50
  <!-- SPDX-License-Identifier: Apache-2.0 OR MIT -->
2
51
 
3
52
  <p align="center">
@@ -12,23 +61,25 @@
12
61
  <h1 align="center">Bank Statement Parser</h1>
13
62
 
14
63
  <p align="center">
15
- Bank statement parsing for Python — six structured formats and
64
+ Bank statement parsing for Python — eight structured formats and
16
65
  PDFs, digital or scanned, into one auditable
17
66
  <code>Transaction</code> model.
18
67
  </p>
19
68
 
20
69
  <p align="center">
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.27" alt="PyPI" /></a>
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
- <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
- <a href="LICENSE"><img src="https://img.shields.io/github/license/sebastienrousseau/bankstatementparser?style=for-the-badge" alt="License" /></a>
70
+ <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" height="28" /></a>
71
+ <a href="https://pypi.org/project/bankstatementparser/"><img src="https://img.shields.io/pypi/v/bankstatementparser?style=for-the-badge&color=fc8d62&logo=python&v=0.0.29" alt="PyPI version" height="28" /></a>
72
+ <a href="https://bankstatementparser.com"><img src="https://img.shields.io/badge/docs-bankstatementparser.com-blue?style=for-the-badge&labelColor=555555&logo=googlechrome" alt="Docs" height="28" /></a>
73
+ <a href="https://pypi.org/project/bankstatementparser/"><img src="https://img.shields.io/pypi/pyversions/bankstatementparser.svg?style=for-the-badge" alt="Python versions" height="28" /></a>
74
+ <a href="https://pypi.org/project/bankstatementparser/"><img src="https://img.shields.io/pypi/dm/bankstatementparser.svg?style=for-the-badge" alt="PyPI downloads" height="28" /></a>
75
+ <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" height="28" /></a>
76
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0%20OR%20MIT-blue.svg?style=for-the-badge" alt="License: Apache-2.0 OR MIT" height="28" /></a>
26
77
  </p>
27
78
 
28
79
  ---
29
80
 
30
- Parse bank statements across **six structured formats** (CAMT,
31
- PAIN.001, CSV, OFX/QFX, MT940) **and PDFs** — both digital and
81
+ Parse bank statements across **eight structured formats** (CAMT,
82
+ PAIN.001, CSV, OFX, QFX, MT940, MT942, BAI2) **and PDFs** — both digital and
32
83
  scanned — into a single unified `Transaction` model. ISO 20022
33
84
  files take the deterministic path; PDFs fall through to a
34
85
  configurable LLM (Ollama by default, any LiteLLM-supported
@@ -62,7 +113,7 @@ services unless they explicitly opt in.
62
113
  - [Parallel Parsing](#parallel-parsing) — multi-file batches across CPU cores
63
114
  - [Command Line](#command-line) — console script and REST API
64
115
  - [Deduplication](#deduplication) — exact hashes + suspected matches
65
- - [Export](#export) — CSV, JSON, Excel, Polars, hledger, beancount
116
+ - [Export](#export) — CSV, JSON, Excel, Polars, Parquet, hledger, beancount
66
117
  - [Examples](#examples) — 23 runnable scripts (14 deterministic + 9 hybrid)
67
118
  - [XML Tag Mapping](#xml-tag-mapping) — ISO 20022 tags to DataFrame columns
68
119
  - [Ecosystem](#ecosystem) — companion packages (MCP, LSP, writers, loaders)
@@ -83,12 +134,18 @@ services unless they explicitly opt in.
83
134
  ## Install
84
135
 
85
136
  ```bash
86
- # Core install — deterministic parsers only (CAMT, PAIN.001, CSV, OFX, QFX, MT940)
137
+ # Core install — deterministic parsers only (CAMT, PAIN.001, CSV, OFX, QFX, MT940, MT942, BAI2)
87
138
  pip install bankstatementparser
88
139
 
89
140
  # Add Excel (.xlsx) export support (openpyxl)
90
141
  pip install 'bankstatementparser[excel]'
91
142
 
143
+ # Add Apache Parquet export support (pyarrow)
144
+ pip install 'bankstatementparser[parquet]'
145
+
146
+ # Add Polars DataFrame export support
147
+ pip install 'bankstatementparser[polars]'
148
+
92
149
  # Add the text-LLM path for digital PDFs (litellm + pypdf)
93
150
  pip install 'bankstatementparser[hybrid]'
94
151
 
@@ -116,12 +173,15 @@ required.
116
173
  - Poetry (for local development).
117
174
 
118
175
  > **Python version note.** The deterministic core (CAMT, PAIN.001,
119
- > CSV, OFX, QFX, MT940) supports Python **3.10–3.14**. The optional
176
+ > CSV, OFX, QFX, MT940, MT942, BAI2) supports Python **3.10–3.14**. The optional
120
177
  > `[hybrid]`, `[hybrid-plus]`, `[hybrid-vision]`, and
121
178
  > `[enrichment]` extras pull in `litellm`, which currently requires
122
179
  > **Python <3.14** upstream — on Python 3.14 the LLM extras will
123
180
  > not install. Pin `Python 3.13` for the full hybrid pipeline;
124
181
  > upgrade to 3.14 freely if you only need deterministic parsing.
182
+ > The `pdfplumber` engine in `[hybrid-plus]` needs Python **3.11+**:
183
+ > it pulls Pillow, whose first release without open advisories
184
+ > (13.0.0) dropped 3.10, so on 3.10 the extra installs without it.
125
185
 
126
186
  ### Local development
127
187
 
@@ -271,7 +331,7 @@ Gemini, …).
271
331
  ```mermaid
272
332
  flowchart TD
273
333
  A["smart_ingest(path)"] --> B{"detect_statement_format"}
274
- B -->|CAMT/PAIN/OFX/MT940/CSV| C["Path A: deterministic parser<br/>$0, fastest"]
334
+ B -->|CAMT/PAIN/OFX/MT940/MT942/BAI2/CSV| C["Path A: deterministic parser<br/>$0, fastest"]
275
335
  C --> Z["IngestResult<br/>source_method='deterministic'"]
276
336
 
277
337
  B -->|pdf or unknown| D["pypdf extract_text"]
@@ -303,7 +363,7 @@ for the full surface.
303
363
 
304
364
  | Feature | Description |
305
365
  |---|---|
306
- | **6 structured formats** | CAMT.053, PAIN.001, CSV, OFX, QFX, MT940 |
366
+ | **8 structured formats** | CAMT (052, 053, 054), PAIN.001, MT940, MT942, BAI2, OFX, QFX, CSV |
307
367
  | **Auto-detection** | `detect_statement_format()` identifies the format; `create_parser()` returns the right parser |
308
368
  | **Streaming** | `parse_streaming()` at 27,000+ tx/s (CAMT) and 52,000+ tx/s (PAIN.001) with bounded memory |
309
369
  | **Parallel** | `parse_files_parallel()` for multi-file batch processing across CPU cores |
@@ -336,7 +396,7 @@ for the full surface.
336
396
  | **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
397
  | **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
398
  | **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 |
399
+ | **Export** | CSV, JSON, Excel (`.xlsx`), Apache Parquet (`.parquet`), and optional Polars DataFrames |
340
400
  | **REST API** *(v0.0.8)* | FastAPI microservice: `POST /ingest` a file, get JSON back. `GET /health` for monitoring. `pip install 'bankstatementparser[api]'`. |
341
401
 
342
402
  ### Security & quality
@@ -552,6 +612,32 @@ lazy_df = parser.to_polars_lazy()
552
612
 
553
613
  Install with `pip install bankstatementparser[polars]`.
554
614
 
615
+ ### Apache Parquet (optional)
616
+
617
+ Export transactions to Apache Parquet columnar files in batch or streaming mode:
618
+
619
+ ```python
620
+ import pyarrow as pa
621
+ from bankstatementparser.export import export_parquet, ParquetStreamWriter
622
+
623
+ # Batch export
624
+ export_parquet(transactions, "output.parquet")
625
+
626
+ # Streaming export with bounded memory and atomic file commits. The writer
627
+ # takes mappings and an explicit Arrow schema covering every field written.
628
+ schema = pa.schema([
629
+ ("booking_date", pa.date32()),
630
+ ("amount", pa.decimal128(18, 2)),
631
+ ("currency", pa.string()),
632
+ ("description", pa.string()),
633
+ ])
634
+ with ParquetStreamWriter("output_stream.parquet", schema=schema, batch_size=1000) as writer:
635
+ for tx in transactions:
636
+ writer.write_record(tx.model_dump(include=set(schema.names)))
637
+ ```
638
+
639
+ Install with `pip install 'bankstatementparser[parquet]'`.
640
+
555
641
  ### hledger + beancount *(v0.0.8)*
556
642
 
557
643
  Export transactions to plaintext-accounting journal formats:
@@ -656,7 +742,7 @@ results.
656
742
  ## XML Tag Mapping
657
743
 
658
744
  See [`docs/MAPPING.md`](docs/MAPPING.md) for a complete reference
659
- of ISO 20022 XML tags to DataFrame columns across all six formats.
745
+ of ISO 20022 XML tags to DataFrame columns across all structured formats.
660
746
  Use this when integrating with ERP systems or building
661
747
  reconciliation pipelines.
662
748
 
@@ -669,22 +755,22 @@ versioned companion packages build on it — each is its own repository
669
755
  and Python package, so you install only what you need and the core
670
756
  stays dependency-light.
671
757
 
672
- | Package | GitHub Repository | PyPI | Role | Description |
758
+ | Package | GitHub Repository | Release / PyPI | Role | Description |
673
759
  |---|---|---|---|---|
674
- | [`bankstatementparser`](https://github.com/sebastienrousseau/bankstatementparser) | [`sebastienrousseau/bankstatementparser`](https://github.com/sebastienrousseau/bankstatementparser) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser.svg)](https://pypi.org/project/bankstatementparser/) | Core Engine | Unified parser for CAMT (052/053), PAIN.001, CSV, OFX, QFX, MT940, and PDF statements |
760
+ | [`bankstatementparser`](https://github.com/sebastienrousseau/bankstatementparser) | [`sebastienrousseau/bankstatementparser`](https://github.com/sebastienrousseau/bankstatementparser) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser.svg)](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
761
  | [`bankstatementparser-mcp`](https://github.com/sebastienrousseau/bankstatementparser-mcp) | [`sebastienrousseau/bankstatementparser-mcp`](https://github.com/sebastienrousseau/bankstatementparser-mcp) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-mcp.svg)](https://pypi.org/project/bankstatementparser-mcp/) | AI Protocol | Model Context Protocol (MCP) server exposing statement tools to LLMs & AI agents |
676
762
  | [`bankstatementparser-lsp`](https://github.com/sebastienrousseau/bankstatementparser-lsp) | [`sebastienrousseau/bankstatementparser-lsp`](https://github.com/sebastienrousseau/bankstatementparser-lsp) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-lsp.svg)](https://pypi.org/project/bankstatementparser-lsp/) | Developer Tooling | Language Server Protocol (LSP) with live SWIFT MT940 statement validation & diagnostics |
677
- | [`bankstatementparser-transport-ebics`](https://github.com/sebastienrousseau/bankstatementparser-transport-ebics) | [`sebastienrousseau/bankstatementparser-transport-ebics`](https://github.com/sebastienrousseau/bankstatementparser-transport-ebics) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-transport-ebics.svg)](https://pypi.org/project/bankstatementparser-transport-ebics/) | Transport | Automated bank statement retrieval over EBICS 3.0 (`H005`) and 2.5 (`H004`) protocols |
763
+ | [`bankstatementparser-transport-ebics`](https://github.com/sebastienrousseau/bankstatementparser-transport-ebics) | [`sebastienrousseau/bankstatementparser-transport-ebics`](https://github.com/sebastienrousseau/bankstatementparser-transport-ebics) | [![Release](https://img.shields.io/github/v/release/sebastienrousseau/bankstatementparser-transport-ebics.svg)](https://github.com/sebastienrousseau/bankstatementparser-transport-ebics/releases) | Transport | Automated bank statement retrieval over EBICS 3.0 (`H005`) and 2.5 (`H004`) protocols |
678
764
  | [`bankstatementparser-writer-xlsx`](https://github.com/sebastienrousseau/bankstatementparser-writer-xlsx) | [`sebastienrousseau/bankstatementparser-writer-xlsx`](https://github.com/sebastienrousseau/bankstatementparser-writer-xlsx) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-writer-xlsx.svg)](https://pypi.org/project/bankstatementparser-writer-xlsx/) | Output Writer | Formats and exports parsed banking transactions into styled Microsoft Excel (`.xlsx`) workbooks |
679
- | [`bankstatementparser-writer-qif`](https://github.com/sebastienrousseau/bankstatementparser-writer-qif) | [`sebastienrousseau/bankstatementparser-writer-qif`](https://github.com/sebastienrousseau/bankstatementparser-writer-qif) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-writer-qif.svg)](https://pypi.org/project/bankstatementparser-writer-qif/) | Output Writer | Serializes transactions into standard Quicken Interchange Format (`.qif`) exchange files |
680
- | [`bankstatementparser-writer-ofx`](https://github.com/sebastienrousseau/bankstatementparser-writer-ofx) | [`sebastienrousseau/bankstatementparser-writer-ofx`](https://github.com/sebastienrousseau/bankstatementparser-writer-ofx) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-writer-ofx.svg)](https://pypi.org/project/bankstatementparser-writer-ofx/) | Output Writer | Serializes transactions into standard Open Financial Exchange (`.ofx`) XML/SGML files |
681
- | [`bankstatementparser-writer-swift`](https://github.com/sebastienrousseau/bankstatementparser-writer-swift) | [`sebastienrousseau/bankstatementparser-writer-swift`](https://github.com/sebastienrousseau/bankstatementparser-writer-swift) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-writer-swift.svg)](https://pypi.org/project/bankstatementparser-writer-swift/) | Output Writer | Exports transactions to SWIFT MT940 customer statements and MT942 interim reports |
765
+ | [`bankstatementparser-writer-qif`](https://github.com/sebastienrousseau/bankstatementparser-writer-qif) | [`sebastienrousseau/bankstatementparser-writer-qif`](https://github.com/sebastienrousseau/bankstatementparser-writer-qif) | [![Release](https://img.shields.io/github/v/release/sebastienrousseau/bankstatementparser-writer-qif.svg)](https://github.com/sebastienrousseau/bankstatementparser-writer-qif/releases) | Output Writer | Serializes transactions into standard Quicken Interchange Format (`.qif`) exchange files |
766
+ | [`bankstatementparser-writer-ofx`](https://github.com/sebastienrousseau/bankstatementparser-writer-ofx) | [`sebastienrousseau/bankstatementparser-writer-ofx`](https://github.com/sebastienrousseau/bankstatementparser-writer-ofx) | [![Release](https://img.shields.io/github/v/release/sebastienrousseau/bankstatementparser-writer-ofx.svg)](https://github.com/sebastienrousseau/bankstatementparser-writer-ofx/releases) | Output Writer | Serializes transactions into standard Open Financial Exchange (`.ofx`) XML/SGML files |
767
+ | [`bankstatementparser-writer-swift`](https://github.com/sebastienrousseau/bankstatementparser-writer-swift) | [`sebastienrousseau/bankstatementparser-writer-swift`](https://github.com/sebastienrousseau/bankstatementparser-writer-swift) | [![Release](https://img.shields.io/github/v/release/sebastienrousseau/bankstatementparser-writer-swift.svg)](https://github.com/sebastienrousseau/bankstatementparser-writer-swift/releases) | Output Writer | Exports transactions to SWIFT MT940 customer statements and MT942 interim reports |
682
768
  | [`bankstatementparser-loader-bai2`](https://github.com/sebastienrousseau/bankstatementparser-loader-bai2) | [`sebastienrousseau/bankstatementparser-loader-bai2`](https://github.com/sebastienrousseau/bankstatementparser-loader-bai2) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-loader-bai2.svg)](https://pypi.org/project/bankstatementparser-loader-bai2/) | Input Loader | Parses BAI2 cash-management and account balance statements |
683
769
  | [`bankstatementparser-loader-mt942`](https://github.com/sebastienrousseau/bankstatementparser-loader-mt942) | [`sebastienrousseau/bankstatementparser-loader-mt942`](https://github.com/sebastienrousseau/bankstatementparser-loader-mt942) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-loader-mt942.svg)](https://pypi.org/project/bankstatementparser-loader-mt942/) | Input Loader | Parses SWIFT MT942 interim transaction reports with credit/debit summary reconciliation |
684
- | [`bankstatementparser-loader-cfonb`](https://github.com/sebastienrousseau/bankstatementparser-loader-cfonb) | [`sebastienrousseau/bankstatementparser-loader-cfonb`](https://github.com/sebastienrousseau/bankstatementparser-loader-cfonb) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-loader-cfonb.svg)](https://pypi.org/project/bankstatementparser-loader-cfonb/) | Input Loader | Parses French CFONB 120 / AFB120 120-byte fixed-width banking statement files |
685
- | [`bankstatementparser-loader-camt054`](https://github.com/sebastienrousseau/bankstatementparser-loader-camt054) | [`sebastienrousseau/bankstatementparser-loader-camt054`](https://github.com/sebastienrousseau/bankstatementparser-loader-camt054) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-loader-camt054.svg)](https://pypi.org/project/bankstatementparser-loader-camt054/) | Input Loader | Ingests ISO 20022 CAMT.054 real-time debit/credit notification stream XML |
686
- | [`bankstatementparser-loader-sepa`](https://github.com/sebastienrousseau/bankstatementparser-loader-sepa) | [`sebastienrousseau/bankstatementparser-loader-sepa`](https://github.com/sebastienrousseau/bankstatementparser-loader-sepa) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-loader-sepa.svg)](https://pypi.org/project/bankstatementparser-loader-sepa/) | Input Loader | Ingests ISO 20022 SEPA PAIN.002 payment status reports and PAIN.008 direct debit mandates |
687
- | [`bankstatementparser-loader-bacs`](https://github.com/sebastienrousseau/bankstatementparser-loader-bacs) | [`sebastienrousseau/bankstatementparser-loader-bacs`](https://github.com/sebastienrousseau/bankstatementparser-loader-bacs) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-loader-bacs.svg)](https://pypi.org/project/bankstatementparser-loader-bacs/) | Input Loader | Parses UK BACS Standard 18 / Faster Payments 106-byte fixed-width transmission files |
770
+ | [`bankstatementparser-loader-cfonb`](https://github.com/sebastienrousseau/bankstatementparser-loader-cfonb) | [`sebastienrousseau/bankstatementparser-loader-cfonb`](https://github.com/sebastienrousseau/bankstatementparser-loader-cfonb) | [![Release](https://img.shields.io/github/v/release/sebastienrousseau/bankstatementparser-loader-cfonb.svg)](https://github.com/sebastienrousseau/bankstatementparser-loader-cfonb/releases) | Input Loader | Parses French CFONB 120 / AFB120 120-byte fixed-width banking statement files |
771
+ | [`bankstatementparser-loader-camt054`](https://github.com/sebastienrousseau/bankstatementparser-loader-camt054) | [`sebastienrousseau/bankstatementparser-loader-camt054`](https://github.com/sebastienrousseau/bankstatementparser-loader-camt054) | [![Release](https://img.shields.io/github/v/release/sebastienrousseau/bankstatementparser-loader-camt054.svg)](https://github.com/sebastienrousseau/bankstatementparser-loader-camt054/releases) | Input Loader | Ingests ISO 20022 CAMT.054 real-time debit/credit notification stream XML |
772
+ | [`bankstatementparser-loader-sepa`](https://github.com/sebastienrousseau/bankstatementparser-loader-sepa) | [`sebastienrousseau/bankstatementparser-loader-sepa`](https://github.com/sebastienrousseau/bankstatementparser-loader-sepa) | [![Release](https://img.shields.io/github/v/release/sebastienrousseau/bankstatementparser-loader-sepa.svg)](https://github.com/sebastienrousseau/bankstatementparser-loader-sepa/releases) | Input Loader | Ingests ISO 20022 SEPA PAIN.002 payment status reports and PAIN.008 direct debit mandates |
773
+ | [`bankstatementparser-loader-bacs`](https://github.com/sebastienrousseau/bankstatementparser-loader-bacs) | [`sebastienrousseau/bankstatementparser-loader-bacs`](https://github.com/sebastienrousseau/bankstatementparser-loader-bacs) | [![Release](https://img.shields.io/github/v/release/sebastienrousseau/bankstatementparser-loader-bacs.svg)](https://github.com/sebastienrousseau/bankstatementparser-loader-bacs/releases) | Input Loader | Parses UK BACS Standard 18 / Faster Payments 106-byte fixed-width transmission files |
688
774
 
689
775
  Loaders turn an additional source format into the same unified
690
776
  `Transaction` model; writers take parsed data back out to another
@@ -707,7 +793,7 @@ cleanly — see each companion's README for runnable examples.
707
793
  ```text
708
794
  bankstatementparser/ Source code (55 modules)
709
795
  bankstatementparser/analytics/ Financial metrics, cash flow, cadence & anomaly detection
710
- bankstatementparser/parsers/ Modular statement parsers (CSV, MT940, OFX/QFX)
796
+ bankstatementparser/parsers/ Modular statement parsers (CSV, MT940, MT942, BAI2, OFX/QFX)
711
797
  bankstatementparser/hybrid/ PDF pipeline: orchestrator, llm_extractor, vision, scanner, ollama_direct, verification
712
798
  bankstatementparser/enrichment/ Categorizer, AccountMapper, EnrichedTransaction
713
799
  bankstatementparser/export/ hledger + beancount journal export, Apache Parquet columnar export
@@ -780,7 +866,7 @@ Signed commits required. See [CONTRIBUTING.md](CONTRIBUTING.md).
780
866
  ## FAQ
781
867
 
782
868
  **What formats are supported?**
783
- CAMT.053, PAIN.001, CSV, OFX, QFX, and MT940.
869
+ CAMT (CAMT.052, CAMT.053, CAMT.054), PAIN.001, SWIFT MT940, SWIFT MT942, BAI2, OFX, QFX, CSV, and PDF.
784
870
 
785
871
  **Does any data leave my infrastructure?**
786
872
  No. Zero network calls. XML parsers enforce `no_network=True`. No
@@ -828,3 +914,4 @@ See [LICENSE](LICENSE).
828
914
  See [CHANGELOG.md](CHANGELOG.md) for release history.
829
915
 
830
916
  <p align="right"><a href="#contents">Back to Top</a></p>
917
+
@@ -1,48 +1,3 @@
1
- Metadata-Version: 2.4
2
- Name: bankstatementparser
3
- Version: 0.0.27
4
- Summary: Parse bank statements (CAMT.053, PAIN.001, MT940, OFX, BAI2, CSV, and PDF) into unified Transactions with treasury analytics, 2-way reconciliation, PDF forensics, and ledger export.
5
- License: Apache-2.0 OR MIT
6
- License-File: LICENSE
7
- License-File: LICENSE-APACHE
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
10
- Author: Sebastien Rousseau
11
- Author-email: sebastian.rousseau@gmail.com
12
- Requires-Python: >=3.10,<4.0
13
- Classifier: License :: Other/Proprietary License
14
- Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.10
16
- Classifier: Programming Language :: Python :: 3.11
17
- Classifier: Programming Language :: Python :: 3.12
18
- Classifier: Programming Language :: Python :: 3.13
19
- Classifier: Programming Language :: Python :: 3.14
20
- Provides-Extra: api
21
- Provides-Extra: enrichment
22
- Provides-Extra: excel
23
- Provides-Extra: hybrid
24
- Provides-Extra: hybrid-plus
25
- Provides-Extra: hybrid-vision
26
- Provides-Extra: parquet
27
- Provides-Extra: polars
28
- Requires-Dist: defusedxml (>=0.7.1,<0.8.0)
29
- Requires-Dist: fastapi (>=0.115.0) ; extra == "api"
30
- Requires-Dist: litellm (>=1.83.10) ; (python_version < "3.14") and (extra == "hybrid" or extra == "hybrid-plus" or extra == "hybrid-vision" or extra == "enrichment")
31
- Requires-Dist: lxml (>=5.0)
32
- Requires-Dist: openpyxl (>=3.1.5,<4.0.0) ; extra == "excel"
33
- Requires-Dist: pandas (>=2.3.3,<3.0.0)
34
- Requires-Dist: pdfplumber (>=0.11.0) ; extra == "hybrid-plus"
35
- Requires-Dist: polars (>=1.32.0,<2.0.0) ; extra == "polars"
36
- Requires-Dist: pyarrow (>=14.0.0) ; extra == "parquet"
37
- Requires-Dist: pydantic (>=2.11.0,<3.0.0)
38
- Requires-Dist: pypdf (>=4.0.0) ; extra == "hybrid" or extra == "hybrid-plus" or extra == "hybrid-vision"
39
- Requires-Dist: pypdfium2 (>=4.30.0) ; extra == "hybrid-vision"
40
- Requires-Dist: python-multipart (>=0.0.32) ; extra == "api"
41
- Requires-Dist: uvicorn (>=0.34.0) ; extra == "api"
42
- Project-URL: Homepage, https://bankstatementparser.com
43
- Project-URL: Repository, https://github.com/sebastienrousseau/bankstatementparser
44
- Description-Content-Type: text/markdown
45
-
46
1
  <!-- SPDX-License-Identifier: Apache-2.0 OR MIT -->
47
2
 
48
3
  <p align="center">
@@ -57,23 +12,25 @@ Description-Content-Type: text/markdown
57
12
  <h1 align="center">Bank Statement Parser</h1>
58
13
 
59
14
  <p align="center">
60
- Bank statement parsing for Python — six structured formats and
15
+ Bank statement parsing for Python — eight structured formats and
61
16
  PDFs, digital or scanned, into one auditable
62
17
  <code>Transaction</code> model.
63
18
  </p>
64
19
 
65
20
  <p align="center">
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.27" alt="PyPI" /></a>
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
- <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
- <a href="LICENSE"><img src="https://img.shields.io/github/license/sebastienrousseau/bankstatementparser?style=for-the-badge" alt="License" /></a>
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" height="28" /></a>
22
+ <a href="https://pypi.org/project/bankstatementparser/"><img src="https://img.shields.io/pypi/v/bankstatementparser?style=for-the-badge&color=fc8d62&logo=python&v=0.0.29" alt="PyPI version" height="28" /></a>
23
+ <a href="https://bankstatementparser.com"><img src="https://img.shields.io/badge/docs-bankstatementparser.com-blue?style=for-the-badge&labelColor=555555&logo=googlechrome" alt="Docs" height="28" /></a>
24
+ <a href="https://pypi.org/project/bankstatementparser/"><img src="https://img.shields.io/pypi/pyversions/bankstatementparser.svg?style=for-the-badge" alt="Python versions" height="28" /></a>
25
+ <a href="https://pypi.org/project/bankstatementparser/"><img src="https://img.shields.io/pypi/dm/bankstatementparser.svg?style=for-the-badge" alt="PyPI downloads" height="28" /></a>
26
+ <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" height="28" /></a>
27
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0%20OR%20MIT-blue.svg?style=for-the-badge" alt="License: Apache-2.0 OR MIT" height="28" /></a>
71
28
  </p>
72
29
 
73
30
  ---
74
31
 
75
- Parse bank statements across **six structured formats** (CAMT,
76
- PAIN.001, CSV, OFX/QFX, MT940) **and PDFs** — both digital and
32
+ Parse bank statements across **eight structured formats** (CAMT,
33
+ PAIN.001, CSV, OFX, QFX, MT940, MT942, BAI2) **and PDFs** — both digital and
77
34
  scanned — into a single unified `Transaction` model. ISO 20022
78
35
  files take the deterministic path; PDFs fall through to a
79
36
  configurable LLM (Ollama by default, any LiteLLM-supported
@@ -107,7 +64,7 @@ services unless they explicitly opt in.
107
64
  - [Parallel Parsing](#parallel-parsing) — multi-file batches across CPU cores
108
65
  - [Command Line](#command-line) — console script and REST API
109
66
  - [Deduplication](#deduplication) — exact hashes + suspected matches
110
- - [Export](#export) — CSV, JSON, Excel, Polars, hledger, beancount
67
+ - [Export](#export) — CSV, JSON, Excel, Polars, Parquet, hledger, beancount
111
68
  - [Examples](#examples) — 23 runnable scripts (14 deterministic + 9 hybrid)
112
69
  - [XML Tag Mapping](#xml-tag-mapping) — ISO 20022 tags to DataFrame columns
113
70
  - [Ecosystem](#ecosystem) — companion packages (MCP, LSP, writers, loaders)
@@ -128,12 +85,18 @@ services unless they explicitly opt in.
128
85
  ## Install
129
86
 
130
87
  ```bash
131
- # Core install — deterministic parsers only (CAMT, PAIN.001, CSV, OFX, QFX, MT940)
88
+ # Core install — deterministic parsers only (CAMT, PAIN.001, CSV, OFX, QFX, MT940, MT942, BAI2)
132
89
  pip install bankstatementparser
133
90
 
134
91
  # Add Excel (.xlsx) export support (openpyxl)
135
92
  pip install 'bankstatementparser[excel]'
136
93
 
94
+ # Add Apache Parquet export support (pyarrow)
95
+ pip install 'bankstatementparser[parquet]'
96
+
97
+ # Add Polars DataFrame export support
98
+ pip install 'bankstatementparser[polars]'
99
+
137
100
  # Add the text-LLM path for digital PDFs (litellm + pypdf)
138
101
  pip install 'bankstatementparser[hybrid]'
139
102
 
@@ -161,12 +124,15 @@ required.
161
124
  - Poetry (for local development).
162
125
 
163
126
  > **Python version note.** The deterministic core (CAMT, PAIN.001,
164
- > CSV, OFX, QFX, MT940) supports Python **3.10–3.14**. The optional
127
+ > CSV, OFX, QFX, MT940, MT942, BAI2) supports Python **3.10–3.14**. The optional
165
128
  > `[hybrid]`, `[hybrid-plus]`, `[hybrid-vision]`, and
166
129
  > `[enrichment]` extras pull in `litellm`, which currently requires
167
130
  > **Python <3.14** upstream — on Python 3.14 the LLM extras will
168
131
  > not install. Pin `Python 3.13` for the full hybrid pipeline;
169
132
  > upgrade to 3.14 freely if you only need deterministic parsing.
133
+ > The `pdfplumber` engine in `[hybrid-plus]` needs Python **3.11+**:
134
+ > it pulls Pillow, whose first release without open advisories
135
+ > (13.0.0) dropped 3.10, so on 3.10 the extra installs without it.
170
136
 
171
137
  ### Local development
172
138
 
@@ -316,7 +282,7 @@ Gemini, …).
316
282
  ```mermaid
317
283
  flowchart TD
318
284
  A["smart_ingest(path)"] --> B{"detect_statement_format"}
319
- B -->|CAMT/PAIN/OFX/MT940/CSV| C["Path A: deterministic parser<br/>$0, fastest"]
285
+ B -->|CAMT/PAIN/OFX/MT940/MT942/BAI2/CSV| C["Path A: deterministic parser<br/>$0, fastest"]
320
286
  C --> Z["IngestResult<br/>source_method='deterministic'"]
321
287
 
322
288
  B -->|pdf or unknown| D["pypdf extract_text"]
@@ -348,7 +314,7 @@ for the full surface.
348
314
 
349
315
  | Feature | Description |
350
316
  |---|---|
351
- | **6 structured formats** | CAMT.053, PAIN.001, CSV, OFX, QFX, MT940 |
317
+ | **8 structured formats** | CAMT (052, 053, 054), PAIN.001, MT940, MT942, BAI2, OFX, QFX, CSV |
352
318
  | **Auto-detection** | `detect_statement_format()` identifies the format; `create_parser()` returns the right parser |
353
319
  | **Streaming** | `parse_streaming()` at 27,000+ tx/s (CAMT) and 52,000+ tx/s (PAIN.001) with bounded memory |
354
320
  | **Parallel** | `parse_files_parallel()` for multi-file batch processing across CPU cores |
@@ -381,7 +347,7 @@ for the full surface.
381
347
  | **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
348
  | **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
349
  | **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 |
350
+ | **Export** | CSV, JSON, Excel (`.xlsx`), Apache Parquet (`.parquet`), and optional Polars DataFrames |
385
351
  | **REST API** *(v0.0.8)* | FastAPI microservice: `POST /ingest` a file, get JSON back. `GET /health` for monitoring. `pip install 'bankstatementparser[api]'`. |
386
352
 
387
353
  ### Security & quality
@@ -597,6 +563,32 @@ lazy_df = parser.to_polars_lazy()
597
563
 
598
564
  Install with `pip install bankstatementparser[polars]`.
599
565
 
566
+ ### Apache Parquet (optional)
567
+
568
+ Export transactions to Apache Parquet columnar files in batch or streaming mode:
569
+
570
+ ```python
571
+ import pyarrow as pa
572
+ from bankstatementparser.export import export_parquet, ParquetStreamWriter
573
+
574
+ # Batch export
575
+ export_parquet(transactions, "output.parquet")
576
+
577
+ # Streaming export with bounded memory and atomic file commits. The writer
578
+ # takes mappings and an explicit Arrow schema covering every field written.
579
+ schema = pa.schema([
580
+ ("booking_date", pa.date32()),
581
+ ("amount", pa.decimal128(18, 2)),
582
+ ("currency", pa.string()),
583
+ ("description", pa.string()),
584
+ ])
585
+ with ParquetStreamWriter("output_stream.parquet", schema=schema, batch_size=1000) as writer:
586
+ for tx in transactions:
587
+ writer.write_record(tx.model_dump(include=set(schema.names)))
588
+ ```
589
+
590
+ Install with `pip install 'bankstatementparser[parquet]'`.
591
+
600
592
  ### hledger + beancount *(v0.0.8)*
601
593
 
602
594
  Export transactions to plaintext-accounting journal formats:
@@ -701,7 +693,7 @@ results.
701
693
  ## XML Tag Mapping
702
694
 
703
695
  See [`docs/MAPPING.md`](docs/MAPPING.md) for a complete reference
704
- of ISO 20022 XML tags to DataFrame columns across all six formats.
696
+ of ISO 20022 XML tags to DataFrame columns across all structured formats.
705
697
  Use this when integrating with ERP systems or building
706
698
  reconciliation pipelines.
707
699
 
@@ -714,22 +706,22 @@ versioned companion packages build on it — each is its own repository
714
706
  and Python package, so you install only what you need and the core
715
707
  stays dependency-light.
716
708
 
717
- | Package | GitHub Repository | PyPI | Role | Description |
709
+ | Package | GitHub Repository | Release / PyPI | Role | Description |
718
710
  |---|---|---|---|---|
719
- | [`bankstatementparser`](https://github.com/sebastienrousseau/bankstatementparser) | [`sebastienrousseau/bankstatementparser`](https://github.com/sebastienrousseau/bankstatementparser) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser.svg)](https://pypi.org/project/bankstatementparser/) | Core Engine | Unified parser for CAMT (052/053), PAIN.001, CSV, OFX, QFX, MT940, and PDF statements |
711
+ | [`bankstatementparser`](https://github.com/sebastienrousseau/bankstatementparser) | [`sebastienrousseau/bankstatementparser`](https://github.com/sebastienrousseau/bankstatementparser) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser.svg)](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
712
  | [`bankstatementparser-mcp`](https://github.com/sebastienrousseau/bankstatementparser-mcp) | [`sebastienrousseau/bankstatementparser-mcp`](https://github.com/sebastienrousseau/bankstatementparser-mcp) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-mcp.svg)](https://pypi.org/project/bankstatementparser-mcp/) | AI Protocol | Model Context Protocol (MCP) server exposing statement tools to LLMs & AI agents |
721
713
  | [`bankstatementparser-lsp`](https://github.com/sebastienrousseau/bankstatementparser-lsp) | [`sebastienrousseau/bankstatementparser-lsp`](https://github.com/sebastienrousseau/bankstatementparser-lsp) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-lsp.svg)](https://pypi.org/project/bankstatementparser-lsp/) | Developer Tooling | Language Server Protocol (LSP) with live SWIFT MT940 statement validation & diagnostics |
722
- | [`bankstatementparser-transport-ebics`](https://github.com/sebastienrousseau/bankstatementparser-transport-ebics) | [`sebastienrousseau/bankstatementparser-transport-ebics`](https://github.com/sebastienrousseau/bankstatementparser-transport-ebics) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-transport-ebics.svg)](https://pypi.org/project/bankstatementparser-transport-ebics/) | Transport | Automated bank statement retrieval over EBICS 3.0 (`H005`) and 2.5 (`H004`) protocols |
714
+ | [`bankstatementparser-transport-ebics`](https://github.com/sebastienrousseau/bankstatementparser-transport-ebics) | [`sebastienrousseau/bankstatementparser-transport-ebics`](https://github.com/sebastienrousseau/bankstatementparser-transport-ebics) | [![Release](https://img.shields.io/github/v/release/sebastienrousseau/bankstatementparser-transport-ebics.svg)](https://github.com/sebastienrousseau/bankstatementparser-transport-ebics/releases) | Transport | Automated bank statement retrieval over EBICS 3.0 (`H005`) and 2.5 (`H004`) protocols |
723
715
  | [`bankstatementparser-writer-xlsx`](https://github.com/sebastienrousseau/bankstatementparser-writer-xlsx) | [`sebastienrousseau/bankstatementparser-writer-xlsx`](https://github.com/sebastienrousseau/bankstatementparser-writer-xlsx) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-writer-xlsx.svg)](https://pypi.org/project/bankstatementparser-writer-xlsx/) | Output Writer | Formats and exports parsed banking transactions into styled Microsoft Excel (`.xlsx`) workbooks |
724
- | [`bankstatementparser-writer-qif`](https://github.com/sebastienrousseau/bankstatementparser-writer-qif) | [`sebastienrousseau/bankstatementparser-writer-qif`](https://github.com/sebastienrousseau/bankstatementparser-writer-qif) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-writer-qif.svg)](https://pypi.org/project/bankstatementparser-writer-qif/) | Output Writer | Serializes transactions into standard Quicken Interchange Format (`.qif`) exchange files |
725
- | [`bankstatementparser-writer-ofx`](https://github.com/sebastienrousseau/bankstatementparser-writer-ofx) | [`sebastienrousseau/bankstatementparser-writer-ofx`](https://github.com/sebastienrousseau/bankstatementparser-writer-ofx) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-writer-ofx.svg)](https://pypi.org/project/bankstatementparser-writer-ofx/) | Output Writer | Serializes transactions into standard Open Financial Exchange (`.ofx`) XML/SGML files |
726
- | [`bankstatementparser-writer-swift`](https://github.com/sebastienrousseau/bankstatementparser-writer-swift) | [`sebastienrousseau/bankstatementparser-writer-swift`](https://github.com/sebastienrousseau/bankstatementparser-writer-swift) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-writer-swift.svg)](https://pypi.org/project/bankstatementparser-writer-swift/) | Output Writer | Exports transactions to SWIFT MT940 customer statements and MT942 interim reports |
716
+ | [`bankstatementparser-writer-qif`](https://github.com/sebastienrousseau/bankstatementparser-writer-qif) | [`sebastienrousseau/bankstatementparser-writer-qif`](https://github.com/sebastienrousseau/bankstatementparser-writer-qif) | [![Release](https://img.shields.io/github/v/release/sebastienrousseau/bankstatementparser-writer-qif.svg)](https://github.com/sebastienrousseau/bankstatementparser-writer-qif/releases) | Output Writer | Serializes transactions into standard Quicken Interchange Format (`.qif`) exchange files |
717
+ | [`bankstatementparser-writer-ofx`](https://github.com/sebastienrousseau/bankstatementparser-writer-ofx) | [`sebastienrousseau/bankstatementparser-writer-ofx`](https://github.com/sebastienrousseau/bankstatementparser-writer-ofx) | [![Release](https://img.shields.io/github/v/release/sebastienrousseau/bankstatementparser-writer-ofx.svg)](https://github.com/sebastienrousseau/bankstatementparser-writer-ofx/releases) | Output Writer | Serializes transactions into standard Open Financial Exchange (`.ofx`) XML/SGML files |
718
+ | [`bankstatementparser-writer-swift`](https://github.com/sebastienrousseau/bankstatementparser-writer-swift) | [`sebastienrousseau/bankstatementparser-writer-swift`](https://github.com/sebastienrousseau/bankstatementparser-writer-swift) | [![Release](https://img.shields.io/github/v/release/sebastienrousseau/bankstatementparser-writer-swift.svg)](https://github.com/sebastienrousseau/bankstatementparser-writer-swift/releases) | Output Writer | Exports transactions to SWIFT MT940 customer statements and MT942 interim reports |
727
719
  | [`bankstatementparser-loader-bai2`](https://github.com/sebastienrousseau/bankstatementparser-loader-bai2) | [`sebastienrousseau/bankstatementparser-loader-bai2`](https://github.com/sebastienrousseau/bankstatementparser-loader-bai2) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-loader-bai2.svg)](https://pypi.org/project/bankstatementparser-loader-bai2/) | Input Loader | Parses BAI2 cash-management and account balance statements |
728
720
  | [`bankstatementparser-loader-mt942`](https://github.com/sebastienrousseau/bankstatementparser-loader-mt942) | [`sebastienrousseau/bankstatementparser-loader-mt942`](https://github.com/sebastienrousseau/bankstatementparser-loader-mt942) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-loader-mt942.svg)](https://pypi.org/project/bankstatementparser-loader-mt942/) | Input Loader | Parses SWIFT MT942 interim transaction reports with credit/debit summary reconciliation |
729
- | [`bankstatementparser-loader-cfonb`](https://github.com/sebastienrousseau/bankstatementparser-loader-cfonb) | [`sebastienrousseau/bankstatementparser-loader-cfonb`](https://github.com/sebastienrousseau/bankstatementparser-loader-cfonb) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-loader-cfonb.svg)](https://pypi.org/project/bankstatementparser-loader-cfonb/) | Input Loader | Parses French CFONB 120 / AFB120 120-byte fixed-width banking statement files |
730
- | [`bankstatementparser-loader-camt054`](https://github.com/sebastienrousseau/bankstatementparser-loader-camt054) | [`sebastienrousseau/bankstatementparser-loader-camt054`](https://github.com/sebastienrousseau/bankstatementparser-loader-camt054) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-loader-camt054.svg)](https://pypi.org/project/bankstatementparser-loader-camt054/) | Input Loader | Ingests ISO 20022 CAMT.054 real-time debit/credit notification stream XML |
731
- | [`bankstatementparser-loader-sepa`](https://github.com/sebastienrousseau/bankstatementparser-loader-sepa) | [`sebastienrousseau/bankstatementparser-loader-sepa`](https://github.com/sebastienrousseau/bankstatementparser-loader-sepa) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-loader-sepa.svg)](https://pypi.org/project/bankstatementparser-loader-sepa/) | Input Loader | Ingests ISO 20022 SEPA PAIN.002 payment status reports and PAIN.008 direct debit mandates |
732
- | [`bankstatementparser-loader-bacs`](https://github.com/sebastienrousseau/bankstatementparser-loader-bacs) | [`sebastienrousseau/bankstatementparser-loader-bacs`](https://github.com/sebastienrousseau/bankstatementparser-loader-bacs) | [![PyPI](https://img.shields.io/pypi/v/bankstatementparser-loader-bacs.svg)](https://pypi.org/project/bankstatementparser-loader-bacs/) | Input Loader | Parses UK BACS Standard 18 / Faster Payments 106-byte fixed-width transmission files |
721
+ | [`bankstatementparser-loader-cfonb`](https://github.com/sebastienrousseau/bankstatementparser-loader-cfonb) | [`sebastienrousseau/bankstatementparser-loader-cfonb`](https://github.com/sebastienrousseau/bankstatementparser-loader-cfonb) | [![Release](https://img.shields.io/github/v/release/sebastienrousseau/bankstatementparser-loader-cfonb.svg)](https://github.com/sebastienrousseau/bankstatementparser-loader-cfonb/releases) | Input Loader | Parses French CFONB 120 / AFB120 120-byte fixed-width banking statement files |
722
+ | [`bankstatementparser-loader-camt054`](https://github.com/sebastienrousseau/bankstatementparser-loader-camt054) | [`sebastienrousseau/bankstatementparser-loader-camt054`](https://github.com/sebastienrousseau/bankstatementparser-loader-camt054) | [![Release](https://img.shields.io/github/v/release/sebastienrousseau/bankstatementparser-loader-camt054.svg)](https://github.com/sebastienrousseau/bankstatementparser-loader-camt054/releases) | Input Loader | Ingests ISO 20022 CAMT.054 real-time debit/credit notification stream XML |
723
+ | [`bankstatementparser-loader-sepa`](https://github.com/sebastienrousseau/bankstatementparser-loader-sepa) | [`sebastienrousseau/bankstatementparser-loader-sepa`](https://github.com/sebastienrousseau/bankstatementparser-loader-sepa) | [![Release](https://img.shields.io/github/v/release/sebastienrousseau/bankstatementparser-loader-sepa.svg)](https://github.com/sebastienrousseau/bankstatementparser-loader-sepa/releases) | Input Loader | Ingests ISO 20022 SEPA PAIN.002 payment status reports and PAIN.008 direct debit mandates |
724
+ | [`bankstatementparser-loader-bacs`](https://github.com/sebastienrousseau/bankstatementparser-loader-bacs) | [`sebastienrousseau/bankstatementparser-loader-bacs`](https://github.com/sebastienrousseau/bankstatementparser-loader-bacs) | [![Release](https://img.shields.io/github/v/release/sebastienrousseau/bankstatementparser-loader-bacs.svg)](https://github.com/sebastienrousseau/bankstatementparser-loader-bacs/releases) | Input Loader | Parses UK BACS Standard 18 / Faster Payments 106-byte fixed-width transmission files |
733
725
 
734
726
  Loaders turn an additional source format into the same unified
735
727
  `Transaction` model; writers take parsed data back out to another
@@ -752,7 +744,7 @@ cleanly — see each companion's README for runnable examples.
752
744
  ```text
753
745
  bankstatementparser/ Source code (55 modules)
754
746
  bankstatementparser/analytics/ Financial metrics, cash flow, cadence & anomaly detection
755
- bankstatementparser/parsers/ Modular statement parsers (CSV, MT940, OFX/QFX)
747
+ bankstatementparser/parsers/ Modular statement parsers (CSV, MT940, MT942, BAI2, OFX/QFX)
756
748
  bankstatementparser/hybrid/ PDF pipeline: orchestrator, llm_extractor, vision, scanner, ollama_direct, verification
757
749
  bankstatementparser/enrichment/ Categorizer, AccountMapper, EnrichedTransaction
758
750
  bankstatementparser/export/ hledger + beancount journal export, Apache Parquet columnar export
@@ -825,7 +817,7 @@ Signed commits required. See [CONTRIBUTING.md](CONTRIBUTING.md).
825
817
  ## FAQ
826
818
 
827
819
  **What formats are supported?**
828
- CAMT.053, PAIN.001, CSV, OFX, QFX, and MT940.
820
+ CAMT (CAMT.052, CAMT.053, CAMT.054), PAIN.001, SWIFT MT940, SWIFT MT942, BAI2, OFX, QFX, CSV, and PDF.
829
821
 
830
822
  **Does any data leave my infrastructure?**
831
823
  No. Zero network calls. XML parsers enforce `no_network=True`. No
@@ -873,4 +865,3 @@ See [LICENSE](LICENSE).
873
865
  See [CHANGELOG.md](CHANGELOG.md) for release history.
874
866
 
875
867
  <p align="right"><a href="#contents">Back to Top</a></p>
876
-
@@ -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.27"
110
+ __version__ = "0.0.29"
111
111
 
112
112
  __all__ = [
113
113
  "AnalyticsReport",
@@ -18,9 +18,10 @@
18
18
  from __future__ import annotations
19
19
 
20
20
  from .ledger import to_beancount, to_hledger
21
- from .parquet import export_parquet, export_parquet_stream
21
+ from .parquet import ParquetStreamWriter, export_parquet, export_parquet_stream
22
22
 
23
23
  __all__ = [
24
+ "ParquetStreamWriter",
24
25
  "export_parquet",
25
26
  "export_parquet_stream",
26
27
  "to_beancount",
@@ -1,7 +1,7 @@
1
1
  [tool.poetry]
2
2
  name = "bankstatementparser"
3
- version = "0.0.27"
4
- description = "Parse bank statements (CAMT.053, PAIN.001, MT940, OFX, BAI2, CSV, and PDF) into unified Transactions with treasury analytics, 2-way reconciliation, PDF forensics, and ledger export."
3
+ version = "0.0.29"
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",
@@ -37,21 +38,32 @@ openpyxl = {version = "^3.1.5", optional = true}
37
38
  pandas = "^2.3.3"
38
39
  defusedxml = "^0.7.1"
39
40
  pydantic = "^2.11.0"
40
- polars = {version = "^1.32.0", optional = true}
41
+ polars = {version = ">=1.32.0,<3", optional = true}
41
42
  litellm = {version = ">=1.83.10", optional = true, python = "<3.14"}
42
- pypdf = {version = ">=4.0.0", optional = true}
43
- pdfplumber = {version = ">=0.11.0", optional = true}
43
+ pypdf = {version = ">=6.21.2", optional = true}
44
+ # pdfplumber pulls Pillow; the first Pillow without its open advisories
45
+ # (13.0.0) needs Python 3.11, so hybrid-plus does too.
46
+ pdfplumber = {version = ">=0.11.0", optional = true, python = ">=3.11"}
44
47
  pypdfium2 = {version = ">=4.30.0", optional = true}
45
48
  fastapi = {version = ">=0.115.0", optional = true}
46
49
  uvicorn = {version = ">=0.34.0", optional = true}
47
50
  python-multipart = {version = ">=0.0.32", optional = true}
48
51
  pyarrow = {version = ">=14.0.0", optional = true}
52
+ # Floors for packages the extras pull in transitively, set to the first
53
+ # release without a published advisory so no affected version resolves.
54
+ pillow = {version = ">=13.0.0", optional = true, python = ">=3.11"}
55
+ certifi = {version = ">=2026.10.19", optional = true}
56
+ aiohttp = {version = ">=3.14.4", optional = true, python = "<3.14"}
57
+ # 3.20.3 is the only filelock clear of every advisory: earlier ones are
58
+ # fixed in 3.20.3, newer ones affect 3.20.4 through 4.2.0, and litellm
59
+ # still requires filelock < 4.
60
+ filelock = {version = ">=3.20.3,<3.20.4", optional = true, python = "<3.14"}
49
61
 
50
62
  [tool.poetry.group.dev.dependencies]
51
63
  pytest = ">=8.0.0,<10.0.0"
52
64
  pytest-cov = "^7.1.0"
53
65
  pytest-benchmark = "^5.1.0"
54
- ruff = ">=0.15.7,<0.17"
66
+ ruff = ">=0.15.7,<0.18"
55
67
  mypy = ">=1.5,<3"
56
68
  bandit = "^1.7.0"
57
69
  hypothesis = ">=6.82,<7"
@@ -72,10 +84,10 @@ mkdocstrings = {version = ">=0.27", extras = ["python"]}
72
84
  excel = ["openpyxl"]
73
85
  polars = ["polars"]
74
86
  parquet = ["pyarrow"]
75
- hybrid = ["litellm", "pypdf"]
76
- hybrid-plus = ["litellm", "pypdf", "pdfplumber"]
77
- hybrid-vision = ["litellm", "pypdf", "pypdfium2"]
78
- enrichment = ["litellm"]
87
+ hybrid = ["litellm", "pypdf", "certifi", "aiohttp", "filelock"]
88
+ hybrid-plus = ["litellm", "pypdf", "pdfplumber", "pillow", "certifi", "aiohttp", "filelock"]
89
+ hybrid-vision = ["litellm", "pypdf", "pypdfium2", "certifi", "aiohttp", "filelock"]
90
+ enrichment = ["litellm", "certifi", "aiohttp", "filelock"]
79
91
  api = ["fastapi", "uvicorn", "python-multipart"]
80
92
 
81
93
  [tool.poetry.scripts]