Ruff
Ruff is an extremely fast Python linter and formatter that consolidates Flake8, isort, Black, and dozens of other tools into a single binary. The handbook covers initial setup, recommended defaults, security rules, and the architecture that makes Ruff fast.
Get started with Ruff
Use Ruff in your workflow
More Ruff pages
Everything else tagged ruff, grouped by section. Pages featured above are not repeated here.
Tutorial
Build and Publish a Python Package with uv, Ruff, Pyrefly, pytest, and GitHub Actions
Build a Python library with uv, Ruff, Pyrefly, and pytest. Set up CI/CD with GitHub Actions. Publish to PyPI with trusted publishing.
Set up a complete Python project with uv, Ruff, Pyrefly, pytest, and pre-commit
Tutorial: build a Python project from scratch with uv, Ruff, Pyrefly, pytest, and pre-commit. Set up linting, type checking, and testing.
Set up a Python project optimized for Claude Code
Build a Python CLI agent that understands your codebase and fixes bugs autonomously using Claude Code.
How To
How to configure Cursor for Ruff
Configure the Ruff extension in Cursor for format-on-save, auto-fix, and import sorting with .vscode/settings.json setup.
How to configure Ruff for Django
Configure Ruff for Django: enable DJ rules to catch null=True on strings and missing __str__, silence auto-generated migrations with per-file ignores.
How to configure Ruff with Claude Code
Wire Ruff into Claude Code via CLAUDE.md rules, PostToolUse hooks, and pre-commit for real-time linting.
How to configure VS Code for a uv project
Configure VS Code for uv projects: auto-detect the .venv interpreter, enable Ruff formatting, and run pytest without extra setup.
How to Disable Ruff Rules for a Block of Code
Suppress Ruff rules across a code block with # ruff: disable and # ruff: enable comments. Cleaner than sprinkling # noqa across every line.
How to Disable the Ruff Formatter for a Block of Code
Skip Ruff formatting with # fmt: off and # fmt: on markers. Useful for hand-aligned code that auto-formatting breaks.
How to Format Python Code Blocks in Markdown Files
Format Python code blocks in Markdown with Ruff 0.16, keep README and docs samples consistent with your source, and stop unwanted rewrites.
How to install OpenAI's Astral plugins for Claude Code
Install OpenAI's Astral plugin for Claude Code. Get skills and a language server for uv, ruff, and ty with live type diagnostics.
How to migrate from Black to Ruff formatter
Replace Black with Ruff's formatter by translating pyproject.toml config, updating pre-commit hooks, and updating CI.
How to replace Black, isort, flake8, and pyupgrade with Ruff
Consolidate a Python project's lint stack onto Ruff by mapping rule prefixes, translating configuration, and updating pre-commit and CI hooks.
How to set up pre-commit hooks for a Python project
Install and configure pre-commit to automatically run linters, formatters, and checks on Git commits. Includes Ruff, mypy, and ty integration.
How to Suppress a Ruff Warning on One Line
Add # noqa: CODE to silence one Ruff rule on one line, and let RUF100 delete the comment once the violation is gone.
Explanation
Does Ruff support type checking?
No. Ruff is a linter and formatter; it does not perform type inference. Use ty, mypy, Pyright, or Pyrefly alongside Ruff for type checking.
Ruff Rule Codes Explained: What E, W, F, I, UP, S, B, and C90 Mean
Map Ruff prefixes like E, F, UP, and B to their source linters so you can decode errors and pick rule categories fast.
Ruff vs Black: Which Python Formatter Should You Use?
Compare ruff format and Black on output differences, speed, and maintenance to decide whether to switch Python formatters.
Ruff vs flake8: Which Python Linter Should You Use?
Compare Ruff and flake8 on rule coverage, configuration, and speed to decide whether to switch Python linters.
What is PEP 8?
PEP 8 is Python's official style guide covering naming conventions, whitespace, line length, and code formatting standards.
From the blog
Posts tagged ruff.
-
Ruff 0.16.0 Enables 7x More Rules by Default
Ruff's first default-ruleset expansion since v0.1.0 adds 354 rules. What changes when you upgrade, which new categories are on, and how to migrate cleanly.
-
Astral Shuts Down pyx, Open-Sources the Part That Mattered
On Talk Python #552, Charlie Marsh says Astral is winding down the commercial pyx registry and open-sourcing its GPU index and prebuilt-wheel infrastructure with free artifacts.
-
Ruff Already Rewrites Your Python to Be More Idiomatic
Ruff's FURB rules catch non-idiomatic patterns and auto-fix them into cleaner Python. 36 rules, all with auto-fix, and most projects haven't enabled them.
-
How Astral Uses Its Own Tools
A teardown of the ruff, ty, and uv repositories shows how Astral wires its own toolchain into the projects that produce it.
-
OpenAI to Acquire Astral
OpenAI announced plans to acquire Astral, the company behind uv, Ruff, and ty, folding its team into the Codex coding agent.
-
Charlie Marsh on uv, Coding Agents, and the Changing Open Source Contract
Charlie Marsh discusses uv's adoption strategy, coding agents reshaping Astral's development, and open source when code is cheap.
-
uv format: Code Formatting Comes to uv (experimentally!)
uv 0.8.13 adds experimental uv format command that runs Ruff's formatter, similar to how cargo fmt wraps rustfmt.
-
How Python's RFC Process Paved the Way for uv, Ruff, and Ty
How PEP standards enabled Astral to build ruff, uv, and ty that work seamlessly within the Python ecosystem without being part of core.
-
The Python Tooling Revolution
Lewis Gaul examines how Astral's ruff and uv are transforming Python development workflows with speed and intelligent design.
-
Simple, Modern Python
Joshua Levy's simple-modern-uv Copier template combines uv, ruff, mypy, and pytest for new Python projects.
-
Effective Python Developer Tooling in December 2024
An opinionated guide to Python developer tooling covering uv, ruff, pytest, mypy, and principles for productive Python development.