Plantilla de proyecto·Pro
CLI de Python con SQLite
Un registro de gastos para el terminal: añade y lista gastos, suma por categoría cada mes y exporta a CSV. Solo usa la biblioteca estándar (argparse, sqlite3), así que no hay nada que instalar con pip, y trae tests con unittest. Necesita Python en el entorno Linux.
Para instalarlo necesitas PocketCode Pro.
Si tienes PocketCode instalado en tu Android, esto abre la página en la app.
Vista previa
Ficheros
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 |Esta vista previa está recortada. El contenido completo llega al instalarlo.
Cambios en la 1.0.0
Primera versión.