Ruff

An extremely fast Python linter and code formatter, written in Rust, built as a drop-in replacement for Flake8, Black, isort, and dozens of plugins.

Tool
PyPI
v0.17.2
50,247 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
91 /100 Excellent
Development Activity 100
Maintenance 100
Community 68
Maturity 56
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
92 /100 Excellent
Architecture 92
Code Quality 96
Innovation 90
Learning Curve 90

Ruff is a Python linter and formatter written in Rust by Astral, built to be 10-100x faster than the tools it replaces. It re-implements the rule sets of Flake8 and its most popular plugins (bugbear, comprehensions, simplify, pydocstyle, pyupgrade, and more) natively, rather than wrapping the originals, and pairs that with a Black-compatible formatter and isort-compatible import sorting, all behind one CLI and one configuration file.

Beyond the CLI, Ruff ships an LSP server (ruff_server) that powers a first-party VS Code extension and other editor integrations, a WASM build behind the public play.ruff.rs playground, and official GitHub Action and pre-commit hook packaging for CI. It’s used in production by large open-source projects including Apache Airflow, Apache Superset, FastAPI, Hugging Face Transformers, pandas, and SciPy, and is developed by Astral, the company behind the uv Python package manager and the ty type checker.

What You Get

  • A single ruff binary that lints and formats Python, installable via pip, uvx, pipx, Homebrew, Conda, or a standalone install script.
  • Native re-implementations of 900+ rules spanning Flake8’s plugin ecosystem, Black-compatible formatting, and isort-style import sorting.
  • An LSP server and first-party VS Code extension for real-time in-editor diagnostics and format-on-save.
  • A GitHub Action, pre-commit hook, and Docker image for dropping Ruff into existing CI pipelines.
  • Hierarchical pyproject.toml/ruff.toml configuration discovery suited to monorepos.

Common Use Cases

  • Migrating an existing Flake8 + Black + isort setup to a single, much faster tool.
  • Enforcing consistent Python style and catching bugs in CI before merge.
  • Auto-fixing lint violations across large codebases in one pass with --fix.
  • Powering real-time lint and format feedback in editors via the LSP server.
  • Linting large, actively-changing codebases where tool speed materially affects iteration time.

Under The Hood

Architecture

Ruff is organized as a Rust workspace of dozens of crates under crates/, cleanly separating concerns: crates/ruff owns the CLI entry point (main.rs/lib.rs), argument parsing via clap (args.rs), configuration resolution (resolve.rs), the file-watch cache (cache.rs), and command dispatch (commands/); the linting logic lives in ruff_linter, which orchestrates per-file checkers (src/checkers) across rule families (src/rules, one directory per plugin family such as pyflakes, pycodestyle, pyupgrade); ruff_python_parser produces an AST consumed by ruff_python_ast and ruff_python_semantic (scope resolution / semantic model), which downstream rules query rather than re-implementing traversal themselves; ruff_python_formatter is a separate crate implementing the Black-compatible formatter over the same AST, sharing ruff_python_trivia/ruff_text_size for whitespace and range bookkeeping; ruff_server implements an LSP server reusing the linter/formatter crates directly, and ruff_workspace resolves pyproject.toml/ruff.toml settings into a merged Settings struct threaded through the pipeline. It’s a modular, layered design where the CLI, LSP server, and WASM playground all sit on the same core parser/semantic/linter/formatter crates.

Tech Stack

Ruff is written in Rust (per rust-toolchain.toml) and distributed to Python via maturin with bindings = "bin" — the wheel bundles the compiled binary rather than exposing PyO3 bindings, and the Python-facing python/ruff package is a thin binary locator. CLI parsing uses clap; glob/globset/globwalk/ignore power file discovery; notify implements filesystem watching for --watch; rayon parallelizes per-file linting; and jemalloc/mimalloc are swapped in as global allocators per platform. Python source is parsed by the project’s own ruff_python_parser rather than an external dependency, configuration is deserialized via serde/pyproject-toml, and libcst-style concrete-syntax-tree handling backs certain rewrites. Build and release tooling spans GitHub Actions workflows for cross-platform binary builds, Docker images, a wasm-pack WASM build for the browser playground, and PyPI/crates.io publishing; docs are built with mkdocs-material.

Code Quality

