Skip to content

Ruff

A very fast Python linter and code formatter, written in Rust.

Stars
50.4k
Forks
2.6k
Licence
MIT
Language
Rust
Last update
4 days ago
Type
CLI

What it is

Ruff checks Python code for style problems and likely bugs, and can automatically format code and fix some errors. It is a single command-line tool that aims to replace several older Python tools such as Flake8, Black, and isort. The README says it is much faster than those tools, and it is installed through pip, uv, or pipx.

  • Check all Python files in a project with `ruff check`
  • Format a project's code consistently with `ruff format`
  • Automatically remove unused imports using the fix support
  • Run Ruff as a pre-commit hook to catch problems before each commit
  • Use Ruff inside VS Code or other supported editors

Great for

  • Python developers who want one tool for linting and formatting
  • Teams with large Python codebases where slow checks are a problem
  • People running checks in a pre-commit hook or editor on save
  • Projects that already use pyproject.toml for configuration

Not ideal for

  • Non-Python projects, since it only handles Python code
  • People who need to keep using specific Flake8 plugins not covered by its rules (the README says it re-implements many popular ones, not all)
  • Users who want a tool with no configuration decisions to learn; it has over 900 rules to choose from
Step-by-step guide: how to use RuffInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Python (version needed is not stated in the README excerpt)

    Install with uv (recommended)

    uv tool install ruff@latest

    Install with pip

    pip install ruff

    Install with pipx

    pipx install ruff
  2. 2

    Run it

    • Install Ruff with one of the commands above
    • Change into your Python project folder
    • Run `ruff check` to lint all files in the folder
    • Run `ruff format` to format the files
  3. 3

    Get the most out of it

    • Use `ruff check --fix` to apply automatic fixes where available
    • Add the pre-commit hook from the ruff-pre-commit repository to run checks on every commit
    • Install the VS Code extension or another editor integration listed in the docs
    • Configure rules and settings in pyproject.toml, which the README says is supported
    • Use the GitHub Action mentioned at the end of the README for CI checks

Downloads

Strengths

  • The README reports speeds of 10-100x over Flake8 and Black, with testimonials citing larger gains
  • Combines linting, formatting, and import sorting behind one interface
  • Supports hierarchical configuration for monorepos

Trade-offs

  • Speed figures and testimonials come from the project and its users, not independent benchmarks
  • Rule coverage is broad but may not match every plugin or edge case of the tools it replaces
  • Version is under 1.0 (0.17.3), so behavior may change between releases

How it compares

ProjectStarsTypeLevelUpdatedBest for
ruff (this)50.4kCLIbeginner4 days agoPython developers who want one tool for linting and formatting
black42.1kDev toolbeginner4 days agoPython developers who want formatting handled automatically
standard29.4kDev toolbeginner1.3 years agoJavaScript projects where the team wants consistent style without debating rules
static-analysis14.9kCurated listbeginner4 days agoDevelopers looking for a linter or analyzer for a specific language
eslint27.6kDev toolintermediate4 days agoJavaScript developers who want automatic checks on their code
ast-grep16.4kCLIbeginner4 days agoDevelopers who want grep-like searching that understands code structure

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.