sphinx icon indicating copy to clipboard operation
sphinx copied to clipboard

Sphinx build stuck in reading sources... when `singledispatch` and `autodoc_mock_imports` are used

Open rozsasarpi opened this issue 3 years ago • 1 comments

Describe the bug

Sphinx build hangs forever (until it times out) if autodoc_mock_imports is used with code that uses singledispatch.

How to Reproduce

See this repository and its GitHub Actions to reproduce the issue: https://github.com/rozsasarpi/sphinx_singledispatch

  • stuck build (timed out) when singledispatch and autodoc_mock_imports are both used: https://github.com/rozsasarpi/sphinx_singledispatch/runs/6999430788?check_suite_focus=true#step:5:15
  • working build without autodoc_mock_imports: https://github.com/rozsasarpi/sphinx_singledispatch/runs/6999461954?check_suite_focus=true
  • working build without singledispatch: https://github.com/rozsasarpi/sphinx_singledispatch/runs/6999520591?check_suite_focus=true

Expected behavior

make html finishes the build.

Your project

https://github.com/rozsasarpi/sphinx_singledispatch

Screenshots

image

OS

Linux/Win

Python version

3.8, 3.9

Sphinx version

5.0.2/4.5.0

Sphinx extensions

sphinx.ext.autodoc, myst_parser

Extra tools

No response

Additional context

No response

rozsasarpi avatar Jun 22 '22 07:06 rozsasarpi

We are having the identical problem: https://github.com/scverse/rapids_singlecell/pull/180

We bring in a bunch of GPU deps via autodoc_mock_imports and we use singledispatch in a private function. The whole process hangs before it even starts to build.

ilan-gold avatar May 06 '24 09:05 ilan-gold