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.
uv tool install ruff@latestVerified import paths — ran on the pinned version, not inferred.
ruff check for linting, ruff format for formatting. Configure in pyproject.toml [tool.ruff].
Replace [tool.ruff] format = 'json' with [tool.ruff] output-format = 'json'. Replace RUFF_FORMAT=json with RUFF_OUTPUT_FORMAT=json.
Run ruff format . after upgrading to reformat under the 2026 style guide. Review diffs carefully, especially for lambdas as function arguments.
If you relied on build/ being excluded, add it explicitly: [tool.ruff] extend-exclude = ['build']
Use both subcommands. In pre-commit: - id: ruff-check then - id: ruff-format. ruff-check must come BEFORE ruff-format when using --fix.
Add to [tool.ruff.lint]: select = ['E', 'F', 'B', 'I', 'UP', 'RUF']. Or use select = ['ALL'] with specific ignores.
Replace ruff check --format json with ruff check --output-format json.
Execute `pip install ruff` directly in your shell environment or, if running from a Python script, use `subprocess.run(['pip', 'install', 'ruff'], check=True)`.
To execute shell commands like `pip install ruff` from within a Python script, use `import subprocess; subprocess.run(['pip', 'install', 'ruff'])` or `import os; os.system('pip install ruff')`.No dependency data recorded yet.