Tirsvad 281819d89f
TirSystem/git-workflows: Release / release (push) Skipped
TirSystem/git-workflows: Sync GitHub mirror metadata / sync-metadata (push) Successful in 24s
TirSystem/git-workflows: Publish wiki / publish-wiki (push) Successful in 51s
CI / Checks (push) Successful in 55s
TirSystem/git-workflows: Publish accepted milestones / publish (push) Successful in 53s
TirSystem/git-workflows: Validate / validate (push) Successful in 43s
TirSystem/git-workflows: OpenGrep / opengrep (push) Successful in 2m5s
Merge pull request 'MIL-005: Framework baseline on top of the existing plan' (#40) from mil-001-baseline into main
2026-11-15 11:36:47 +01:00
2026-11-15 18:26:44 +08:00
2026-10-04 18:12:54 +02:00

Coffee Machine

A console game from Udemy's 100 Days of Code: The Complete Python Pro Bootcamp (day 15). A virtual coffee machine serves espresso, latte and cappuccino. Pay with US coins (quarters, dimes, nickels and pennies). The machine checks its water, milk and coffee before it serves, refunds you if you pay too little and gives change if you pay too much.

What would you like? (espresso/latte/cappuccino): latte
Please insert coins.
How many quarters?: 10
How many dimes?: 0
How many nickels?: 0
How many pennies?: 0
Here is your latte. Enjoy!

📚 Table of Contents

🧭 Overview

  • Python 3.13 or newer, no runtime dependencies.
  • Type report to see the water, milk, coffee and money in the machine, and off to switch the machine off.
  • The function names follow the assignment: is_resource_sufficient, process_coins, is_transaction_successful, make_coffee.
  • Money is counted in whole cents inside the program, so change is never off by a rounding error.

Project layout

Path Content
src/coffee_machine/ The machine: main.py (the loop), constants.py (menu, coins, starting resources)
tests/ pytest tests
docs/ Planning documents (business case, plan, milestones) and SQA review records with the traceability matrix (docs/sqa/)
pyproject.toml Project configuration
Doxyfile Doxygen configuration
.gitea/workflows/ CI workflow

📋 Requirements

  • Python 3.13 or newer
  • Optional: Doxygen to build the source documentation

🛠️ Setup

Create a local virtual environment in .venv, activate it, and upgrade pip.

Windows (PowerShell):

python -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip

Windows (Git Bash), Linux and macOS:

python -m venv .venv
source .venv/Scripts/activate   # Linux/macOS: source .venv/bin/activate
python -m pip install --upgrade pip

The machine itself needs nothing more. To run the tests and the code checks, install the development tools:

python -m pip install -e ".[dev]"

▶️ Run

python -m coffee_machine

Type espresso, latte or cappuccino and press Enter, then enter the coins. Type report for the machine's resources, or off to quit.

Build the source documentation

The source uses Doxygen comments. The HTML output goes to docs/doxygen/html.

doxygen Doxyfile

🧪 Tests

python -m pytest

Check the code style and types:

python -m ruff check src tests
python -m ruff format --check src tests
python -m mypy src tests

Continuous integration

On every push and pull request, .gitea/workflows/ci.yml installs the project on Python 3.13 and runs the same checks as above: pytest, ruff check, ruff format --check and mypy. To run all of them locally:

python -m pytest && python -m ruff check src tests && python -m ruff format --check src tests && python -m mypy src tests

📄 License

GNU Affero General Public License v3.0. See LICENSE.

📎 Appendix: Project documents

The documents a newcomer needs, in reading order.

Document What it tells you
Business Case Why the project exists, its scope and success criteria
Stakeholder Analysis Who is involved; the stakeholder IDs used for owners and reviewers
Project Plan The gateways and their schedule
Milestones One document per gateway: Go/No-Go criteria and tasks
Artifact registry Where each artifact type lives, the next version, the PO language and domain
Traceability matrix How the artifacts link and when each was last reviewed

S
Description
Console coffee machine in Python: Day 15 of Udemy's 100 Days of Code bootcamp. Espresso, latte and cappuccino with coins, resources and change. No dependencies.
Readme AGPL-3.0
215 KiB
0 Stars 1 Watchers 0 Forks
Languages
Python 100%