-
Notifications
You must be signed in to change notification settings - Fork 141
Open
Labels
Description
Problem description
I found a buggy behavior when the autoapi is configured like this in conf.py:
autodoc_typehints = "description"
autoapi_type = "python"
autoapi_file_pattern = "*.py"
autoapi_python_class_content = "both"With the following method signature:
def method_google_docs(self, foo: int, bar: int = 0) -> int:
"""This method is documented with google style docstrings.
.. spec:: gdocstr example
:links: R_PYIMPORT_2
Provides an example for google docstrings
Parameters:
foo (int): The first argument.
bar (int): The second argument.
Returns:
int: The sum of foo and bar.
"""
return foo + barThe type hints will be displayed like this:
edit: I cannot upload images for some reason (github says "something went really wrong and we can't process that file"). But it looks like this:
Parameters:
foo (int): The first argument. bar (int): The second argument.
Returns:
int: The sum of foo and bar.
Parameters: * foo (int) -
* bar (int) -
Return type: int
Expected behavior
With the following method signature using sphinx docstrings:
def method_sphinx_docs(self, foo: int, bar: int = 0) -> int:
"""This method is documented with sphinx style docstrings.
:param foo: The first argument.
:param bar: The second argument.
:returns: The sum of foo and bar.
"""
return foo + barthe type hints are rendered correctly:
Parameters: * foo (int) - The first argument.
* bar (int) - The second argument.
Returns: The sum of foo and bar.
Return type: int
Example
If you want to analyze this issue on your side, I have created an example project: