Skip to content

Fix stubgen failure when building on Python < 3.13

Anton Joubert requested to merge fix-stubgen into develop

Missing dependency for build-system was preventing the pybind11-stubgen step from running.

Click to see example

Job: https://gitlab.com/tango-controls/pytango/-/jobs/9200028003

Generating .pyi stub files.
Traceback (most recent call last):
  File "/builds/tango-controls/pytango/tango/device_proxy.py", line 22, in <module>
    from warnings import deprecated
ImportError: cannot import name 'deprecated' from 'warnings' (/opt/python/cp312-cp312/lib/python3.12/warnings.py). Did you mean: '_deprecated'?
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/tmp/build-env-yvnkt1je/bin/pybind11-stubgen", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/tmp/build-env-yvnkt1je/lib/python3.12/site-packages/pybind11_stubgen/__init__.py", line 319, in main
    run(
  File "/tmp/build-env-yvnkt1je/lib/python3.12/site-packages/pybind11_stubgen/__init__.py", line 358, in run
    QualifiedName.from_str(module_name), importlib.import_module(module_name)
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/python/cp312-cp312/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/builds/tango-controls/pytango/tango/__init__.py", line 472, in <module>
    from .attribute_proxy import AttributeProxy, get_attribute_proxy
  File "/builds/tango-controls/pytango/tango/attribute_proxy.py", line 36, in <module>
    from tango.device_proxy import __init_device_proxy_internals as init_device_proxy
  File "/builds/tango-controls/pytango/tango/device_proxy.py", line 24, in <module>
    from typing_extensions import deprecated
ModuleNotFoundError: No module named 'typing_extensions'
Segmentation fault
CMake Warning at /tmp/tmphl0qvyja/build/cmake_install.cmake:129 (message):
  Stub files generation failed.  They will not be installed.
Edited by Anton Joubert

Merge request reports

Loading