You're building a personal expense tracker CLI from scratch. This first slice is the data
foundation: the Expense record and the JSON store that saves and loads it. Before you write
code, blueprint the data shape, its constraints, and its edge cases — then build to that blueprint.
expense_tracker/models.py— theExpensedataclass and itsto_dict/from_dictserialization.expense_tracker/store.py—load_expenses/save_expensesover a JSON file, plusStoreError.
expense_tracker/models.py— define theExpensefields and implementto_dict/from_dict.expense_tracker/store.py— implementload_expenses/save_expenses. Watch the two edge cases called out in the TODO: a missing file returns[]; a corrupt / non-array file raisesStoreError. Handle both, distinctly.
pyproject.toml, the package skeleton, the .cursor/rules/python-cli.mdc rule file, and the
stage tests (tests/test_models.py, tests/test_store.py).
python3.12 -m venv .venv
.venv/bin/pip install -e ".[dev]"
.venv/bin/pytest tests/test_models.py tests/test_store.pyThe exercise is complete when both test files pass.