Project template·Pro
Python CLI with SQLite
An expense tracker for the terminal. It adds and lists expenses, totals them per category each month and exports CSV. It only uses the standard library (argparse, sqlite3), so there's nothing to pip install, and it has unittest tests. It needs Python in the Linux environment.
You need PocketCode Pro to install it.
If PocketCode is installed on your Android device, this opens the page in the app.
Preview
Files
README.md
expenses/__init__.py
expenses/__main__.py
expenses/cli.py
expenses/db.py
main.py
tests/__init__.py
tests/test_cli.pyREADME.md
# Expense tracker: Python CLI with SQLite A command-line tool to log what you spend and see totals per category for each month. It only uses Python's standard library (argparse, sqlite3, csv, decimal), so there is nothing to install with pip. Data goes to `expenses.db` in the project folder. Comes with tests. ## Run it in PocketCode You need the app's Linux environment with Python 3.10 or newer: install it in Settings › Compilers and runtimes, or with the Developer pack in Terminal › Linux. When you tap Run, the first line of the Run panel should say Python 3 (Linux). - **Run button**: open `main.py` and tap Run. With no arguments it prints this month's summary. - **Terminal**: open it in this project's folder (Open Terminal Here, in the editor menu) and pass commands: ```sh python3 main.py add 12.50 food "Lunch" python3 main.py add 30 transport --day 2026-12-01 python3 main.py list --month 2026-12 python3 main.py summary python3 main.py export december.csv --month 2026-12 python3 main.py delete 2 ``` `python3 -m expenses …` does the same as `python3 main.py …`. Add `-h` to any command for its help. ## Run the tests ```sh python3 -m unittest -v ``` The tests use a temporary database, so they never touch `expenses.db`. ## Where things are | Path | What it does | |---|---| | `main.py` | Entry point for the Run button | | `expenses/cli.py` | The commands and their options (argparse) | | `expenses/db.py` | The SQLite table, amounts in cents, totals |This preview is shortened. You get the full content when you install it.
Changes in 1.0.0
First version.