Repolode
astral-sh

astral-sh/ruff

An extremely fast Python linter and code formatter written in Rust, with over 900 lint rules and Black-compatible formatting.

Open-source alternative to:BlackFlake8

Stars
50,197
Forks
2,534
Open issues
2,220
Last commit
6 hours ago

What is it?

Ruff is a Python linter and code formatter written in Rust. It checks code for errors, style issues and outdated patterns, and can automatically fix many of them. It is designed to replace a combination of tools such as Flake8 with its plugins, Black, isort, pydocstyle and pyupgrade, running them through a single command and a shared configuration.

The linter ships with over 900 rules, many of which re-implement popular Flake8 plugins natively in Rust. Rules are enabled through pyproject.toml, ruff.toml or .ruff.toml, and a default rule set works without configuration. Built-in caching skips files that have not changed since the last run.

Ruff is installable via pip, uv, pipx, Homebrew and Conda, and includes editor integrations such as a VS Code extension, pre-commit hooks and a GitHub Action. Its configuration supports hierarchical discovery for monorepos.

Key features

  • 01Lints Python code with over 900 rules, many re-implementing Flake8 plugins
  • 02Formats code with a Black-compatible formatter
  • 03Automatically fixes many detected issues with --fix
  • 04Caches results to skip unchanged files
  • 05Configurable through pyproject.toml or ruff.toml, with hierarchical config discovery

Use cases

  • Replacing Flake8, Black and isort in a Python project with a single tool
  • Running lint and format checks as a pre-commit hook or in CI
  • Linting a large monorepo quickly with per-directory configuration
  • Getting editor feedback and auto-fixes in VS Code and other editors

Quick start

  1. 1

    Install Ruff with uv (recommended)

    uv tool install ruff@latest
  2. 2

    Install Ruff with pip

    pip install ruff
  3. 3

    Lint all files in the current directory

    ruff check
  4. 4

    Format all files in the current directory

    ruff format

Topics

FAQ

What is ruff?
An extremely fast Python linter and code formatter written in Rust, with over 900 lint rules and Black-compatible formatting. Ruff is a Python linter and code formatter written in Rust. It checks code for errors, style issues and outdated patterns, and can automatically fix many of them. It is designed to replace a combination of tools such as Flake8 with its plugins, Black, isort, pydocstyle and pyupgrade, running them through a single command and a shared configuration.
Is ruff free to use? What license does it have?
ruff is open source under the MIT license. Check the license terms before using it in commercial products.
Is ruff still maintained?
Actively maintained. The last commit to ruff was on Oct 21, 2026.
What can I use ruff for?
Replacing Flake8, Black and isort in a Python project with a single tool Running lint and format checks as a pre-commit hook or in CI Linting a large monorepo quickly with per-directory configuration Getting editor feedback and auto-fixes in VS Code and other editors
How do I install ruff?
Install Ruff with uv (recommended): uv tool install ruff@latest Install Ruff with pip: pip install ruff Lint all files in the current directory: ruff check Format all files in the current directory: ruff format
Where can I get ruff?
The source code and installation instructions are on GitHub: https://github.com/astral-sh/ruff

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects