python / python/mypy

stubgen timeout on building docs on MacOS

オープン
#16,183 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug topic-stubgen
主要言語
Python
スター
20.6k
フォーク
3.3k
PR マージ指標
PR 指標を取得中

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

mypy/moduleinspect.py、特に ModuleInspect._get_from_queue() から始め、macOS で提供された stubgen コマンドを使って失敗を再現します。subprocess と queue の動作を Windows または Linux と比較し、その後、コマンドがタイムアウトせずに完了し、期待されるスタブを書き込むことを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
cli, tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。