What do `ruff` and `mypy` do, and why run them in CI?
BeginnerConceptTesting, services & metrics
Answer
ruffis a very fast linter and formatter (replacing flake8, isort, pyupgrade, black-style formatting and many pylint rules). It catches unused imports, undefined names, mutable defaults, bare excepts, f-strings in logging and more.mypyis a static type checker that catches wrong types,Nonehandling bugs and misspelled attributes.
ruff check . && ruff format --check . && mypy src
They run in seconds and catch bugs that otherwise surface only at runtime, often in production. We also run them as pre-commit hooks.
More on Testing, services & metrics
Why should automation scripts have tests at all?BeginnerHow does pytest discover and run tests?BeginnerWhy does pytest use plain `assert` instead of `assertEqual`?BeginnerWhat are pytest fixtures, and what scopes exist?IntermediateWhat built-in fixtures do you use most?IntermediateHow does `@pytest.mark.parametrize` work?Beginner