Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display property return typehints #7837

Closed
alxroyer opened this issue Jun 14, 2020 · 1 comment
Closed

Display property return typehints #7837

alxroyer opened this issue Jun 14, 2020 · 1 comment
Labels

Comments

@alxroyer
Copy link

Problem:
Unless I missed some configuration, property return typehints are not displayed in the output documentation with sphinx.ext.autodoc.

Suggestion:
As #7068 states, it is convenient to have properties being displayed the same as attributes.
It would be nice if the property return typehints were used as the type of the pseudo attributes.

Alternatives:
#7385 tells about the :type: directive that we could use in the property docstrings but:

  • this is redundant information with the return typehint,
  • it does not display the same as attributes.

Example:
In the screenshot below:

  • time is an instance attribute with typehint: # type: TimeStats,
  • actions is a property with return typehint: # type: (...) -> ExecTotalStats,
  • steps is a property with return typehint: # type: (...) -> ExecTotalStats, plus a :type: ExecTotalStats in its docstring.

2020-06-15 004735

It would be nice if we had property lines ending with ": ExecTotalStats".
Adding a :type: ExecTotalStats directive in the steps property docstring does not display the information the same way as the time attribute.

Configuration:

  • sphinx-build version 3.0.4
  • use of the sphinx.ext.autodoc extension (sphix.ext.napoleon seems to behave the same for that concern)
@alxroyer alxroyer added the type:enhancement enhance or introduce a new feature label Jun 14, 2020
@tk0miya
Copy link
Member

tk0miya commented Jul 20, 2020

Thank you for reporting. But same as #7383. So I'm closing this now as duplicated.

@tk0miya tk0miya closed this as completed Jul 20, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants