← All open source projects

Ruff

astral-sh/ruff

Ruff is a fast Python linter and formatter written in Rust, replacing several common Python code-quality tools.

Forks 2,145
Author astral-sh
Language Rust
License MIT
Synced 2026-06-10

What it is

Ruff is a Python code checker and formatter written in Rust. It is known for speed and for combining work that used to be split across Flake8, isort, pyupgrade, pydocstyle, and a Black-style formatter.

The repository appeared in 2022 and became part of Astral’s newer Python tooling wave. Its appeal is not only performance, but consolidation: one tool can handle lint rules, automatic fixes, import sorting, and formatting in local development and CI.

What is inside the repository

Inside are the Rust analyzer core, rule implementations, formatter, cache, `pyproject.toml` support, editor integrations, and documentation. Ruff also supports monorepos and cascading configuration, which makes it practical for larger Python codebases.

Minimal configuration

This example shows a basic Ruff setup: choose line length, target Python version, and rule families, then run checks and formatting through one tool.

Language: Plain text
[tool.ruff]
line-length = 100
target-version = "py312"

[tool.ruff.lint]
select = ["E", "F", "I", "UP"]

Where it is useful

Ruff is useful in libraries, services, data pipelines, notebooks, and internal Python projects. Its impact is especially visible in large repositories and CI jobs where older linters can take noticeable time.

Strengths and limits

Ruff covers a lot, but rules still need team judgment. Migrating from Flake8, Black, or isort should be done deliberately: compare behavior, lock configuration, and run automatic fixes as a separate change.