moneymanager-parser 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.
@@ -0,0 +1,52 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ lint:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - uses: actions/setup-python@v5
13
+ with:
14
+ python-version: '3.12'
15
+ cache: pip
16
+ - run: python -m pip install -e '.[dev]'
17
+ - run: ruff check .
18
+ - run: ruff format --check .
19
+ typecheck:
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ - uses: actions/setup-python@v5
24
+ with:
25
+ python-version: '3.12'
26
+ cache: pip
27
+ - run: python -m pip install -e '.[dev]'
28
+ - run: mypy src
29
+ test:
30
+ runs-on: ubuntu-latest
31
+ strategy:
32
+ matrix:
33
+ python-version: ['3.10', '3.11', '3.12', '3.13']
34
+ steps:
35
+ - uses: actions/checkout@v4
36
+ - uses: actions/setup-python@v5
37
+ with:
38
+ python-version: ${{ matrix.python-version }}
39
+ cache: pip
40
+ - run: python -m pip install -e '.[dev]'
41
+ - run: pytest --cov --cov-report=term-missing --cov-report=xml
42
+ - name: Coverage summary
43
+ run: |
44
+ python - <<'PY' >> "$GITHUB_STEP_SUMMARY"
45
+ import xml.etree.ElementTree as ET
46
+ root = ET.parse('coverage.xml').getroot()
47
+ print(f"Coverage: {float(root.attrib['line-rate']) * 100:.2f}%")
48
+ PY
49
+ - uses: actions/upload-artifact@v4
50
+ with:
51
+ name: coverage-${{ matrix.python-version }}
52
+ path: coverage.xml
@@ -0,0 +1,27 @@
1
+ # One-time PyPI setup before the first tag:
2
+ # create a PyPI project or pending publisher for shubham1172/moneymanager-parser,
3
+ # workflow release.yml, environment pypi, package moneymanager-parser.
4
+ name: Release
5
+
6
+ on:
7
+ push:
8
+ tags:
9
+ - 'v*'
10
+
11
+ permissions:
12
+ contents: read
13
+ id-token: write
14
+
15
+ jobs:
16
+ build-and-publish:
17
+ runs-on: ubuntu-latest
18
+ environment: pypi
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - uses: actions/setup-python@v5
22
+ with:
23
+ python-version: '3.12'
24
+ cache: pip
25
+ - run: python -m pip install build
26
+ - run: python -m build
27
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,14 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.py[cod]
4
+ build/
5
+ dist/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .mypy_cache/
9
+ .ruff_cache/
10
+ .coverage
11
+ htmlcov/
12
+ *.mmbak
13
+ *.sqlite
14
+ *.db
@@ -0,0 +1,12 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here.
4
+
5
+ ## [Unreleased]
6
+
7
+ ## [0.1.0] - 2026-06-01
8
+
9
+ ### Added
10
+ - Initial typed SDK for reading Realbyte Money Manager `.mmbak` exports.
11
+ - Query, schema, category, account, and currency APIs.
12
+ - Offline JSON CLI exposed as `mmbak`.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shubham Sharma
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,104 @@
1
+ Metadata-Version: 2.4
2
+ Name: moneymanager-parser
3
+ Version: 0.1.0
4
+ Summary: Typed parser and query SDK for Realbyte Money Manager .mmbak backups.
5
+ Project-URL: Homepage, https://github.com/shubham1172/moneymanager-parser
6
+ Project-URL: Repository, https://github.com/shubham1172/moneymanager-parser
7
+ Project-URL: Issues, https://github.com/shubham1172/moneymanager-parser/issues
8
+ Author-email: Shubham Sharma <shubhamsharma1172@gmail.com>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: finance,mmbak,money-manager,realbyte,sqlite
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.10
22
+ Provides-Extra: dev
23
+ Requires-Dist: build>=1.2; extra == 'dev'
24
+ Requires-Dist: mypy>=1.10; extra == 'dev'
25
+ Requires-Dist: pytest-cov>=5.0; extra == 'dev'
26
+ Requires-Dist: pytest>=8.2; extra == 'dev'
27
+ Requires-Dist: ruff>=0.5; extra == 'dev'
28
+ Description-Content-Type: text/markdown
29
+
30
+ # moneymanager-parser
31
+
32
+ [![CI](https://github.com/shubham1172/moneymanager-parser/actions/workflows/ci.yml/badge.svg)](https://github.com/shubham1172/moneymanager-parser/actions/workflows/ci.yml)
33
+ ![PyPI](https://img.shields.io/badge/PyPI-unpublished-lightgrey)
34
+
35
+ Typed Python SDK and offline CLI for Realbyte Money Manager `.mmbak` exports.
36
+
37
+ A `.mmbak` export is a ZIP-wrapped SQLite database. This package reads the export locally,
38
+ resolves common schema aliases across app versions, and exposes transactions, summaries, flexible
39
+ queries, schema inspection, categories, accounts, and currencies. Core parsing uses only the Python
40
+ standard library. Income is exposed by the API, but expense-oriented analysis should treat it as
41
+ informational because Money Manager exports can vary by installation.
42
+
43
+ The backup's currencies are read from the `CURRENCY` table when present. `currency()` returns the main
44
+ currency (`ISO`, `symbol`, `name`); amounts are stored in the account/transaction currency and are not
45
+ converted.
46
+
47
+ ## Install
48
+
49
+ After the first release:
50
+
51
+ ```bash
52
+ pip install moneymanager-parser
53
+ ```
54
+
55
+ ## Quickstart
56
+
57
+ ```python
58
+ from moneymanager_parser import MoneyManagerBackup
59
+
60
+ with MoneyManagerBackup.from_file("backup.mmbak") as backup:
61
+ main = backup.currency()
62
+ if main:
63
+ print(main.iso, main.symbol)
64
+ for txn in backup.transactions():
65
+ print(txn.date, txn.kind, txn.category, txn.amount)
66
+ print(backup.query(month="2026-01", group_by="category").as_dict())
67
+ ```
68
+
69
+ Custom transaction type maps are supported:
70
+
71
+ ```python
72
+ MoneyManagerBackup.from_file("backup.mmbak", type_map={0: "income", 1: "expense", 7: "transfer"})
73
+ ```
74
+
75
+ ## CLI
76
+
77
+ ```bash
78
+ mmbak query backup.mmbak --month 2026-01 --group-by category --top 10
79
+ mmbak schema backup.mmbak
80
+ mmbak currency backup.mmbak
81
+ ```
82
+
83
+ All commands print JSON and never contact external services.
84
+
85
+ ## Development
86
+
87
+ ```bash
88
+ python3 -m venv .venv
89
+ . .venv/bin/activate
90
+ pip install -e '.[dev]'
91
+ ruff check .
92
+ ruff format --check .
93
+ mypy src
94
+ pytest --cov
95
+ ```
96
+
97
+ ## Contributing
98
+
99
+ Issues and pull requests are welcome. Please include tests for schema variants and avoid committing
100
+ personal exports; test backups should be generated synthetically.
101
+
102
+ ## License
103
+
104
+ MIT © 2026 Shubham Sharma
@@ -0,0 +1,75 @@
1
+ # moneymanager-parser
2
+
3
+ [![CI](https://github.com/shubham1172/moneymanager-parser/actions/workflows/ci.yml/badge.svg)](https://github.com/shubham1172/moneymanager-parser/actions/workflows/ci.yml)
4
+ ![PyPI](https://img.shields.io/badge/PyPI-unpublished-lightgrey)
5
+
6
+ Typed Python SDK and offline CLI for Realbyte Money Manager `.mmbak` exports.
7
+
8
+ A `.mmbak` export is a ZIP-wrapped SQLite database. This package reads the export locally,
9
+ resolves common schema aliases across app versions, and exposes transactions, summaries, flexible
10
+ queries, schema inspection, categories, accounts, and currencies. Core parsing uses only the Python
11
+ standard library. Income is exposed by the API, but expense-oriented analysis should treat it as
12
+ informational because Money Manager exports can vary by installation.
13
+
14
+ The backup's currencies are read from the `CURRENCY` table when present. `currency()` returns the main
15
+ currency (`ISO`, `symbol`, `name`); amounts are stored in the account/transaction currency and are not
16
+ converted.
17
+
18
+ ## Install
19
+
20
+ After the first release:
21
+
22
+ ```bash
23
+ pip install moneymanager-parser
24
+ ```
25
+
26
+ ## Quickstart
27
+
28
+ ```python
29
+ from moneymanager_parser import MoneyManagerBackup
30
+
31
+ with MoneyManagerBackup.from_file("backup.mmbak") as backup:
32
+ main = backup.currency()
33
+ if main:
34
+ print(main.iso, main.symbol)
35
+ for txn in backup.transactions():
36
+ print(txn.date, txn.kind, txn.category, txn.amount)
37
+ print(backup.query(month="2026-01", group_by="category").as_dict())
38
+ ```
39
+
40
+ Custom transaction type maps are supported:
41
+
42
+ ```python
43
+ MoneyManagerBackup.from_file("backup.mmbak", type_map={0: "income", 1: "expense", 7: "transfer"})
44
+ ```
45
+
46
+ ## CLI
47
+
48
+ ```bash
49
+ mmbak query backup.mmbak --month 2026-01 --group-by category --top 10
50
+ mmbak schema backup.mmbak
51
+ mmbak currency backup.mmbak
52
+ ```
53
+
54
+ All commands print JSON and never contact external services.
55
+
56
+ ## Development
57
+
58
+ ```bash
59
+ python3 -m venv .venv
60
+ . .venv/bin/activate
61
+ pip install -e '.[dev]'
62
+ ruff check .
63
+ ruff format --check .
64
+ mypy src
65
+ pytest --cov
66
+ ```
67
+
68
+ ## Contributing
69
+
70
+ Issues and pull requests are welcome. Please include tests for schema variants and avoid committing
71
+ personal exports; test backups should be generated synthetically.
72
+
73
+ ## License
74
+
75
+ MIT © 2026 Shubham Sharma
@@ -0,0 +1,70 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.25"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "moneymanager-parser"
7
+ dynamic = ["version"]
8
+ description = "Typed parser and query SDK for Realbyte Money Manager .mmbak backups."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "Shubham Sharma", email = "shubhamsharma1172@gmail.com" }]
14
+ keywords = ["money-manager", "realbyte", "mmbak", "sqlite", "finance"]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Intended Audience :: Developers",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Python :: 3.13",
24
+ "Typing :: Typed",
25
+ ]
26
+
27
+ [project.urls]
28
+ Homepage = "https://github.com/shubham1172/moneymanager-parser"
29
+ Repository = "https://github.com/shubham1172/moneymanager-parser"
30
+ Issues = "https://github.com/shubham1172/moneymanager-parser/issues"
31
+
32
+ [project.scripts]
33
+ mmbak = "moneymanager_parser.cli:main"
34
+
35
+ [project.optional-dependencies]
36
+ dev = [
37
+ "build>=1.2",
38
+ "mypy>=1.10",
39
+ "pytest>=8.2",
40
+ "pytest-cov>=5.0",
41
+ "ruff>=0.5",
42
+ ]
43
+
44
+ [tool.hatch.version]
45
+ path = "src/moneymanager_parser/__init__.py"
46
+
47
+ [tool.ruff]
48
+ line-length = 100
49
+ target-version = "py310"
50
+
51
+ [tool.ruff.lint]
52
+ select = ["E", "F", "I", "UP", "B"]
53
+ ignore = ["E501"]
54
+
55
+ [tool.mypy]
56
+ python_version = "3.10"
57
+ strict = true
58
+ mypy_path = "src"
59
+
60
+ [tool.pytest.ini_options]
61
+ addopts = "-ra"
62
+ testpaths = ["tests"]
63
+
64
+ [tool.coverage.run]
65
+ branch = true
66
+ source = ["moneymanager_parser"]
67
+
68
+ [tool.coverage.report]
69
+ show_missing = true
70
+ fail_under = 90
@@ -0,0 +1,15 @@
1
+ """Typed SDK for Realbyte Money Manager backup files."""
2
+
3
+ from .core import MoneyManagerBackup
4
+ from .models import Account, Currency, QueryResult, Transaction
5
+
6
+ __version__ = "0.1.0"
7
+
8
+ __all__ = [
9
+ "Account",
10
+ "Currency",
11
+ "MoneyManagerBackup",
12
+ "QueryResult",
13
+ "Transaction",
14
+ "__version__",
15
+ ]
@@ -0,0 +1,86 @@
1
+ """Command line interface for moneymanager-parser."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import json
7
+ from collections.abc import Sequence
8
+ from typing import Any
9
+
10
+ from .core import MoneyManagerBackup
11
+ from .models import Currency
12
+
13
+
14
+ def _print(data: Any) -> None:
15
+ print(json.dumps(data, indent=2, default=str))
16
+
17
+
18
+ def _currency_dict(currency: Currency | None) -> dict[str, Any] | None:
19
+ if currency is None:
20
+ return None
21
+ return {
22
+ "iso": currency.iso,
23
+ "symbol": currency.symbol,
24
+ "name": currency.name,
25
+ "is_main": currency.is_main,
26
+ }
27
+
28
+
29
+ def build_parser() -> argparse.ArgumentParser:
30
+ parser = argparse.ArgumentParser(prog="mmbak", description="Offline Realbyte .mmbak parser")
31
+ sub = parser.add_subparsers(dest="command", required=True)
32
+ for name in ("schema", "currency"):
33
+ cmd = sub.add_parser(name)
34
+ cmd.add_argument("path")
35
+ query = sub.add_parser("query")
36
+ query.add_argument("path")
37
+ query.add_argument("--from", dest="date_from")
38
+ query.add_argument("--to", dest="date_to")
39
+ query.add_argument("--month")
40
+ query.add_argument("--category")
41
+ query.add_argument("--search")
42
+ query.add_argument("--kind", choices=["expense", "income", "all"], default="expense")
43
+ query.add_argument("--group-by", choices=["month", "category", "day", "week"])
44
+ query.add_argument("--top", type=int)
45
+ query.add_argument("--list", dest="list_n", type=int)
46
+ query.add_argument("--limit", type=int, default=24)
47
+ return parser
48
+
49
+
50
+ def main(argv: Sequence[str] | None = None) -> int:
51
+ args = build_parser().parse_args(argv)
52
+ try:
53
+ with MoneyManagerBackup.from_file(args.path) as backup:
54
+ if args.command == "schema":
55
+ _print(backup.schema())
56
+ elif args.command == "currency":
57
+ main_currency = backup.currency()
58
+ _print(
59
+ {
60
+ "main": _currency_dict(main_currency),
61
+ "all": [_currency_dict(item) for item in backup.currencies()],
62
+ }
63
+ )
64
+ else:
65
+ _print(
66
+ backup.query(
67
+ date_from=args.date_from,
68
+ date_to=args.date_to,
69
+ month=args.month,
70
+ category=args.category,
71
+ search=args.search,
72
+ kind=args.kind,
73
+ group_by=args.group_by,
74
+ top=args.top,
75
+ list_n=args.list_n,
76
+ limit=args.limit,
77
+ ).as_dict()
78
+ )
79
+ except Exception as exc: # noqa: BLE001
80
+ _print({"status": "error", "reason": str(exc)})
81
+ return 1
82
+ return 0
83
+
84
+
85
+ if __name__ == "__main__":
86
+ raise SystemExit(main())