Open
Description
Using Google-style docstrings with sphinx.ext.napoleon
and sphinx_autodoc_typehints
, I see both a Yields: row and a Return type: row in the Parameters table for generator methods.
Reproducer:
docs/index.rst:
.. currentmodule:: foo
.. autoclass:: Foo
:members:
docs/conf.py:
import os
import sys
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx_autodoc_typehints",
]
master_doc = "index"
sys.path.insert(0, os.path.abspath("../"))
foo/__init.py:
from typing import Optional, Generator
class Foo:
def func(
self,
arg1: Optional[int] = None,
arg2: Optional[int] = None,
) -> Generator[tuple, None, None]:
"""Summary of the func
A sligntly longer description
Args:
arg1: this is argument 1
arg2: this is argument 2
Yields:
tuple: strings of things
Raises:
IndexError:
If bad stuff happens
"""
pass
Output from sphinx-build -a -b html docs docs/build
:

Removing sphinx_autodoc_typehints
results in the following output, but obviously loses the type hints in the parameters table:
