13. Handy Commands
Small command-line recipes for virtualenvs, quality checks, and ad-hoc servers.
# Create and use a virtual environment
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt
# Freeze/update dependencies
pip freeze > requirements.txt
# Quality toolchain (install as needed)
pytest -q
ruff check .
ruff format .
mypy .
# Quick local web server (serve current dir)
python -m http.server 8000
# Inspect installed packages
python -m pip list