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: ...

6 min

Build a CLI Task Manager in Python

A command-line task manager that stores tasks in a local JSON file, supports adding, listing, completing, and deleting tasks, and uses only the Python standard library. 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: Set up the project structure Create the file uv init cli-task-manager cd cli-task-manager rm main.py README.md uv add --dev pytest Add the code: .gitignore __pycache__/ *.pyc .venv/ .pytest_cache/ *.egg-info/ dist/ build/ .DS_Store *.log tmp/ tasks.json Detailed breakdown uv init cli-task-manager scaffolds a new Python project with a pyproject.toml, a main.py sample file, and a .python-version file. rm main.py README.md removes the placeholder files since the project will use its own package structure. uv add --dev pytest installs pytest and records it under [dependency-groups] in pyproject.toml. __pycache__/ and *.pyc exclude Python bytecode files generated at runtime. .venv/ excludes the virtual environment that uv manages locally. tasks.json is excluded because it is runtime data, not source code. Each user generates their own task file. .DS_Store and tmp/ cover common OS and temporary artifacts. Step 2: Create the task storage module This module handles all persistence — reading and writing tasks to a JSON file on disk. ...

10 min