Skip to content

stubgen timeout on building docs on MacOS #16183

Open
@lmbelo

Description

@lmbelo

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

Activity

lmbelo

lmbelo commented on Sep 26, 2023

@lmbelo
Author

It seems dylib is not supported.

def is_c_module(module: ModuleType) -> bool:
    if module.__dict__.get("__file__") is None:
        # Could be a namespace package. These must be handled through
        # introspection, since there is no source file.
        return True
    return os.path.splitext(module.__dict__["__file__"])[-1] in [".so", ".pyd", ".dll"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @lmbelo@AlexWaygood

        Issue actions

          stubgen timeout on building docs on MacOS · Issue #16183 · python/mypy