Skip to content

Commit 084757c

Browse files
committed
Full rebase to turn repository public
0 parents  commit 084757c

22 files changed

+2060
-0
lines changed

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "pip" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"

.github/workflows/pdmlint.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: pdm_lint
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
python-version: ["3.10"]
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Setup PDM
14+
uses: pdm-project/setup-pdm@v4
15+
with:
16+
python-version: ${{ matrix.python-version }}
17+
cache: true
18+
- name: Install dependencies
19+
run: pdm install
20+
- name: Run linter
21+
run: pdm lint

.github/workflows/release.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# This workflow will upload a Python Package to PyPI when a release is created
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package
10+
11+
on:
12+
release:
13+
types: [published]
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
release-build:
20+
runs-on: ubuntu-latest
21+
strategy:
22+
matrix:
23+
python-version: ["3.10"]
24+
steps:
25+
- uses: actions/checkout@v4
26+
- name: Setup PDM
27+
uses: pdm-project/setup-pdm@v4
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
cache: true
31+
- name: Install dependencies
32+
run: pdm install
33+
- name: Run linter
34+
run: pdm lint
35+
- name: Build release
36+
run: pdm build
37+
- name: Upload distributions
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: release-dists
41+
path: dist/
42+
43+
pypi-publish:
44+
runs-on: ubuntu-latest
45+
needs:
46+
- release-build
47+
permissions:
48+
id-token: write
49+
environment:
50+
name: pypi
51+
url: https://pypi.org/p/ngtonic
52+
steps:
53+
- name: Retrieve release distributions
54+
uses: actions/download-artifact@v4
55+
with:
56+
name: release-dists
57+
path: dist/
58+
59+
- name: Publish release distributions to PyPI
60+
uses: pypa/gh-action-pypi-publish@release/v1
61+
with:
62+
packages-dir: dist/

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.pdm-python
2+
dist
3+
src/ngtonic/__pycache__
4+
src/.mypy_cache/

