Open
Description
After cloning the latest Mypy version available on GitHub, I see the "include-docstrings" option available, but running stubgen on an extension module that provides docstrings results in no docstrings at all.
To Reproduce
git clone https://github.com/python/mypy.git
python -m build
python -m pip install mypy-1.7.0+dev-py3-none-any.whl
stubgen --include-docstrings -p myextmodule[.pyd]
python -m mypy.stubgen --include-docstrings -p myextmodule[.pyd]
Expected Behavior
The .pyi file generated from stubgen should contain docstrings declared in the extension module, for classes and functions.
Actual Behavior
There is no docstrings at all, but they exist in the extension module. I have confirmed using help(myextmodule).
Your Environment
python 3.11 for Windows x64
myextmodule installed onto site-packages
- Mypy version used: 1.7.0+dev
- Mypy command-line flags: --include-docstrings -p myextmodule
- Mypy configuration options from
mypy.ini
(and other config files): - Python version used: cp3.11
I know this is a new feature, but it seems not to work out.
Activity
lmbelo commentedon Sep 15, 2023
My POV:
The "docstr" variable is never assigned.
Function "generate_c_type_stub" doesn't accomplish docstrings.
Function "generate_c_property_stub" doesn't accomplish docstrings.
I have it fixed/enhanced. I'm sending a pull request.
Fix/enchance stubgen docstrings for functions, properties and types
Fix/enhance stubgen docstrings for functions, properties and types
Fix/enhance stubgen docstrings for functions, properties and types
Social-Mean commentedon Nov 4, 2023
I am facing the same problem.
I use pybind11 to generate a
pyd
file, for example, namedmyextmodule.pyd
with doc-strings, andpyi file was generate successfully but no doc-strings in it.
Can anyone merge the PR?