Code Quality and CI

Keep an API tidy and prove it on every push: Ruff for formatting and linting, mypy for types, and a GitHub Actions workflow that runs them and your tests whenever anyone pushes. Then you'll set up CI for a campus lost-and-found API.

Updated

Clean Code

  1. Ruff and mypy on an API Project (Journeyman): Ruff finds likely mistakes in an API's code and lays out every file the same way, and mypy reads the type hints that FastAPI, Pydantic and the data module already have to find values that can't be what a function expects, both set up once for the whole project in pyproject.toml.

Continuous Integration

  1. Tests on Every Push with GitHub Actions (Journeyman): A GitHub Actions workflow in .github/workflows/ci.yml installs an API's requirements and runs Ruff, mypy and pytest on a fresh computer at every push and pull request, so a change that breaks a check gets a red cross on its commit, with a log that says which step failed and why.

Exercise: Lost and Found CI

  1. Exercise: Lost and Found CI (Journeyman): Set up Ruff and mypy for the Lost and Found Desk's FastAPI project in pyproject.toml, fix everything they report without changing what the API answers, and add a GitHub Actions workflow that runs Ruff, mypy and pytest on every push.