Build a Python Hello World Application
A minimal Python project that prints a greeting, accepts a name from the command line, includes a pytest test suite, and uses a Makefile to drive common tasks. This tutorial covers project setup with uv, argument parsing, testing with pytest, and automation for a simple but complete workflow. Prerequisites Python 3.10 or later uv 0.4 or later (curl -LsSf https://astral.sh/uv/install.sh | sh) A Unix-like terminal (macOS, Linux, or WSL on Windows) make installed (pre-installed on macOS and most Linux distributions) Step 1: Initialize the project with uv Create the file uv init hello-world cd hello-world Detailed breakdown uv init hello-world scaffolds a new Python project with a pyproject.toml, a main.py sample file, and a .python-version file. pyproject.toml serves as the project manifest, replacing the need for setup.py or requirements.txt. uv automatically creates a .venv virtual environment on first run. Step 2: Add pytest and set up the project Create the file Remove the generated sample file and add pytest as a dev dependency: ...