Skip to main content

ruff-explain

ruff-explain looks up Ruff rule documentation by rule ID and renders the docs page directly in your terminal with Rich.

Example render

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, and ARG001 from 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.
  • --open skips rendering, opens the docs page immediately, and exits.
  • --json prints structured rule data for scripts and other automation.
  • --version prints 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)

Source distribution for ruff-explain 1.1.0
File Size Uploaded
ruff_explain-1.1.0.tar.gz 41.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ruff-explain 1.1.0
File Interpreter ABI Platform
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}

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page