uv init my-service && cd my-service # creates pyproject.toml + .python-version
uv add fastapi pydantic httpx # runtime deps -> uv.lock
uv add --dev pytest ruff mypy # dev deps
uv run ruff check . && uv run ruff format --check .
uv run mypy src && uv run pytest
Mapping to what you know: pyproject.toml ≈ package.json/pubspec.yaml, uv.lock ≈ package-lock.json, uv sync ≈ npm ci, ruff ≈ ESLint + Prettier, mypy/pyright ≈ tsc. Virtual environments (.venv) isolate dependencies per project — like node_modules, but for the interpreter too.
Practice
1. Write the tests yourself
medium25 XP
slugify(title) is given. Write run_tests() that asserts at least: lowercase, spaces→hyphens, punctuation removed, repeated separators collapsed, and leading/trailing hyphens stripped. The grader runs your tests against the correct implementation and against 3 buggy mutants — your tests must pass on the real one and fail on every mutant.
Ctrl/⌘ + Enter runs the tests · Esc then Tab leaves the editor