Search code examples
pythonmypy

Generate python type stub for native moduel with docstring


I am using the python bindings for lcm (-DPYTHON_EXECUTABLE=python3) and I would like documentation to work in vscode/pylance. The module does have generated documentation that can be seen in pydoc3.

stubgen -p lcm will successfully create _lcm.pyi for _lcm.so but it does not include the doc strings.

https://github.com/simon-ritchie/stubdoc looks like it was made to supplement stubgen, but it does not support native modules.

Is there currently a way to make a .pyi with docstrings from a native (.so) library?


Solution

  • At some point --include-docstrings was added to stubgen.