Open
Description
Describe the bug
I have some nested NamedTuple definitions and sphinx_autodoc_typehints
cannot resolve them. Without sphinx_autodoc_typehints
, Sphinx has no issues generating a suitable documentation. In addition, PyCharm with its code linter is happy with it as well.
To Reproduce
The Python file:
class A:
MyTuple = NamedTuple(
"MyTuple ",
(
("b", Union[int, float]),
("c", Union[int, float])
)
)
def x(self) -> MyTuple:
return self.MyTuple(b=2, c=3)
A default Sphinx configuration will just do the work . These are the loaded extensions:
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.todo',
'sphinx.ext.napoleon',
'sphinx_autodoc_typehints'
]
Expected behavior
sphinx_autodoc_typehints
can resolve the typehint even though it is a nested NamedTuple and displays the NamedTuple as a member of the class A
.