Skip to content

Fix the docs build by no longer mocking torch - #817

Merged
stefaanhessmann merged 1 commit into
masterfrom
v2_dev
Nov 6, 2026
Merged

stefaanhessmann merged 1 commit into
masterfrom
v2_dev

Conversation

@stefaanhessmann

Copy link
Copy Markdown
Collaborator

Summary

Read the Docs fails to build latest since the 2.3.0 merge (build 35646079): autosummary cannot import schnetpack.atomistic, schnetpack.transform and the other modules. docs/conf.py mocks torch, and annotations such as Callable | nn.Module from the ruff cleanup (#799) raise a TypeError on the mocked nn.Module.

torch, pytorch_lightning and torchmetrics are already installed from docs/sphinx-requirements.txt, so this sets autodoc_mock_imports = []. It also sets the docs version to 2.3.0 instead of 2.0-dev0. Docs config only; the package is unchanged.

Evidence

Local build of master + this commit, set up like RTD (Python 3.12, docs/sphinx-requirements.txt, Sphinx 7.1.2, sphinx -T -b html):

  • Before: exit 2, ImportExceptionGroup: no module named atomistic.Atomwise, the same failure as on RTD.
  • After: build succeeded, 146 API pages, 71 warnings. That's the same warning count as the last green RTD build (35523817, 30 Oct).

Merge Danger

Door: two-way

Revert the commit to undo it.

Blast Radius: minimal

Only docs/conf.py changes. RTD rebuilds latest from master after the merge.

🤖 Generated with Claude Code

Read the Docs failed to build the docs for 2.3.0: autosummary could not
import schnetpack.atomistic, schnetpack.transform and the other modules.
Sphinx replaced torch with a mock, and annotations such as
`Callable | nn.Module` or `nn.Module | None`, introduced by the ruff
cleanup in #799, raise a TypeError on a mocked nn.Module. The previous
`Union[...]` annotations accepted it.

torch, pytorch_lightning and torchmetrics are already installed from
docs/sphinx-requirements.txt, so the docs now import the real packages.
Also set the docs version to 2.3.0 instead of 2.0-dev0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@stefaanhessmann
stefaanhessmann merged commit 6f20ba8 into master Nov 6, 2026
4 checks passed
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.

1 participant