Repository navigation
[doc] Bump the torch intersphinx pin to 2.9 to match the runtime - #65647
Merged
Merged
Conversation
The torch inventory was pinned to docs/2.7/ to match torch==2.7.0 in
python/requirements/ml/dl-{cpu,gpu}-requirements.txt, so cross-references
would only resolve to symbols that version ships. Those requirements now
pin torch==2.9.0, but the inventory pin stayed at 2.7, so two minor
versions of API surface stopped resolving.
Repoint the pin to docs/2.9/ and re-run the refresh script for that one
target. The base URL stays at docs/stable/, so emitted link URLs are
unchanged. torch resolves 96 cross-references, the fourth-highest of the
18 remaining targets.
Add a comment recording that the pin tracks the requirements file, since
that coupling is what went unmaintained.
Also fold in three documentation corrections in the same area:
- refresh.py said four targets set an explicit inventory URL. Dropping
scipy left three.
- The snapshot README recorded the old 2.7 pin.
- The README gained a "Before you drop a target" section covering the
reftype rules that make dropping a target safe or unsafe, including
why the python target can never be dropped.
Signed-off-by: Douglas Strodtman <[email protected]>
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the PyTorch intersphinx documentation pin from version 2.7 to 2.9 in doc/source/conf.py and doc/source/_intersphinx/README.md. It also updates the count of explicit inventory targets in doc/source/_intersphinx/refresh.py and adds a new section to the README with guidelines on how to safely drop intersphinx targets. There are no review comments, and I have no additional feedback to provide.
dstrodtman
enabled auto-merge (squash)
August 21, 2026 16:03
ronny-anyscale
approved these changes
Aug 21, 2026
nadongjun
pushed a commit
to nadongjun/ray
that referenced
this pull request
Oct 6, 2026
…-project#65647) ## Why are these changes needed? `torch` is one of the four intersphinx targets that set an explicit inventory URL instead of deriving it from `base_url`. ray-project#63038 pinned it to `docs/2.7/objects.inv` to match `torch==2.7.0` in `python/requirements/ml/dl-{cpu,gpu}-requirements.txt`, so cross-references would only resolve to symbols the version Ray ships actually has. That PR flagged the tradeoff explicitly: the URL has to bump alongside the requirements pin. Those requirements now pin `torch==2.9.0`. The inventory pin stayed at 2.7, so two minor versions of torch API surface stopped resolving. `torch` resolves 96 cross-references, the fourth-highest of the 18 targets remaining after ray-project#65644, so it's the pin worth keeping current. This repoints the pin to `docs/2.9/objects.inv` and re-runs `_intersphinx/refresh.py torch`. The snapshot is what actually resolves references since ray-project#64977, so bumping the URL alone would have changed only the unused fallback. `base_url` stays at `docs/stable/`, so the link URLs Sphinx emits don't change. A comment now records that the pin tracks the requirements file, since that coupling is the thing that went unmaintained. ### Verification that 2.9 doesn't drop a symbol Ray references Bumping a pinned inventory forward can break the `-W` build if upstream removed a symbol Ray cross-references, so I checked before pushing rather than leaving it to CI: - The 2.7 snapshot carried 11,851 objects, the 2.9 snapshot carries 13,139. Between them, 1,874 objects were added and 586 removed. - 140 of the 586 removals are in the `torch.*` Python namespace. The rest are documentation page anchors and C++ index entries. - Of those 140, all but one sit under `torch.ao.ns._numeric_suite`, a private module. Nothing under `python/ray` or `doc/source` references any of them. - The single remaining name, `torch.cuda.empty_cache`, appears three times in the tree (`python/ray/train/torch/config.py:164` and two example scripts), and all three are plain Python calls rather than Sphinx cross-references. 2.9 moved the documented object to `torch.cuda.memory.empty_cache`, which is irrelevant because nothing cross-references it. ## Related changes Three documentation corrections in the same directory, bundled here rather than opened as separate trivial PRs: - `_intersphinx/refresh.py` said four targets set an explicit inventory URL. ray-project#65644 dropped `scipy`, leaving three. - `_intersphinx/README.md` recorded the old `docs/2.7/` pin. - `_intersphinx/README.md` gained a "Before you drop a target" section. It records the reftype rules that decide whether dropping a target is safe: third-party annotations resolve as `py:class`, which `nitpick_ignore_regex` blanket-ignores, while `:external:` and explicit `py:obj`/`py:func`/`py:meth`/`py:mod` references aren't covered. It also records why `python` can never be dropped, since `parse_reftarget` assigns `obj` rather than `class` to `None` and to `typing.*` annotations. That reasoning came out of ray-project#65644 and is worth having where someone editing the target list will see it. ## Related issue number Follows ray-project#63038 (which established the pin), ray-project#64977 (which committed the snapshots), and ray-project#65644 (which reduced the target set to 18). Not a duplicate: no open PR or issue touches the torch intersphinx pin. Checked `gh pr list --repo ray-project/ray --state open --search "intersphinx"`, the same for `"torch pin objects.inv"`, and the open-issue search for `"intersphinx torch inventory"`. The one open PR in this area, ray-project#65646, changes CI step routing for the directory and doesn't touch `conf.py` or the snapshots. ## Checks - [x] I've signed off every commit (`-s`). - [x] I've included any doc changes needed for the change. - Testing strategy - [ ] Unit tests - [ ] Release tests - [x] The Read the Docs `-W` build on this PR is the gate that exercises `intersphinx_mapping`, and it's what would surface a removed symbol as a hard failure. Locally I ran `python doc/source/_intersphinx/refresh.py torch`, which fetched 162,579 bytes from the new URL and confirmed the script picks the pin up out of `conf.py`. I then ran the inventory diff described above against the previous snapshot. I did not run a full local Sphinx build. AI assistance was used for this change. Signed-off-by: Douglas Strodtman <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why are these changes needed?
torchis one of the four intersphinx targets that set an explicit inventory URL instead of deriving it frombase_url. #63038 pinned it todocs/2.7/objects.invto matchtorch==2.7.0inpython/requirements/ml/dl-{cpu,gpu}-requirements.txt, so cross-references would only resolve to symbols the version Ray ships actually has. That PR flagged the tradeoff explicitly: the URL has to bump alongside the requirements pin.Those requirements now pin
torch==2.9.0. The inventory pin stayed at 2.7, so two minor versions of torch API surface stopped resolving.torchresolves 96 cross-references, the fourth-highest of the 18 targets remaining after #65644, so it's the pin worth keeping current.This repoints the pin to
docs/2.9/objects.invand re-runs_intersphinx/refresh.py torch. The snapshot is what actually resolves references since #64977, so bumping the URL alone would have changed only the unused fallback.base_urlstays atdocs/stable/, so the link URLs Sphinx emits don't change.A comment now records that the pin tracks the requirements file, since that coupling is the thing that went unmaintained.
Verification that 2.9 doesn't drop a symbol Ray references
Bumping a pinned inventory forward can break the
-Wbuild if upstream removed a symbol Ray cross-references, so I checked before pushing rather than leaving it to CI:torch.*Python namespace. The rest are documentation page anchors and C++ index entries.torch.ao.ns._numeric_suite, a private module. Nothing underpython/rayordoc/sourcereferences any of them.torch.cuda.empty_cache, appears three times in the tree (python/ray/train/torch/config.py:164and two example scripts), and all three are plain Python calls rather than Sphinx cross-references. 2.9 moved the documented object totorch.cuda.memory.empty_cache, which is irrelevant because nothing cross-references it.Related changes
Three documentation corrections in the same directory, bundled here rather than opened as separate trivial PRs:
_intersphinx/refresh.pysaid four targets set an explicit inventory URL. [doc] Drop the eight intersphinx targets that resolve nothing #65644 droppedscipy, leaving three._intersphinx/README.mdrecorded the olddocs/2.7/pin._intersphinx/README.mdgained a "Before you drop a target" section. It records the reftype rules that decide whether dropping a target is safe: third-party annotations resolve aspy:class, whichnitpick_ignore_regexblanket-ignores, while:external:and explicitpy:obj/py:func/py:meth/py:modreferences aren't covered. It also records whypythoncan never be dropped, sinceparse_reftargetassignsobjrather thanclasstoNoneand totyping.*annotations. That reasoning came out of [doc] Drop the eight intersphinx targets that resolve nothing #65644 and is worth having where someone editing the target list will see it.Related issue number
Follows #63038 (which established the pin), #64977 (which committed the snapshots), and #65644 (which reduced the target set to 18).
Not a duplicate: no open PR or issue touches the torch intersphinx pin. Checked
gh pr list --repo ray-project/ray --state open --search "intersphinx", the same for"torch pin objects.inv", and the open-issue search for"intersphinx torch inventory". The one open PR in this area, #65646, changes CI step routing for the directory and doesn't touchconf.pyor the snapshots.Checks
-s).-Wbuild on this PR is the gate that exercisesintersphinx_mapping, and it's what would surface a removed symbol as a hard failure. Locally I ranpython doc/source/_intersphinx/refresh.py torch, which fetched 162,579 bytes from the new URL and confirmed the script picks the pin up out ofconf.py. I then ran the inventory diff described above against the previous snapshot. I did not run a full local Sphinx build.AI assistance was used for this change.