Skip to content

Commit d3ed4b9

Browse files
mmccartyclaudejameslamb
authored
Overhaul Sphinx documentation (#136)
## Summary - Overhaul Sphinx docs: add user guide, troubleshooting guide, plugin development guide, and full API reference (cli, doctor, debug, checks) - Switch Sphinx theme to pydata-sphinx-theme with RAPIDS branding, enable autodoc/napoleon/intersphinx/viewcode extensions - Remove stale doc pages (old `doctor.rst`, `cuda_driver.rst`) and restructure `index.rst` with proper toctree sections - Fix `doctor_check()` docstring from NumPy-style to Google-style (matches ruff pydocstyle convention) - Add SPDX license headers to docs and `dependencies.yaml` - Fix Sphinx cross-references for `run_debug` and `CheckResult` to use fully qualified module paths - Add `sphinx-llm` extension to generate `llms.txt` for LLM consumption - Add `sphinx-autobuild` with `make serve` target for live-reload docs development - Rewrite doctor.rst with user-facing content explaining cross-layer compatibility checks and library-bundled health checks - Move check execution flow details to plugin_development.rst - Fix incorrect `Raises` section in `doctor_check` docstring (replace with `Returns`) Note: This branch also includes the commits from #135 (unit tests and coverage). The docs-specific changes are in commits after `2137644`. ## Test plan - [ ] `make -C docs clean html` builds with 0 warnings - [ ] `pre-commit run --all-files` passes - [ ] `llms.txt` and `llms-full.txt` generated in build output - [ ] `make serve` starts live-reload server 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Mike McCarty <mmccarty@nvidia.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: James Lamb <jaylamb20@gmail.com>
1 parent 2137644 commit d3ed4b9

16 files changed

Lines changed: 716 additions & 107 deletions

CLAUDE.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,19 @@ coverage report
3939
coverage html && open htmlcov/index.html
4040
```
4141

42+
### Documentation
43+
44+
```bash
45+
# Build HTML documentation
46+
make -C docs html
47+
48+
# Live-reload documentation server
49+
make -C docs serve
50+
51+
# Remove build artifacts
52+
make -C clean
53+
```
54+
4255
### Linting and Pre-commit
4356

4457
```bash

dependencies.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ dependencies:
7575
- output_types: [pyproject, requirements]
7676
packages:
7777
- importlib-metadata >= 4.13.0; python_version < '3.12'
78+
docs:
79+
common:
80+
- output_types: [conda, requirements, pyproject]
81+
packages:
82+
- pydata-sphinx-theme>=0.16.1
83+
- sphinx>=8
84+
- sphinx-autobuild>=2025.8.25
85+
- sphinx-copybutton>=0.5.2
86+
- sphinx-llm>=0.3.0
7887
test_python:
7988
common:
8089
- output_types: [conda, requirements, pyproject]

docs/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ BUILDDIR = build
1212
help:
1313
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
1414

15-
.PHONY: help Makefile
15+
.PHONY: help serve Makefile
16+
17+
serve:
18+
sphinx-autobuild "$(SOURCEDIR)" "$(BUILDDIR)/html" $(SPHINXOPTS) $(O)
1619

1720
# Catch-all target: route all unknown targets to Sphinx using the new
1821
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).

docs/source/api/checks.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.. SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
.. SPDX-License-Identifier: Apache-2.0
3+
4+
Health Checks
5+
=============
6+
7+
Built-in health check modules registered via the ``rapids_doctor_check``
8+
entry point group in ``pyproject.toml``.
9+
10+
All check functions follow the contract described in :doc:`../plugin_development`.
11+
12+
GPU Checks
13+
----------
14+
15+
.. automodule:: rapids_cli.doctor.checks.gpu
16+
:members:
17+
:undoc-members:
18+
:show-inheritance:
19+
20+
CUDA Driver Checks
21+
------------------
22+
23+
.. automodule:: rapids_cli.doctor.checks.cuda_driver
24+
:members:
25+
:undoc-members:
26+
:show-inheritance:
27+
28+
Memory Checks
29+
-------------
30+
31+
.. automodule:: rapids_cli.doctor.checks.memory
32+
:members:
33+
:undoc-members:
34+
:show-inheritance:
35+
36+
NVLink Checks
37+
-------------
38+
39+
.. automodule:: rapids_cli.doctor.checks.nvlink
40+
:members:
41+
:undoc-members:
42+
:show-inheritance:

docs/source/api/cli.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.. SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
.. SPDX-License-Identifier: Apache-2.0
3+
4+
CLI Module
5+
==========
6+
7+
The ``rapids_cli.cli`` module defines the main CLI entry point and subcommands
8+
using `rich-click <https://github.com/ewels/rich-click>`_.
9+
10+
The CLI is registered as a console script called ``rapids`` via the
11+
``[project.scripts]`` entry in ``pyproject.toml``.
12+
13+
.. automodule:: rapids_cli.cli
14+
:members:
15+
:undoc-members:
16+
:show-inheritance:

docs/source/api/debug.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.. SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
.. SPDX-License-Identifier: Apache-2.0
3+
4+
Debug Module
5+
============
6+
7+
The ``rapids_cli.debug.debug`` module gathers system and environment information
8+
for troubleshooting RAPIDS installations.
9+
10+
:func:`~rapids_cli.debug.debug.run_debug` is the main entry point. It collects:
11+
12+
- Platform and OS details (from ``platform`` and ``/etc/os-release``)
13+
- NVIDIA driver and CUDA versions (via ``pynvml``)
14+
- CUDA runtime path (via ``cuda-pathfinder``)
15+
- System CUDA toolkit locations (globbing ``/usr/local/cuda*``)
16+
- Python version and hash info
17+
- All installed package versions
18+
- pip freeze and conda list output
19+
- Tool versions: pip, conda, uv, pixi, g++, cmake, nvcc
20+
21+
Output is either a Rich-formatted console table or JSON (``--json``).
22+
23+
Example:
24+
25+
``rapids debug --json > "<name-output-file>.json"``
26+
27+
API
28+
---
29+
30+
.. automodule:: rapids_cli.debug.debug
31+
:members:
32+
:undoc-members:
33+
:show-inheritance:

