From 572074ae73f1a2ad744ec24a99f233db9cb644dd Mon Sep 17 00:00:00 2001 From: Jens Tirsvad Nielsen Date: Mon, 5 Oct 2026 00:30:18 +0800 Subject: [PATCH] Set up project skeleton and tooling for MIL-001 Add pyproject.toml (Python >=3.13, no runtime dependencies, pytest, ruff and mypy as dev extras), a Doxyfile that scans src/, the src/coffee_machine package with stub constants and main modules, and a pytest smoke test. Ignore Doxygen output in .gitignore. Closes #1 Closes #2 Closes #3 Closes #4 Refs #5 Task: MIL-001#1 Task: MIL-001#2 Task: MIL-001#3 Task: MIL-001#4 --- .gitignore | 3 +++ Doxyfile | 14 ++++++++++++++ pyproject.toml | 32 ++++++++++++++++++++++++++++++++ src/coffee_machine/__init__.py | 4 ++++ src/coffee_machine/__main__.py | 8 ++++++++ src/coffee_machine/constants.py | 6 ++++++ src/coffee_machine/main.py | 12 ++++++++++++ tests/test_smoke.py | 13 +++++++++++++ 8 files changed, 92 insertions(+) create mode 100644 Doxyfile create mode 100644 pyproject.toml create mode 100644 src/coffee_machine/__init__.py create mode 100644 src/coffee_machine/__main__.py create mode 100644 src/coffee_machine/constants.py create mode 100644 src/coffee_machine/main.py create mode 100644 tests/test_smoke.py diff --git a/.gitignore b/.gitignore index 36b13f1..ef1a1da 100644 --- a/.gitignore +++ b/.gitignore @@ -174,3 +174,6 @@ cython_debug/ # PyPI configuration file .pypirc + +# Doxygen output +docs/doxygen/ diff --git a/Doxyfile b/Doxyfile new file mode 100644 index 0000000..bff2e43 --- /dev/null +++ b/Doxyfile @@ -0,0 +1,14 @@ +# Doxygen configuration for the coffee machine. Run: doxygen Doxyfile +PROJECT_NAME = "Coffee Machine" +PROJECT_BRIEF = "Day 15 of Udemy's 100 Days of Code Python bootcamp" +OUTPUT_DIRECTORY = docs/doxygen +INPUT = src +FILE_PATTERNS = *.py +RECURSIVE = YES +OPTIMIZE_OUTPUT_JAVA = YES +EXTRACT_ALL = YES +JAVADOC_AUTOBRIEF = YES +GENERATE_HTML = YES +GENERATE_LATEX = NO +QUIET = YES +WARN_IF_UNDOCUMENTED = YES diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..925a26b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,32 @@ +[build-system] +requires = ["setuptools>=68"] +build-backend = "setuptools.build_meta" + +[project] +name = "coffee-machine" +version = "0.1.0" +description = "Console coffee machine: Day 15 of Udemy's 100 Days of Code Python bootcamp." +readme = "README.md" +requires-python = ">=3.13" +license = { file = "LICENSE" } +dependencies = [] + +[project.optional-dependencies] +dev = ["pytest>=8", "ruff", "mypy"] + +[project.scripts] +coffee-machine = "coffee_machine.main:main" + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.pytest.ini_options] +testpaths = ["tests"] +pythonpath = ["src"] + +[tool.ruff] +line-length = 88 + +[tool.mypy] +strict = true +mypy_path = "src" diff --git a/src/coffee_machine/__init__.py b/src/coffee_machine/__init__.py new file mode 100644 index 0000000..248063d --- /dev/null +++ b/src/coffee_machine/__init__.py @@ -0,0 +1,4 @@ +"""! +@file __init__.py +@brief Console coffee machine package. +""" diff --git a/src/coffee_machine/__main__.py b/src/coffee_machine/__main__.py new file mode 100644 index 0000000..7eeadb5 --- /dev/null +++ b/src/coffee_machine/__main__.py @@ -0,0 +1,8 @@ +"""! +@file __main__.py +@brief Allow `python -m coffee_machine`. +""" + +from coffee_machine.main import main + +main() diff --git a/src/coffee_machine/constants.py b/src/coffee_machine/constants.py new file mode 100644 index 0000000..a1da4c7 --- /dev/null +++ b/src/coffee_machine/constants.py @@ -0,0 +1,6 @@ +"""! +@file constants.py +@brief Constants for the coffee machine: menu, coins and starting resources. + +The values are added in MIL-002 ("Define constants"). +""" diff --git a/src/coffee_machine/main.py b/src/coffee_machine/main.py new file mode 100644 index 0000000..0a0a95d --- /dev/null +++ b/src/coffee_machine/main.py @@ -0,0 +1,12 @@ +"""! +@file main.py +@brief Entry point of the coffee machine. +""" + + +def main() -> None: + """! + @brief Run the coffee machine. + + The ordering loop is added in MIL-002 ("Implement main loop"). + """ diff --git a/tests/test_smoke.py b/tests/test_smoke.py new file mode 100644 index 0000000..a69f001 --- /dev/null +++ b/tests/test_smoke.py @@ -0,0 +1,13 @@ +"""! +@file test_smoke.py +@brief Smoke test that the package imports. +""" + +from coffee_machine import main as main_module + + +def test_main_is_callable() -> None: + """! + @brief The entry point runs without error. + """ + main_module.main() -- 2.54.0