Render Ruff rule docs in the terminal or open them in a browser
Project description
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ruff_explain-1.1.0.tar.gz.
File metadata
- Download URL: ruff_explain-1.1.0.tar.gz
- Upload date:
- Size: 41.4 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4ce10ee15c3f3de0debfbbbdd208c0976661569f44e0b4adc439aa6b1f03b1d
|
|
| MD5 |
9c9922a63f1591172b976db319bc772f
|
|
| BLAKE2b-256 |
7f01690218050604a147dd139578c86386c82c03db210406f5e86af4c7cd8523
|
File details
Details for the file ruff_explain-1.1.0-py3-none-any.whl.
File metadata
- Download URL: ruff_explain-1.1.0-py3-none-any.whl
- Upload date:
- Size: 49.7 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5aac240e2a31e7a415c72d1d71def2bb606ff176f7055515bd0ef0f617ea652a
|
|
| MD5 |
5ffa15ad66ac397f03aff7c5dc1af089
|
|
| BLAKE2b-256 |
db888762c77e72f160f5e17cc47933d61c8bfb06bd0dcb36331bed5c00be0d86
|