opensourceprojects.dev

A broadsheet for software that doesn't ask for your email

Ruff: an extremely fast Python linter and formatter that replaces Flake8, Black,...
GitHub RepoImpressions10

Project Description

View on GitHub

Ruff: The Python Linter and Formatter That Replaces Flake8, Black, and isort

Intro

If you're a Python developer, you've probably felt the friction of juggling multiple tools just to keep your code clean. Flake8 for linting, Black for formatting, isort for import sorting—each one does one thing well, but together they create a messy pipeline. And if you're working on a project that's even moderately sized, you've definitely waited for those tools to run.

Enter Ruff. It's a linter and formatter written in Rust that's ridiculously fast. It's not just another Python linter—it's a complete replacement for Flake8, Black, and isort, all in one binary. And it does it in a fraction of the time.

What It Does

Ruff checks your Python code for errors, enforces style conventions, and formats it automatically. It's a drop-in replacement for Flake8 (with over 700 built-in rules including pycodestyle, Pyflakes, and McCabe), plus it handles import sorting (like isort) and code formatting (like Black).

The key difference? Speed. Ruff is written in Rust and runs at the speed of the language runtime itself. On a typical project, Ruff is 10 to 100 times faster than running Flake8, Black, and isort separately. It even includes parallel processing out of the box.

Why It's Cool

It's genuinely fast. Not "fast for a linter" fast. Actually fast. If you've ever run Flake8 on a large monorepo and walked away, you'll appreciate this.

It replaces three tools with one. No more configuring Flake8, Black, and isort separately. No more fighting about import order. Ruff handles linting, formatting, and import sorting in a single command. And because it's all in one tool, there's no conflict between formatters and linters.

It's configurable. Ruff supports over 700 rules out of the box, and you can enable or disable them per line, per file, or globally. It also works with existing Flake8 plugins (like flake8-bugbear), though many of those rules are already built in.

It's a formatter that respects your code. The formatter is not a strict clone of Black—it's a separate implementation that produces similar output but with subtle differences (like preserving empty lines around decorators). If you're used to Black's style, you'll feel right at home.

It works with pre-commit. Add a single entry to your .pre-commit-config.yaml and you're done.

How to Try It

The quickest way to see Ruff in action is with pip:

pip install ruff
ruff check your_file.py

To format your code:

ruff format your_file.py

To sort imports:

ruff check your_file.py --fix --select I

For a full project:

ruff check . --fix
rufff format .

If you want to see it in your editor, there's a VS Code extension (charliermarsh.ruff) with real-time linting and formatting.

For a more complete example, check out the official Ruff repository or the documentation.

Final Thoughts

Ruff isn't just a faster linter—it's a better developer experience. It eliminates the mental overhead of managing multiple tools and the frustration of waiting for things to run. If you're starting a new Python project, I'd recommend using Ruff from day one. If you're on an existing project, the migration path is straightforward: just replace your Flake8, Black, and isort configurations with a single ruff.toml or pyproject.toml section.

It's not perfect—no tool is. The formatter is still relatively new, and you might miss some niche Flake8 plugins. But for the vast majority of Python developers, Ruff is a clear upgrade. You'll wonder why you didn't switch sooner.


Follow us @githubprojects for more developer tools and open source highlights.

Back to Projects
Project ID: 5953402d-317d-4b13-a5aa-0cb00494ebfbLast updated: July 19, 2026 at 06:32 AM