# Ruff

> Python linter and code formatter written in Rust, with 900+ rules, auto-fix, caching, and drop-in parity with Flake8, isort, and Black.

Stars: 50.4k · Language: Rust · License: MIT · Categories: Dev Tools

- Repository: https://github.com/astral-sh/ruff
- Website: https://docs.astral.sh/ruff
- Page: https://www.trmn.sh/tools/ruff

## Install

- uv: `uv tool install ruff@latest`
- pip: `pip install ruff`
- Standalone installer (macOS/Linux): `curl -LsSf https://astral.sh/ruff/install.sh | sh`

## Overview

Ruff is a Python linter and code formatter written in Rust. It is run through two subcommands: `ruff check` to lint files or directories, and `ruff format` to format them. Both accept paths, globs, or an `@arguments.txt` file of newline-delimited arguments. It is intended to replace Flake8 (and many of its plugins), Black, isort, pydocstyle, pyupgrade, autoflake, and similar tools with a single executable.

The linter ships with over 900 built-in rules, including native re-implementations of popular Flake8 plugins such as flake8-bugbear. It supports automatic fixes (for example, removing unused imports) via `--fix`, and has built-in caching so unchanged files are not re-analyzed. The README documents parity with Flake8, isort, and Black, and claims 10-100x speedups over those tools. The README also shows it linting the CPython codebase in a benchmark chart. An opt-in preview mode (`--preview` or `preview = true`) enables unstable rules and formatter style changes.

Configuration is read from `pyproject.toml`, `ruff.toml`, or `.ruff.toml`, with hierarchical and cascading config discovery for monorepos. Common options such as `--select` can be passed on the command line, and other settings can be overridden with `--config`. Default settings mirror Black (line length 88, double quotes, space indentation).

Ruff integrates with a pre-commit hook (`ruff-pre-commit`), a GitHub Action (`ruff-action`), and first-party editor support including a VS Code extension, with setup guides for other editors. It targets Python developers and teams who want linting and formatting in local development, editors, and CI. The README lists Apache Airflow, FastAPI, Pandas, and SciPy among its users.

### Installation

```bash
# via uv
uv tool install ruff@latest
```

```bash
# via pip
pip install ruff
```

```bash
# via Standalone installer (macOS/Linux)
curl -LsSf https://astral.sh/ruff/install.sh | sh
```

## Alternatives

- [just](https://www.trmn.sh/tools/just.md): Command runner that saves and runs project-specific commands from a justfile with make-inspired syntax (Rust, 36.5k stars)
- [zellij](https://www.trmn.sh/tools/zellij.md): Terminal multiplexer with floating panes, multiplayer collaboration, WebAssembly plugins, and built-in web client (Rust, 35.9k stars)
- [mise](https://www.trmn.sh/tools/mise.md): CLI tool for managing development environments with version-controlled tools, environment variables, and tasks (Rust, 35.7k stars)
- [hyperfine](https://www.trmn.sh/tools/hyperfine.md): Command-line benchmarking tool that runs statistical analysis across multiple timing runs of shell commands (Rust, 29.2k stars)
- [fnm](https://www.trmn.sh/tools/fnm.md): Fast Node.js version manager built in Rust with support for .node-version and .nvmrc files (Rust, 27.3k stars)

---

Canonical: https://www.trmn.sh/tools/ruff
