Skip to content

chore: Adding in standard OSS NVIDIA Sphinx install#139

Open
aschilling-nv wants to merge 5 commits intoNVIDIA-AI-Blueprints:developfrom
aschilling-nv:afs/docs-support
Open

chore: Adding in standard OSS NVIDIA Sphinx install#139
aschilling-nv wants to merge 5 commits intoNVIDIA-AI-Blueprints:developfrom
aschilling-nv:afs/docs-support

Conversation

@aschilling-nv
Copy link

Summary

  • Migrates the Sphinx documentation configuration from a conditional fallback setup to the
    standard NVIDIA OSS Sphinx theme (nvidia_sphinx_theme) as the required theme
  • Expands docs/source/conf.py with additional extensions (sphinx.ext.viewcode,
    sphinx.ext.napoleon, sphinx_design), richer MyST parser options (math, task lists,
    definition lists, etc.), and Mermaid diagram configuration
  • Adds project.json and versions1.json to support the NVIDIA docs version switcher
    widget and public docs features
  • Adds pyproject.toml doc dependencies: nvidia-sphinx-theme, sphinx-autobuild,
    sphinx-design, and sphinxcontrib-mermaid
  • Extends linkcheck_ignore to skip GitHub and raw GitHub URLs during link checks

Signed-off-by: Andrew Schilling <aschilling@nvidia.com>
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 12, 2026

Greptile Summary

This PR migrates the Sphinx documentation setup to the standard NVIDIA OSS Sphinx theme (nvidia_sphinx_theme), removing the previous conditional-import fallback, and expands conf.py with richer MyST parser options, additional extensions (sphinx.ext.viewcode, sphinx.ext.napoleon, sphinx_design), Mermaid configuration, and a version-switcher driven by two new JSON files (project.json, versions1.json).

Key changes and findings:

  • copybutton_prompt_text = ">>> |$ " introduces a regex bug: the unescaped $ is an end-of-line anchor in regex, so shell-prompt lines ($ command) will not be stripped when users click the copy button. It should be r">>> |\$ ".
  • sphinx-rtd-theme>=2.0 remains in the docs dependency group despite the conditional fallback to it being removed — it is now unused.
  • attrs_inline was dropped from myst_enable_extensions (replaced by attrs_block); a grep across the docs tree confirms no existing docs use the inline-attribute syntax, so this is safe.
  • Previously raised issues (version_match string literal, duplicate templates_path, double-backslash in linkcheck_ignore regexes) are all correctly resolved in this revision.

Confidence Score: 3/5

  • Safe to merge after fixing the copybutton_prompt_text regex bug; the rest of the documentation changes are well-structured.
  • The PR is mostly straightforward documentation infrastructure work. One logic bug was found: the unescaped $ in copybutton_prompt_text will silently prevent shell-prompt stripping in copy buttons. Additionally, sphinx-rtd-theme is now an unused dependency. Neither issue is a blocker for building or serving docs, but the copybutton bug is a user-facing UX regression that should be fixed before merge.
  • docs/source/conf.py — the copybutton_prompt_text regex needs fixing; pyproject.tomlsphinx-rtd-theme should be removed.

Important Files Changed

Filename Overview
docs/source/conf.py Replaces conditional theme setup with nvidia_sphinx_theme as the sole theme; adds new extensions, richer MyST options, and version-switcher config — but introduces a regex bug in copybutton_prompt_text where $ is unescaped, breaking shell-prompt stripping.
pyproject.toml Adds nvidia-sphinx-theme, sphinx-autobuild, sphinx-design, and sphinxcontrib-mermaid to docs dependencies; sphinx-rtd-theme remains but is now unused since the conditional fallback was removed.
docs/source/project.json New file providing project metadata (name, version) for the NVIDIA docs platform — straightforward and correct.
docs/source/versions1.json New file listing the 1.2.1 release URL for the PyData/NVIDIA version-switcher widget — straightforward and correct.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["sphinx-build / sphinx-autobuild"] --> B["conf.py loads nvidia_sphinx_theme"]
    B --> C["Extensions loaded"]
    C --> C1["myst_parser"]
    C --> C2["sphinx.ext.viewcode"]
    C --> C3["sphinx.ext.napoleon"]
    C --> C4["sphinx_copybutton"]
    C --> C5["sphinx_design"]
    C --> C6["sphinxmermaid"]
    B --> D["MyST Parser options"]
    D --> D1["myst_enable_extensions<br>(dollarmath, amsmath, colon_fence, etc.)"]
    D --> D2["myst_fence_as_directive: mermaid"]
    B --> E["Theme options"]
    E --> E1["versions1.json → version switcher"]
    E --> E2["public_docs_features: True"]
    E --> E3["GitHub icon link"]
    E1 --> F["versions1.json\nversion: 1.2.1\nurl: docs.nvidia.com/ai-blueprint/1.2.1/"]
    B --> G["project.json\nname + version metadata"]