Testing is extensive: thousands of .snap snapshot files under crates/ruff_linter/src/rules and ruff_python_formatter/tests use the insta snapshot-testing crate (visible directly in crates/ruff_linter/src/test.rs’s insta::assert_snapshot! calls), paired with fixture Python files under resources/test/fixtures for a golden-file testing approach per lint rule, run via cargo nextest in CI. Error handling favors anyhow for CLI-level context-chained errors (main.rs’s report_error walks the error chain, special-casing broken-pipe IO errors) and typed Diagnostic/Severity types for lint-level errors, avoiding silent failure. The project dogfoods itself heavily — its own pyproject.toml runs an extensive custom [tool.ruff.lint] rule selection, and clippy.toml gates the Rust side. CI (.github/workflows/ci.yaml) runs formatting, linting, and test jobs gated behind a change-detection job to skip unaffected work, with additional typing and ecosystem-compatibility jobs layered on top of the base test suite.

API Design Ruff’s primary interface is its CLI (ruff check, ruff format), and its ergonomics show throughout: sane Black-compatible defaults out of the box, drop-in rule-name compatibility with Flake8/pyflakes/pycodestyle/isort so migration needs minimal reconfiguration, an all-in-one --fix autofix pathway, and hierarchical pyproject.toml discovery for monorepos. First-party editor integrations (VS Code extension, LSP server) and a GitHub Action reduce onboarding friction close to zero, while a published JSON schema (ruff.schema.json) enables editor autocompletion of configuration and an extensive rule-documentation site makes the 900+ rule surface discoverable without reading source. Replacing a dozen separately-configured tools with one coherent binary and configuration surface is itself the core developer-experience win.

Used by 46 apps in this directory

Python
62%
Apache 2.0

marimo

Data Engineering · Developer Tools

23,309

A reactive Python notebook that eliminates hidden state, runs reproducibly, and deploys as a web app or script — stored as pure Python, built for the AI era.

View details
90
Repo Health
91
Technical
65
Dependency
Built with
Python 62%
TypeScript 37%
Updated 5 days ago
Python
45%
GPL 3.0

MaxKB

AI Development · Knowledge Management

23,022

Build enterprise-grade AI agents with RAG, workflows & multi-modal support

View details
92
Repo Health
68
Technical
66
Dependency
Built with
Python 45%
Vue 37%
TypeScript 17%
Updated 6 days ago
Python
95%
MIT

MemPalace

AI Agents · AI Development · AI Memory

59,720

Local-first AI memory with verbatim storage, pluggable backends, and 96.6% retrieval recall on LongMemEval — no API key required.

View details
86
Repo Health
84
Technical
73
Dependency
Built with
Python 95%
Updated 6 days ago
Rust
97%
Apache 2.0

codex

AI Code Assistants · Developer Tools

130,715

OpenAI's open-source CLI coding agent that reads, edits, and runs code in your terminal using natural language prompts.

View details
89
Repo Health
80
Technical
75
Dependency
Built with
Rust 97%
Updated 6 days ago
Python
100%
Other

OpenBB

Analytics · Databases · Invoicing Finance

74,601

The AI Workspace for Finance: Connect Data, Run AI Agents, Build Analytics

View details
80
Repo Health
80
Technical
65
Dependency
Built with
Python 100%
Updated 1 weeks ago
TypeScript
92%
Other

OpenHands

AI Code Assistants · AI Development

91,695

The self-hosted developer control center for running AI coding agents — locally, in Docker, on VMs, or across cloud backends — with automation workflows for GitHub, Slack, and more.

View details
91
Repo Health
82
Technical
67
Dependency
Built with
TypeScript 92%
Updated 6 days ago
Python
74%
Apache 2.0

OpenKB

Knowledge Management

4,804

An open-source CLI that compiles raw documents into a structured, interlinked wiki-style knowledge base using LLMs — powered by vectorless, reasoning-based retrieval (PageIndex) instead of a vector database.

View details
48
Repo Health
72
Technical
77
Dependency
Built with
Python 74%
TypeScript 23%
Updated 3 months ago
TypeScript
44%
Apache 2.0

OpenMetadata

AI Development · Analytics · Data Engineering

15,562

Open-source metadata platform that unifies data catalog, lineage, quality, and governance into a single searchable graph, with an MCP server that gives AI agents governed access to that context.

View details
93
Repo Health
85
Technical
74
Dependency
Built with
TypeScript 44%
Java 37%
Python 17%
Updated 5 days ago
TypeScript
39%
AGPL 3.0

OpenObserve

Analytics · Devops · Monitoring

22,475

Open source observability platform for logs, metrics, traces, and real user monitoring — delivering 140x lower storage costs than Elasticsearch with a single binary you can run in under 2 minutes.

View details
90
Repo Health
9
Technical
68
Dependency
Built with
TypeScript 39%
Rust 30%
Vue 17%
Updated 5 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers