#1128405 python3-opencv: missing Python type stubs (.pyi files)

Package:
python3-opencv
Source:
python3-opencv
Description:
Python 3 bindings for the computer vision library
Submitter:
Michael Lloyd
Date:
2026-02-19 11:43:02 UTC
Severity:
normal
#1128405#5
Date:
2026-02-19 11:42:20 UTC
From:
To:
python3-opencv does not ship .pyi type stub files, which prevents
LSPs from providing function hints, autocompletion and type checking
for cv2.

Upstream generates stubs during the CMake build via gen2.py calling
modules/python/src2/typing_stubs_generator.py . The stub copy target
and install rule are defined in modules/python/python_loader.cmake .

There are some things that the Debian packaging does which prevents
the stubs from being included:

* d/rules:154 sets -DOPENCV_SKIP_PYTHON_LOADER=ON in the pybuild
   configure step, and python_loader.cmake is the only file that
   defines the copy_opencv_typing_stubs target and its
   install(DIRECTORY) rule. So, the file is never loaded.
* d/patches/setup-py-for-egg.patch strips the
   collect_module_typing_stub_files() function and all stub-related
   package data from setup.py

A fix could either adjust the pybuild configuration to allow
python_loader.cmake to run, or add a separate step to copy the
generated stubs from the build tree into the package.