bankfiletool-statement-check 0.1.0__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.
- bankfiletool_statement_check-0.1.0/LICENSE +21 -0
- bankfiletool_statement_check-0.1.0/PKG-INFO +27 -0
- bankfiletool_statement_check-0.1.0/README.md +13 -0
- bankfiletool_statement_check-0.1.0/bankfiletool_statement_check.egg-info/PKG-INFO +27 -0
- bankfiletool_statement_check-0.1.0/bankfiletool_statement_check.egg-info/SOURCES.txt +9 -0
- bankfiletool_statement_check-0.1.0/bankfiletool_statement_check.egg-info/dependency_links.txt +1 -0
- bankfiletool_statement_check-0.1.0/bankfiletool_statement_check.egg-info/entry_points.txt +2 -0
- bankfiletool_statement_check-0.1.0/bankfiletool_statement_check.egg-info/top_level.txt +1 -0
- bankfiletool_statement_check-0.1.0/bankfiletool_statement_check.py +71 -0
- bankfiletool_statement_check-0.1.0/pyproject.toml +21 -0
- bankfiletool_statement_check-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 bankfiletool-statement-check contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bankfiletool-statement-check
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Local balance reconciliation for exported statement CSV files
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://bankfiletool.com/
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Environment :: Console
|
|
9
|
+
Classifier: Topic :: Office/Business :: Financial :: Accounting
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# BankFileTool Statement Check
|
|
16
|
+
|
|
17
|
+
Reconcile statement totals using exact decimal arithmetic, or inspect the first row of a CSV export for reviewable columns. This tool works locally and does not upload financial files.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install bankfiletool-statement-check
|
|
21
|
+
bankfiletool-check totals 100.00 55.25 20.10 135.15
|
|
22
|
+
bankfiletool-check headers transactions.csv
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
When preparing statement data for an import, keep the original statement beside the CSV and verify dates, signs, and several transaction rows. A [Bank Statement Converter](https://bankfiletool.com/) can create the export, while this small companion checks arithmetic and column readiness. A matching balance does not prove that every transaction was extracted correctly.
|
|
26
|
+
|
|
27
|
+
Review private files under your own retention rules.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# BankFileTool Statement Check
|
|
2
|
+
|
|
3
|
+
Reconcile statement totals using exact decimal arithmetic, or inspect the first row of a CSV export for reviewable columns. This tool works locally and does not upload financial files.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pip install bankfiletool-statement-check
|
|
7
|
+
bankfiletool-check totals 100.00 55.25 20.10 135.15
|
|
8
|
+
bankfiletool-check headers transactions.csv
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
When preparing statement data for an import, keep the original statement beside the CSV and verify dates, signs, and several transaction rows. A [Bank Statement Converter](https://bankfiletool.com/) can create the export, while this small companion checks arithmetic and column readiness. A matching balance does not prove that every transaction was extracted correctly.
|
|
12
|
+
|
|
13
|
+
Review private files under your own retention rules.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bankfiletool-statement-check
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Local balance reconciliation for exported statement CSV files
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://bankfiletool.com/
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Environment :: Console
|
|
9
|
+
Classifier: Topic :: Office/Business :: Financial :: Accounting
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# BankFileTool Statement Check
|
|
16
|
+
|
|
17
|
+
Reconcile statement totals using exact decimal arithmetic, or inspect the first row of a CSV export for reviewable columns. This tool works locally and does not upload financial files.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install bankfiletool-statement-check
|
|
21
|
+
bankfiletool-check totals 100.00 55.25 20.10 135.15
|
|
22
|
+
bankfiletool-check headers transactions.csv
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
When preparing statement data for an import, keep the original statement beside the CSV and verify dates, signs, and several transaction rows. A [Bank Statement Converter](https://bankfiletool.com/) can create the export, while this small companion checks arithmetic and column readiness. A matching balance does not prove that every transaction was extracted correctly.
|
|
26
|
+
|
|
27
|
+
Review private files under your own retention rules.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
bankfiletool_statement_check.py
|
|
4
|
+
pyproject.toml
|
|
5
|
+
bankfiletool_statement_check.egg-info/PKG-INFO
|
|
6
|
+
bankfiletool_statement_check.egg-info/SOURCES.txt
|
|
7
|
+
bankfiletool_statement_check.egg-info/dependency_links.txt
|
|
8
|
+
bankfiletool_statement_check.egg-info/entry_points.txt
|
|
9
|
+
bankfiletool_statement_check.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
bankfiletool_statement_check
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""Reconcile statement totals locally using exact decimal arithmetic."""
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import csv
|
|
5
|
+
import json
|
|
6
|
+
import re
|
|
7
|
+
from decimal import Decimal
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
MONEY = re.compile(r"^-?(?:0|[1-9]\d*)(?:\.\d{1,2})?$")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def parse_money(raw: str, *, allow_negative: bool = True) -> Decimal:
|
|
14
|
+
text = raw.strip()
|
|
15
|
+
if not MONEY.fullmatch(text) or (not allow_negative and text.startswith("-")):
|
|
16
|
+
raise ValueError("Amounts must be plain decimal strings with at most two places")
|
|
17
|
+
return Decimal(text)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def reconcile(opening: str, credits: str, debits: str, closing: str) -> dict:
|
|
21
|
+
start = parse_money(opening)
|
|
22
|
+
incoming = parse_money(credits, allow_negative=False)
|
|
23
|
+
outgoing = parse_money(debits, allow_negative=False)
|
|
24
|
+
printed = parse_money(closing)
|
|
25
|
+
calculated = start + incoming - outgoing
|
|
26
|
+
difference = calculated - printed
|
|
27
|
+
return {
|
|
28
|
+
"calculated_closing": f"{calculated:.2f}",
|
|
29
|
+
"printed_closing": f"{printed:.2f}",
|
|
30
|
+
"difference": f"{difference:.2f}",
|
|
31
|
+
"matches": difference == 0,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def review_csv_headers(path: str) -> dict:
|
|
36
|
+
with open(path, newline="", encoding="utf-8-sig") as stream:
|
|
37
|
+
headers = next(csv.reader(stream), [])
|
|
38
|
+
normalized = [item.strip().lower() for item in headers]
|
|
39
|
+
has_date = any("date" in item for item in normalized)
|
|
40
|
+
has_description = any(any(term in item for term in ("description", "memo", "payee", "details")) for item in normalized)
|
|
41
|
+
has_amount = any("amount" in item for item in normalized)
|
|
42
|
+
has_split = any("debit" in item for item in normalized) and any("credit" in item for item in normalized)
|
|
43
|
+
missing = []
|
|
44
|
+
if not has_date:
|
|
45
|
+
missing.append("date")
|
|
46
|
+
if not has_description:
|
|
47
|
+
missing.append("description or payee")
|
|
48
|
+
if not (has_amount or has_split):
|
|
49
|
+
missing.append("amount or debit+credit")
|
|
50
|
+
return {"headers": headers, "missing": missing, "ready_for_manual_review": not missing}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def main(argv=None) -> int:
|
|
54
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
55
|
+
sub = parser.add_subparsers(dest="command", required=True)
|
|
56
|
+
totals = sub.add_parser("totals", help="Compare opening + credits - debits with closing")
|
|
57
|
+
for name in ("opening", "credits", "debits", "closing"):
|
|
58
|
+
totals.add_argument(name)
|
|
59
|
+
headers = sub.add_parser("headers", help="Check whether a CSV has reviewable columns")
|
|
60
|
+
headers.add_argument("csv_file")
|
|
61
|
+
args = parser.parse_args(argv)
|
|
62
|
+
try:
|
|
63
|
+
result = reconcile(args.opening, args.credits, args.debits, args.closing) if args.command == "totals" else review_csv_headers(args.csv_file)
|
|
64
|
+
except (ValueError, OSError) as exc:
|
|
65
|
+
parser.error(str(exc))
|
|
66
|
+
print(json.dumps(result, indent=2))
|
|
67
|
+
return 0
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
if __name__ == "__main__":
|
|
71
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "bankfiletool-statement-check"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Local balance reconciliation for exported statement CSV files"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
classifiers = ["Programming Language :: Python :: 3", "Environment :: Console", "Topic :: Office/Business :: Financial :: Accounting"]
|
|
13
|
+
|
|
14
|
+
[project.urls]
|
|
15
|
+
Homepage = "https://bankfiletool.com/"
|
|
16
|
+
|
|
17
|
+
[project.scripts]
|
|
18
|
+
bankfiletool-check = "bankfiletool_statement_check:main"
|
|
19
|
+
|
|
20
|
+
[tool.setuptools]
|
|
21
|
+
py-modules = ["bankfiletool_statement_check"]
|