Loading

Last reviewed commit: 25ab73c


# -- Options for Mermaid -----------------------------------------------------
# Configure mermaid diagrams
mermaid_version = "latest" # Use the latest version of mermaid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pinning to "latest" mermaid version can cause unexpected breakage

mermaid_version = "latest" will always pull the newest Mermaid JS release at build time, which can silently introduce breaking syntax or rendering changes. Consider pinning to a specific version (e.g., "10.9.0") for reproducible documentation builds.

Suggested change
mermaid_version = "latest" # Use the latest version of mermaid
mermaid_version = "10.9.0" # Pin to a specific version for reproducibility

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave this up to the team, happy to pin it to a version if needed.

Signed-off-by: Andrew Schilling <aschilling@nvidia.com>
project = "NVIDIA AI-Q Blueprint"
copyright = "2025-2026, NVIDIA CORPORATION & AFFILIATES"
author = "NVIDIA"
copyright = "2025-%Y, NVIDIA Corporation"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

%Y not substituted by standard Sphinx

copyright = "2025-%Y, NVIDIA Corporation" uses a strftime format string (%Y) but standard Sphinx treats the copyright variable as a plain string — it does not call strftime on it. As a result, the rendered docs footer will literally display "2025-%Y, NVIDIA Corporation" rather than the intended current year.

To produce a dynamic year, format it explicitly in Python:

Suggested change
copyright = "2025-%Y, NVIDIA Corporation"
copyright = f"2025-{__import__('datetime').date.today().year}, NVIDIA Corporation"

Or use a static string matching the current release year:

Suggested change
copyright = "2025-%Y, NVIDIA Corporation"
copyright = "2025-2026, NVIDIA Corporation"

If nvidia_sphinx_theme is known to apply strftime to this field, please add a comment to document that dependency.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PyData theme renders this as intended.
aiq-date

"sphinx-autobuild>=2025.8.25",
"nvidia-sphinx-theme>=0.0.9.post1",
"sphinx-design>=0.7.0",
"sphinxcontrib-mermaid>=2.0.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sphinxcontrib-mermaid added but not registered as an extension

sphinxcontrib-mermaid is added to the docs dependencies, but docs/source/conf.py only registers sphinxmermaid (from sphinx-mermaid) in its extensions list. The sphinxcontrib.mermaid extension is never enabled, so this dependency has no effect. Having two mermaid-related packages installed simultaneously can also cause import conflicts.

If sphinxcontrib-mermaid is not needed, remove it. If it is intended to replace sphinx-mermaid, also update conf.py to register sphinxcontrib.mermaid instead of sphinxmermaid and remove sphinx-mermaid from dependencies.

@AjayThorve
Copy link
Collaborator

@aschilling-nv can you resolve lint issues in ci

Signed-off-by: Andrew Schilling <aschilling@nvidia.com>
aschilling-nv and others added 2 commits March 12, 2026 16:07
Signed-off-by: Andrew Schilling <aschilling@nvidia.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
source_suffix = [".md"]

# Copy button: strip common prompts from copied code
copybutton_prompt_text = ">>> |$ "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unescaped $ in copybutton regex won't match shell prompts

copybutton_prompt_text is treated as a regex pattern by sphinx-copybutton. In regex, $ is the end-of-line anchor — not a literal dollar sign. This means the pattern ">>> |$ " reads as: match >>> OR match "end-of-line followed by a space", which is impossible. As a result, shell prompt lines like $ some-command will not have their prompt stripped when users click the copy button.

The fix is to escape the dollar sign:

Suggested change
copybutton_prompt_text = ">>> |$ "
copybutton_prompt_text = r">>> |\$ "

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this project is using python in code blocks which doesn't require the r.

Keep in mind that the RegExp you are writing is evaluated in JavaScript and not in Python. In some edge cases this might lead to different results.

@aschilling-nv
Copy link
Author

@aschilling-nv can you resolve lint issues in ci

Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants