Linting

See here for an example configuration for some of these.

Code formatting

Name Short description 🚦
pre-commit Universal tool which performs a git hook on commit, allows you to run linters/formatters on any code. A tool to automatically run many of the tools listed below. Best
ruff-format A drop-in replacement for black (and also super fast). A nice “no-need to think” code formatter. If you have your own opinions about code style, you might not like this. Best
ruff A fast linter which incorporates a range of other linters. Notably isort can be included as a ruff rule (which we recommend). Best
toml-sort Sorts TOML files which are now part of PEP 8. Best
autopep8 Formatter which conforms to PEP 8. Good
black Opinionated formatter, defaults to 88 characters per line. Widely used, but we now recommend ruff-format in its place. Good
isort Sorts imports alphabetically, splits into first/third party, works on python & cython code. We recommend this, but it can be included in ruff, which is simpler. Good
pycodestyle Linter which checks for errors. Good
pyflakes Linter which checks for errors. Good
pylint Linter which checks for errors. Good
sourcery An AI code reviewer which simplifies code, has a free version but can pay for fancier features. Good
yapf Google formatter. Good
flake8 Linter which complains if code doesn’t follow a rule. Does not support modern pyproject.toml configuration. Avoid

Type checking

Name Short description 🚦
mypy Static type checker, won’t fail if no typing but will if typing is incorrect. Best