Open-Source Wikis

/

Ruff

/

Ruff and ty

astral-sh/ruff

Ruff and ty

This repository hosts two related tools, both written in Rust by Astral:

  • Ruff — an extremely fast Python linter and code formatter, intended as a drop-in replacement for Flake8 (and dozens of plugins), Black, isort, pydocstyle, pyupgrade, and autoflake.
  • ty — a fast Python type checker and language server, sharing Ruff's parser, AST, and infrastructure crates.

Ruff was first published in August 2022 (crates/ruff_linter). The formatter landed in early 2023, the LSP server (ruff server) in March 2024, and the type checker (ty, formerly known as red_knot) was kicked off in April 2024 and has grown into a sibling project that reuses much of Ruff's infrastructure.

What this wiki covers

Section Purpose
Architecture High-level system map: parser → linter/formatter/type-checker pipelines
Getting started Build, run, test, and exercise both ruff and ty from a fresh clone
Glossary Project-specific vocabulary (rule selectors, mdtest, salsa, fixes, noqa)
By the numbers Code size, language mix, churn, contributor activity
Lore Eras of the project: prototype → linter → formatter → server → type checker
How to contribute Workflow, testing, debugging, conventions
Apps Deployable binaries (ruff, ty, ruff_server, ty_server, WASM playground)
Crates Workspace packages — Ruff core, ty core, and shared infrastructure
Features Cross-cutting capabilities: linting, formatting, type checking, LSP, autofixing
Reference Configuration schemas, rules registry, dependencies

Project layout in one minute

The workspace lives under crates/ with 49 crates, split by naming convention:

  • ruff_* — used by the Ruff linter and formatter (and reused by ty)
  • ty_* — used only by ty
  • ruff and ty — the two thin CLI binary crates that tie everything together
  • mdtest — a test harness based on Markdown fixtures, used heavily by ty

Shared crates such as ruff_python_parser, ruff_python_ast, ruff_python_semantic, ruff_python_formatter, ruff_diagnostics, and ruff_db are consumed by both products.

Where the source of truth lives

  • Code: this repository (https://github.com/astral-sh/ruff).
  • Public docs: https://docs.astral.sh/ruff/ (built from docs/ with mkdocs).
  • Schema files: ruff.schema.json and ty.schema.json at the repo root, generated by cargo dev generate-all.
  • Rule registry: crates/ruff_linter/src/codes.rs is the canonical source for rule code → rule mapping.
  • Releases: tracked in CHANGELOG.md and changelogs/.

For contributor onboarding, start at Getting started and then the contributing guide.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Ruff and ty – Ruff wiki | Factory