Ruff#

Ruff is a fast Python linter and code formatter. It enforces code style, catches common errors, and can automatically fix many issues. In this template, Ruff is run via pre-commit hooks and as a script:

hatch run lint
hatch run format

Configuration#

Ruff settings are in the [tool.ruff] section of pyproject.toml. Adjust rules, exclusions, and formatting options as needed.

Further Reading#

Alternatives#

Other popular Python linters and formatters include:

  • Flake8: Classic linter with plugin support.

  • pylint: Highly configurable linter with code analysis.

  • Black: Opinionated code formatter.

  • isort: Sorts Python imports automatically.