ruff-explain
ruff-explain looks up Ruff rule documentation by rule ID and renders the docs page directly in your terminal with Rich.
What it does
- Renders Ruff rule docs in the terminal by default.
- Opens the canonical docs page in your browser with
-o/--open. - Prints structured JSON for automation with
--json. - Prints the installed version with
-v/--version. - Resolves rule IDs like
FAST001,F401, andARG001from a bundled rule map. - Keeps the output focused on the actual rule content instead of full site chrome.
Usage
uv run ruff-explain FAST001
uv run ruff-explain F401
uv run ruff-explain ARG001 -o
uv run ruff-explain FAST001 --json
uv run ruff-explain --version
--json prints a machine-readable payload to stdout:
{
"code": "FAST001",
"slug": "fast-api-redundant-response-model",
"summary": "FastAPI route with redundant `response_model` argument",
"title": "Fast API redundant response model",
"linter": "FastAPI",
"status": "preview",
"since": "v0.0.243",
"fix": "None",
"url": "https://docs.astral.sh/ruff/rules/fast-api-redundant-response-model/",
"overview": [
{"type": "paragraph", "text": "Overview paragraph."}
],
"sections": [
{
"title": "Why is this bad?",
"blocks": [
{"type": "paragraph", "text": "Because the response model is already inferred."}
]
}
]
}
On failure, --json exits non-zero and prints an error payload with an error.type of
unknown_rule, invalid_options, fetch_failed, or parse_failed.
Run from source
Run it from the repo with uv:
uv run ruff-explain FAST001
Notes
- Default behavior is terminal rendering.
--openskips rendering, opens the docs page immediately, and exits.--jsonprints structured rule data for scripts and other automation.--versionprints the installed package version and exits.- Unknown rule IDs return a non-zero exit code and show close matches when available.
Metadata
Release files for ruff-explain 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ruff_explain-1.1.0.tar.gz | 41.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ruff_explain-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 91.1 kB
Release files / ruff_explain-1.1.0.tar.gz
| Download URL | ruff_explain-1.1.0.tar.gz |
|---|---|
| Size | 41.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a4ce10ee15c3f3de0debfbbbdd208c0976661569f44e0b4adc439aa6b1f03b1d
|
|
BLAKE2b-256 checksum How to use checksums |
7f01690218050604a147dd139578c86386c82c03db210406f5e86af4c7cd8523
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / ruff_explain-1.1.0-py3-none-any.whl
| Download URL | ruff_explain-1.1.0-py3-none-any.whl |
|---|---|
| Size | 49.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5aac240e2a31e7a415c72d1d71def2bb606ff176f7055515bd0ef0f617ea652a
|
|
BLAKE2b-256 checksum How to use checksums |
db888762c77e72f160f5e17cc47933d61c8bfb06bd0dcb36331bed5c00be0d86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|