I build a compiled Python extension (.pyd file) with C++ and pybind11. I would like to generate a single Python interface .pyi file for my .pyd file.
There are a few similar questions referring to the mypy stubgen module, however, this one produces a UnicodeError trying to run stubgen Dummy where Dummy is Dummy.pyd file:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x90 in position 2: invalid start byte
Another project, make-stub-files does not work with .pyd files at all, giving the ('not a python file' error.
Are there any tools that could let me generate .pyi files either from the source .cpp files or from compiled .pyd files?
The issue is registered in the mypy GitHub repository.
The issue was registered in the
mypyGitHub source repository and fixed in a pull request.The reason for the issue was that when
mypywas trying to figure out whether a given module is a Python extension it checked for the.sofile extension used on Linux, but did not check for the.pydfile extension used on Windows.