Generating stub (pyi) files from extension modules

I have a pybind11 extension module which has doc strings (including signatures) on members. PyCharm doesn't load these since it doesn't import extension modules (understandably, it would fail anyway due to shared library deps). I would like to generate a stub file automatically by extracting all the information from the module doc strings into a pyi file. The mypy stubgen tool gets most of the way there by extracting type information, but it doesn't actually include the doc strings in the output, so the resulting pyi file is type only and doesn't provide the docs used by pycharm.

Does anyone know of a tool that can do what I need? Either a modified stubgen or some other tool that converts extension modules to stub files with documentation intact.

Thanks!!

0
1 comment

There is a `pybind11_stubgen` module I believe that should be able to do this (not associated with `mypy`):
pybind11-stubgen · PyPI

0

Please sign in to leave a comment.