Skip to content

[doc] Bump the torch intersphinx pin to 2.9 to match the runtime - #65647

Merged
dstrodtman merged 1 commit into
masterfrom
djs-260821-intersphinx-torch-pin
Aug 21, 2026
Merged

dstrodtman merged 1 commit into
masterfrom
djs-260821-intersphinx-torch-pin

Conversation

@dstrodtman

Copy link
Copy Markdown
Contributor

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. #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 #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 #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. [doc] Drop the eight intersphinx targets that resolve nothing #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 [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 touch conf.py or the snapshots.

Checks

  • I've signed off every commit (-s).
  • I've included any doc changes needed for the change.
  • Testing strategy
    • Unit tests
    • Release tests
    • 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.

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]>
@dstrodtman
dstrodtman requested review from a team as code owners August 21, 2026 15:59

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 dstrodtman added go add ONLY when ready to merge, run all tests docs-go RtD-only checks for docs-only changes. Doesn't run full library doc-test suites. labels Aug 21, 2026
@dstrodtman
dstrodtman enabled auto-merge (squash) August 21, 2026 16:03
@dstrodtman
dstrodtman merged commit 3462fcb into master Aug 21, 2026
6 of 7 checks passed
@dstrodtman
dstrodtman deleted the djs-260821-intersphinx-torch-pin branch August 21, 2026 16:31
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-go RtD-only checks for docs-only changes. Doesn't run full library doc-test suites. go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants