python / python/mypy

stubgen timeout on building docs on MacOS

Open
#16,183 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug topic-stubgen
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

stubgen timeout on building docs on MacOS

python -m mypy.stubgen -m mypackage -o ./stubs --include-docstrings

The stubgen tool always reports a timeout waiting for queued package properties. The timeout happens in the following code block:

-> moduleinspect.py

(155) def _get_from_queue(self) -> ModuleProperties | str | None:

It seems the subprocess never queues package properties.

To Reproduce

This error occurs on MacOS only.

python -m mypy.stubgen -m mypackage -o ./stubs --include-docstrings

Expected Behavior

It should work as smooth as on Windows and Linux, outputting the stub file without further issues.

Actual Behavior

Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/mypy/stubgen.py", line 2077, in <module> main() File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/mypy/stubgen.py", line 2073, in main generate_stubs(options) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/mypy/stubgen.py", line 1883, in generate_stubs py_modules, c_modules = collect_build_targets(options, mypy_opts) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/mypy/stubgen.py", line 1626, in collect_build_targets py_modules, c_modules = find_module_paths_using_imports( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/mypy/stubgen.py", line 1660, in find_module_paths_using_imports result = find_module_path_and_all_py3(inspect, mod, verbose) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/mypy/stubutil.py", line 83, in find_module_path_and_all_py3 mod = inspect.get_package_properties(module) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/mypy/moduleinspect.py", line 138, in get_package_properties res = self._get_from_queue() ^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/mypy/moduleinspect.py", line 164, in _get_from_queue raise RuntimeError("Timeout waiting for subprocess") RuntimeError: Timeout waiting for subprocess Error: Process completed with exit code 1.

Your Environment

  • Mypy version used: 1.7.0+dev
  • Mypy command-line flags: --include-docstrings -p myextmodule
  • Mypy configuration options from mypy.ini (and other config files):
  • Python version used: cp3.11
  • Platform: MacOS

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with mypy/moduleinspect.py, especially ModuleInspect._get_from_queue(), and reproduce the failure with the provided stubgen command on macOS. Compare the subprocess and queue behavior with Windows or Linux, then verify that the command completes and writes the expected stubs without the timeout.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.