-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
72 lines (62 loc) · 1.93 KB
/
config.py
File metadata and controls
72 lines (62 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
"""Main entrypoint for using beancount. This is the Python file to be executed.
Example usage (with uv):
- `uv run config.py extract -e ./ledger/main.bean ./documents/ > ./ledger/tmp.bean`
- `uv run config.py identify ./documents`
"""
import sys
from os import path
import beangulp
from smart_importer import PredictPayees, PredictPostings
from src.importers import caixabank, n26, paypal, revolut
# beancount doesn't run from this directory
sys.path.insert(0, path.join(path.dirname(__file__)))
# Setting this variable provides a list of importer instances.
CONFIG = [
PredictPostings().wrap(
PredictPayees().wrap(
caixabank.CaixabankImporter(
{
"main_account": "Assets:EU:CaixaBank:Checking",
"filename_pattern": "^Caixabank-",
"account_number": "0101278127",
}
)
)
),
PredictPostings().wrap(
PredictPayees().wrap(
paypal.PaypalImporter(
{
"main_account": "Assets:Online:Paypal:Checking",
"filename_pattern": "^Paypal-",
}
)
)
),
PredictPostings().wrap(
PredictPayees().wrap(
revolut.RevolutImporter(
{
"main_account": "Assets:EU:Revolut:Checking",
"filename_pattern": "^Revolut-",
}
)
)
),
PredictPostings().wrap(
PredictPayees().wrap(
n26.N26Importer(
{
"main_account": "Assets:EU:N26:Checking",
"filename_pattern": "^N26-",
}
)
)
),
]
HOOKS = []
# Override the header on extracted text (if desired).
# extract.HEADER = ';; -*- mode: org; mode: beancount; coding: utf-8; -*-\n'
if __name__ == "__main__":
ingest = beangulp.Ingest(CONFIG, HOOKS)
ingest()