.pre-commit-config.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v3.2.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-ast
11+
- id: check-added-large-files
12+
- id: check-merge-conflict
13+
- repo: https://github.com/astral-sh/ruff-pre-commit
14+
rev: v0.11.0
15+
hooks:
16+
# Run the linter.
17+
- id: ruff
18+
args: [ --fix ]
19+
# Run the formatter.
20+
- id: ruff-format

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM python:3.13
2+
3+
RUN pip install -U pdm
4+
ENV PDM_CHECK_UPDATE=false
5+
COPY pyproject.toml pdm.lock README.md /app/
6+
COPY src/ /app/src
7+
WORKDIR /app
8+
RUN pdm install --check --prod --no-editable
9+
CMD ["ngtonic"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Daniel Pañeda
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.

README.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
<h1 align="center">ngtonic</h1>
2+
<h3 align="center">Personal finances on your terminal</h2>
3+
4+
<p align="center">
5+
<a href="https://pypi.org/project/ngtonic/">
6+
<img alt="CI" src="https://img.shields.io/pypi/v/ngtonic?logo=pypi&logoColor=white">
7+
</a>
8+
<img alt="PyPI - License" src="https://img.shields.io/pypi/l/ngtonic">
9+
<img alt="Linux" src="https://img.shields.io/badge/Linux-FCC624?logo=linux&logoColor=black">
10+
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/ngtonic">
11+
</p>
12+
13+
## 🌟 Motivation and Description
14+
15+
Ngtonic is a small tool created to manage personal finances directly from the terminal, avoiding the need to share sensitive financial data with third-party apps. It's tailored for my specific needs. Currently, Ngtonic only supports ING bank, leveraging its automatic categorization of movements.
16+
17+
I also created it as an example of building a project "the right way" on GitHub.
18+
19+
## 🤔 Why Use Ngtonic?
20+
21+
Consider using Ngtonic if you:
22+
23+
- Prefer not to use apps like Fintonic
24+
- Primarily use ING for personal expenses
25+
- Want a simple, terminal-based tool to check your finances
26+
- Value privacy and keeping your financial data local
27+
28+
For those seeking more advanced features or a GUI, [Firefly III](https://www.firefly-iii.org) might be a better option.
29+
30+
## 👨‍💻 Getting started
31+
32+
1. Install using [pipx](https://pipx.pypa.io/stable/installation/) (recommended) or pip:
33+
34+
```bash
35+
pipx install ngtonic
36+
```
37+
38+
2. Download your ING account movements as an Excel file.
39+
40+
3. Import the movements:
41+
42+
```bash
43+
ngtonic import movements.xls
44+
```
45+
46+
Your data is now stored locally in `.ngtonic/movements.json`. You can import multiple files; Ngtonic will automatically deduplicate the data.
47+
48+
## 📊 Usage
49+
50+
Ngtonic offers several commands:
51+
52+
```
53+
╭─ Commands ──────────────────────────────────────────────────────────────────────────────╮
54+
│ import Import movements files to the internal storage (only ING is supported) │
55+
│ list Show a table listing the movements with optional filtering │
56+
│ balance-plot Plot the evolution of the balance over time │
57+
│ month-plot Plot the movements grouped per month │
58+
│ find-bills Use a simple heuristic to find regular bills, like subscriptions │
59+
╰─────────────────────────────────────────────────────────────────────────────────────────╯
60+
```
61+
62+
```bash
63+
# Use category filtering to list home expenses
64+
ngtonic list -c hogar
65+
66+
# List leisure expenses by month
67+
ngtonic list -c ocio -m
68+
69+
# Check Steam purchases by month
70+
ngtonic list -d steam -m
71+
72+
# Use the integrated heuristic to find regular bills
73+
ngtonic find-bills
74+
```
75+
The plot commands enable you to visualize movements grouped by month or track the balance over time. You can apply the same filters available in the list command to customize these plots. Below are some example graphs (y axis has been removed for privacy).
76+
77+
```Bash
78+
# Income per mont (in my case, the payroll)
79+
ngtonic month-plot -i
80+
```
81+
<img src="examples/payroll.png" width="600">
82+
83+
```Bash
84+
# Expenses on ocio category per month
85+
ngtonic month-plot -c ocio
86+
```
87+
<img src="examples/ocio.png" width="600">
88+
89+
```Bash
90+
# The month-plot without any options is a good way to know your saving capacity
91+
ngtonic month-plot
92+
```
93+
<img src="examples/month-plot.png" width="600">
94+
95+
```Bash
96+
# And the balance plot will give you a more detailed way to check your cash flow
97+
ngtonic balance-plot
98+
```
99+
<img src="examples/full_balance.png" width="600">
100+
101+
102+
## ⚙️ Configuration
103+
104+
### Excluding Movements
105+
106+
Sometimes you may want to exclude certain transactions from your analysis, such as:
107+
108+
- Transfers between your own accounts or to other banks
109+
- Large one-time transactions that skew your graphs
110+
- Any movements you don't want to include in your financial overview
111+
112+
You can exclude these movements using the configuration file located at `.ngtonic/config.yaml`. This file contains a list of filters; any movement matching these filters will be excluded from all commands.
113+
114+
Example configuration:
115+
116+
```yaml
117+
excluded_movements:
118+
- category: "Inversión"
119+
- subcategory: "Ingresos de otras entidades"
120+
- description: "Traspaso emitido Cuenta Nómina"
121+
- description: "steam"
122+
value: -675 # Excludes only this specific Steam transaction
123+
```
124+
125+
## 🛠️ Development
126+
127+
```bash
128+
pdm install
129+
$(pdm venv activate)
130+
pre-commit install
131+
```
132+
133+
This command will create a virtual environment, install all dependencies (including Ngtonic itself), and set up helpful commit hooks. Any changes made to the code will take effect immediately without requiring reinstallation.
134+
135+
You can also run manually the linter with `pdm lint` or the formatter with `pdm format`.
136+
137+
## 📦 Releases
138+
139+
The python packages are uploaded from the CI when creating a release, but you can create an whl locally with `pdm build`.

examples/full_balance.png

129 KB
Loading

examples/month-plot.png

113 KB
Loading

0 commit comments

Comments
 (0)