Ruff

Ruff is a fast linter and code formatter for Python that unifies linting and formatting in one CLI.

Installation and Setup

Ruff is available on PyPI and as a standalone installer. In macOS, it can also be installed from Homebrew:

Windows PowerShell
PS> py -m pip install ruff

PS> powershell -c "irm https://astral.sh/ruff/install.ps1 | iex"
Shell
$ python -m pip install ruff

$ curl -LsSf https://astral.sh/ruff/install.sh | sh
Shell
$ brew install ruff

$ curl -LsSf https://astral.sh/ruff/install.sh | sh

$ python -m pip install ruff

Key Features

  • Lints and formats with a single tool and offers a Black compatible formatter available as ruff format.
  • Large built in ruleset that covers many flake8 plugins and common style checks.
  • Very fast execution with caching and parallel analysis.
  • Flexible configuration through pyproject.toml, ruff.toml, or .ruff.toml.
  • Smooth integration with pre commit and GitHub Actions.

Usage

Lint the current directory:

Shell
$ ruff check .

Apply automatic fixes during linting:

Shell
$ ruff check . --fix

Format code:

Shell
$ ruff format .

Tutorial

Ruff: A Modern Python Linter for Error-Free and Maintainable Code

Ruff is an extremely fast, modern linter with a simple interface, making it straightforward to use. It also aims to be a drop-in replacement for other linting and formatting tools, like Pylint, isort, and Black. It's no surprise it's quickly becoming one of the most popular Python linters.

intermediate devops tools

For additional information on related topics, take a look at the following resources:


By Leodanis Pozo Ramos • Updated Dec. 1, 2025