astral-sh/ruff
Crates
The workspace ships 49 crates under crates/. They split into four functional groups: the linter, the formatter, the type checker (ty), and shared infrastructure that everyone consumes.
Group: shared infrastructure (Ruff- and ty-side)
| Crate | Role |
|---|---|
ruff_python_parser |
Handwritten Python parser. |
ruff_python_ast |
Typed AST + visitor traits. Re-exported as ast::*. |
ruff_python_trivia |
Whitespace and comment scanning. |
ruff_python_index |
Pre-pass indexing of definitions / references. |
ruff_python_codegen |
Renders AST nodes back to source (used by autofixes). |
ruff_python_literal |
String/number literal parsing helpers. |
ruff_python_stdlib |
Lookup tables for Python standard library names. |
ruff_python_importer |
Insertion of from x import y statements when an autofix needs them. |
ruff_python_semantic |
Name resolution, scope graph, semantic model. |
ruff_text_size |
TextSize / TextRange byte-offset types. |
ruff_source_file |
SourceFile, line tables, byte ↔ line/column conversion. |
ruff_db |
Salsa database building blocks, System file abstraction, file IDs. |
ruff_diagnostics |
Diagnostic, Fix, severity, applicability. |
ruff_annotate_snippets |
Forked annotate-snippets-rs for diagnostic rendering. |
ruff_macros |
Proc-macros: derive(Options), rule metadata, codegen. |
ruff_options_metadata |
Reflection metadata for configuration options. |
ruff_cache |
Cache key + serialization helpers. |
ruff_notebook |
Jupyter notebook (.ipynb) reading/writing. |
ruff_markdown |
Markdown helpers (used by docs and mdtest). |
ruff_memory_usage |
Allocation accounting helpers. |
ruff_benchmark |
Criterion benchmark harness for the linter. |
mdtest |
Markdown-driven test harness used by ty. |
Group: Ruff (linter + formatter)
| Crate | Role |
|---|---|
ruff_linter |
All 900+ lint rules, checkers, registry, fixers. |
ruff_python_formatter |
Python code formatter. |
ruff_formatter |
The general-purpose formatter engine (a fork of rome_formatter). |
ruff_workspace |
Settings model, pyproject.toml / ruff.toml resolution. |
ruff_graph |
Import graph for ruff analyze graph. |
ruff_server |
Ruff LSP. |
ruff_wasm |
Browser bindings for the linter and formatter. |
ruff_dev |
Internal cargo dev CLI (codegen, debugging, snapshots). |
The ruff and ty binary crates compose these; see Apps.
Group: ty (type checker)
| Crate | Role |
|---|---|
ty_python_semantic |
Type system, inference, lints. The biggest ty crate. |
ty_python_core |
Core Python value/type helpers shared between subsystems. |
ty_module_resolver |
Resolves import statements across stubs, site-packages, vendored. |
ty_project |
Project (workspace) configuration and file discovery. |
ty_ide |
IDE-only queries (hover, completion, rename, references). |
ty_server |
ty LSP. |
ty_site_packages |
Discovery of installed-package metadata. |
ty_vendored |
Bundled typeshed stubs. |
ty_static |
Static asset bundle. |
ty_combine |
Type combination helpers. |
ty_completion_bench, ty_completion_eval |
Benchmarks and quality eval for completions. |
ty_test |
Test scaffolding for ty. |
ty_wasm |
Browser bindings for ty. |
Cross-cutting reading order
If you're new, read in this order:
ruff_python_parser— to understand the input shape.ruff_python_ast— to read the data the parser produces.ruff_python_semantic— to see how the linter and ty answer "what does this name refer to?"ruff_linter— for how rules are organized and dispatched.ruff_python_formatter— separate pipeline; useful as a contrast.ty_python_semantic— once you understand the shared layers.
Per-crate pages cover internal layout, key abstractions, integration points, and where to start modifying.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.