Ruff

0.15.7 · active · verified Fri Mar 27

Extremely fast Python linter and formatter written in Rust by Astral. Current version is 0.15.7. Two separate subcommands: ruff check (linting, replaces Flake8/isort/pyupgrade) and ruff format (formatting, replaces Black). Not a Python library to import — CLI tool only. The format setting and RUFF_FORMAT env var were repurposed/removed; use output-format and RUFF_OUTPUT_FORMAT instead. 2026 style guide introduced in 0.15.0 changes lambda formatting.

Warnings

Install

Imports

Quickstart

ruff check for linting, ruff format for formatting. Configure in pyproject.toml [tool.ruff].

# Install
pip install ruff

# Lint all Python files in current directory
ruff check .

# Lint with auto-fix
ruff check . --fix

# Format all Python files
ruff format .

# Check formatting without modifying (for CI)
ruff format . --check

# Minimal pyproject.toml config
# [tool.ruff]
# line-length = 88
# target-version = "py311"
#
# [tool.ruff.lint]
# select = ["E", "F", "B", "I", "UP"]
# ignore = ["E501"]
#
# [tool.ruff.format]
# quote-style = "double"
# indent-style = "space"

# Pre-commit hook (pin the version!)
# - repo: https://github.com/astral-sh/ruff-pre-commit
#   rev: v0.15.7
#   hooks:
#     - id: ruff-check
#       args: [--fix]
#     - id: ruff-format

view raw JSON →