docs/source/api/doctor.rst

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
.. SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
.. SPDX-License-Identifier: Apache-2.0
3+
4+
Doctor Module
5+
=============
6+
7+
The ``rapids_cli.doctor.doctor`` module orchestrates health check discovery
8+
and execution.
9+
10+
The CUDA + Python software stack spans multiple layers — the GPU driver, the
11+
CUDA runtime, C/C++ libraries, and Python packages — each managed by different
12+
package managers (OS packages, CUDA toolkit installers, conda, pip). Because no
13+
single package manager owns the full stack, misconfigurations across layer
14+
boundaries are common and difficult to diagnose. ``rapids doctor`` validates
15+
compatibility across these layers, from the driver through CUDA to the Python
16+
libraries, and provides actionable feedback when an incompatibility is found.
17+
18+
Health checks are bundled with the RAPIDS libraries you install rather than
19+
hard-coded into ``rapids-cli`` itself. When you install a library such as
20+
cuDF or cuML, any checks it ships are automatically available to
21+
``rapids doctor`` — no extra configuration required.
22+
23+
You can run all discovered checks at once, or filter to a specific library
24+
by passing its name as an argument:
25+
26+
.. code-block:: bash
27+
28+
# Run every available check
29+
rapids doctor
30+
31+
# Run only checks related to cudf
32+
rapids doctor cudf
33+
34+
# See which checks would run without executing them
35+
rapids doctor --dry-run --verbose
36+
37+
Results are collected into :class:`~rapids_cli.doctor.doctor.CheckResult`
38+
objects that track pass/fail status, return values, errors, and warnings.
39+
For details on how checks are discovered and executed, or how to write your
40+
own, see :doc:`/plugin_development`.
41+
42+
API
43+
---
44+
45+
.. automodule:: rapids_cli.doctor.doctor
46+
:members:
47+
:undoc-members:
48+
:show-inheritance:

docs/source/conf.py

Lines changed: 58 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,82 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES.
2-
# All rights reserved.
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
32
# SPDX-License-Identifier: Apache-2.0
43
# Configuration file for the Sphinx documentation builder.
54
#
65
# For the full list of built-in configuration values, see the documentation:
76
# https://www.sphinx-doc.org/en/master/usage/configuration.html
87

9-
# -- Project information -----------------------------------------------------
10-
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
11-
12-
8+
import datetime
139
import os
1410
import sys
1511

16-
sys.path.insert(0, os.path.abspath("../rapids_cli"))
12+
sys.path.insert(0, os.path.abspath("../../"))
1713

14+
# -- Project information -----------------------------------------------------
1815

1916
project = "RAPIDS CLI"
20-
copyright = "2024, NVIDIA RAPIDS"
21-
author = "NVIDIA RAPIDS"
22-
release = "2024"
17+
html_title = "RAPIDS CLI"
18+
copyright = f"{datetime.date.today().year}, NVIDIA"
19+
author = "NVIDIA"
2320

2421
# -- General configuration ---------------------------------------------------
25-
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
2622

27-
extensions = []
23+
extensions = [
24+
"sphinx.ext.autodoc",
25+
"sphinx.ext.viewcode",
26+
"sphinx.ext.napoleon",
27+
"sphinx.ext.intersphinx",
28+
"sphinx_copybutton",
29+
"sphinx_llm.txt",
30+
]
2831

2932
templates_path = ["_templates"]
3033
exclude_patterns = []
3134

35+
copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
36+
copybutton_prompt_is_regexp = True
37+
38+
# Napoleon settings for Google-style docstrings
39+
napoleon_google_docstring = True
40+
napoleon_numpy_docstring = False
41+
42+
# Autodoc settings
43+
autodoc_default_options = {
44+
"members": True,
45+
"member-order": "bysource",
46+
"undoc-members": True,
47+
}
48+
49+
intersphinx_mapping = {
50+
"python": ("https://docs.python.org/3", None),
51+
}
3252

3353
# -- Options for HTML output -------------------------------------------------
34-
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
3554

36-
html_theme = "alabaster"
55+
html_theme = "pydata_sphinx_theme"
56+
57+
html_theme_options = {
58+
"header_links_before_dropdown": 7,
59+
"icon_links": [],
60+
"logo": {
61+
"link": "https://docs.rapids.ai/",
62+
},
63+
"github_url": "https://github.com/rapidsai/rapids-cli",
64+
"show_toc_level": 1,
65+
"navbar_align": "right",
66+
}
67+
68+
html_sidebars = {
69+
"**": ["sidebar-nav-bs", "sidebar-ethical-ads"],
70+
}
71+
3772
html_static_path = ["_static"]
3873

39-
extensions = [
40-
"sphinx.ext.autodoc",
41-
"sphinx.ext.autosummary",
42-
"sphinx.ext.viewcode",
43-
"sphinx.ext.napoleon", # For Google and NumPy style docstrings
44-
]
74+
75+
def setup(app):
76+
app.add_css_file("https://docs.rapids.ai/assets/css/custom.css")
77+
app.add_css_file(
78+
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css"
79+
)
80+
app.add_js_file(
81+
"https://docs.rapids.ai/assets/js/custom.js", loading_method="defer"
82+
)

docs/source/cuda_driver.rst

Lines changed: 0 additions & 35 deletions
This file was deleted.

docs/source/doctor.rst

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)