Repository navigation
[doc-only] Fix shared Sphinx inventory links - #3624
Conversation
|
No actionable comments were generated in the recent review. Summary
Change: Bug fix Merge Risk:
|
|
/ok to test c01f1b6 |
|
|
|
||
| header = b"\n".join(parts[:4]) + b"\n" | ||
| entries = zlib.decompress(parts[4]).decode() | ||
| rebased = _ENTRY.sub(rebase_entry, entries) |
There was a problem hiding this comment.
Nit, not blocking: a line that does not fit _ENTRY is copied without the latest/ prefix and no error is raised. If the inventory format ever shifts, the 404s come back and the build stays green.
Counting the matches makes it fail loudly instead:
| rebased = _ENTRY.sub(rebase_entry, entries) | |
| rebased, matched = _ENTRY.subn(rebase_entry, entries) | |
| expected = sum(1 for line in entries.split("\n") if line.strip()) | |
| if matched != expected: | |
| raise ValueError( | |
| f"{source}: {expected - matched} of {expected} inventory entries did not match the expected format" | |
| ) |
Untested. A test that feeds in a junk line and expects ValueError would lock it in.
|
|
||
| import pytest | ||
|
|
||
| from cuda_python.docs.copy_rebased_sphinx_inventory_one_level_up import copy_rebased_inventory_one_level_up |
There was a problem hiding this comment.
Nit, not blocking: this import only resolves when the repo root is on sys.path, i.e. python -m pytest run from the top of the checkout. Bare pytest ci/tools/tests, or running from another directory, fails at collection with ModuleNotFoundError: cuda_python.
One way to fix it without touching the test: add this under [pytest] in the root pytest.ini.
pythonpath = .Pytest then always puts the repo root on the import path, so the import here works as written. Note it applies to every test that uses the root config. Untested against the full suite.
rparolin
left a comment
There was a problem hiding this comment.
Two nits, the pythonpath issue might be a little more than a nit but I'm not going to block the change over it. But it should probably be fixed.
— codex on behalf of Ralf —
Description
The shared
objects.invfiles contain paths relative tolatest/. Intersphinx consumers such as RMM and nvmath-python configure the component root as their base, so a target such asmodule/driver.html#cuda.bindings.driver.cuInitbecomes a URL that returns 404.Each docs builder calls
copy_rebased_sphinx_inventory_one_level_up.pywithbuild/html/latest/objects.inv. The helper writesbuild/html/objects.invand prefixes relative targets withlatest/so either inventory base resolves to the same HTML. All five builders use it, including CUDA 12 and CUDA 13 bindings. The shared bindings docs onmaincome from the CUDA 13 builder. Release staging excludes the shared files under #3521.The regular Pages deployment uses these eight shared inventory paths on
gh-pages.latest/inventorydocs/objects.invdocs/latest/objects.invdocs/cuda-bindings/objects.invdocs/cuda-bindings/latest/objects.invdocs/cuda-core/objects.invdocs/cuda-core/latest/objects.invdocs/cuda-pathfinder/objects.invdocs/cuda-pathfinder/latest/objects.invThe PR preview uses the same layout under
docs/pr-preview/pr-3624/. Preview treeValidation
pre-commit run --all-filesand the inventory regression test passed. The test covers rebased relative targets, Sphinx anchor shorthand, object names and display text with spaces, and an absolute target.latest-onlyand versioned mode using their real Makefiles and published inventories as fixtures. Verified that CUDA 12 component and aggregate release staging retain their versioned inventories byte for byte.latest/inventory pairs to identical URLs and anchors for all four doc sets. 6,588 of 6,589 distinct targets resolved against the enclosed HTML. The sole miss was the pre-existing metapackagelatest/py-modindex.htmltarget. The bindingscuInit, CoreDevice, and Pathfinderload_nvidia_dynamic_liblinks reached their expected anchors. Deployment artifactChecklist