Paul's Python CoursePPC

Project 20 of 20, for Caitlin

Personal Finance App

The Act II capstone: Caitlin's personal finance app, the fun version, with budgets and monthly reports, in four modules with their own tests, taken home as a real package.

About 8 hours, in 14 steps.

Sign up free to open itLog in

Act 2 needs a free account, so your work is saved as you go. Act 1 is open to everyone.

The brief

  • CaitlinEveryone in our class says they'll keep a budget and nobody does, because the apps are all so boring.
  • CaitlinI want one that does four things, money in, money out, a budget for each thing and a page a month.
  • CaitlinI'll try it first with a made-up month, and made-up me has a bit of an arcade habit.
  • PaulThis uses everything you've got, classes, a file, a command line and tests, and then it becomes a proper package.

A personal finance app for Caitlin, in four files, then a package:

  1. Every transaction has a day, an amount in whole pence (more than 0 in, less than 0 out), one of six categories, and a note. Income is the only money in.
  2. An amount of 0, a category that isn't one of the six, income that's money out and spending that's money in are all refused, with a reason.
  3. Each kind of spending can have a monthly budget of more than 0.
  4. The balance is everything in, less everything out.
  5. A month's report shows money in, money out, what went on each category against its budget, anything over, and what was left over.
  6. Everything is kept in money.json, so it's still there next time.
  7. It runs from the command line. A refusal says why, on stderr, and exits with code 1.
  8. It has tests, written by you, that would catch anyone breaking rules 2 to 5.
  9. At home, it's a package: python -m finance runs it, and pytest runs its tests.
What it prints
$ python cli.py add 2026-11-22 -3.20 food --note pasty
Spent £3.20 on food on 2026-11-22.
$ python cli.py add 2026-11-22 -1 sweets
There's no category called sweets.
$ python cli.py report 2026-11
November 2026
Money in: £1,450.00
Money out: £605.55
food: £81.60 of £120.00
fun: £53.95 of £40.00, over by £13.95
home: £450.00 of £450.00
travel: £20.00
Left over: £844.45

What's in it

  1. Mark it out first
  2. An error of your own
  3. Refused, and carrying on
  4. Days, not moments
  5. Which November
  6. The rules
  7. The money file
  8. The command line
  9. Your own tests
  10. Paul's review
  11. A folder of modules
  12. A proper package
  13. Ship it