Modelo de projeto·Pro
CLI em Python com SQLite
Um controle de gastos para o terminal: adiciona e lista gastos, soma por categoria a cada mês e exporta para CSV. Só usa a biblioteca padrão (argparse, sqlite3), então não há nada para instalar com pip, e vem com testes em unittest. Precisa de Python no ambiente Linux.
Para instalar, você precisa do PocketCode Pro.
Se o PocketCode estiver instalado no seu Android, isto abre a página no app.
Prévia
Arquivos
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 prévia está encurtada. O conteúdo completo vem com a instalação.
Mudanças na 1.0.0
Primeira versão.