Skip to content

Use autodoc_typehints = "description" in conf.py #1665

@ydcjeff

Description

@ydcjeff

📚 Documentation

EDITED HERE: As a help wanted issue, please, see below comment #1665 (comment) on what remains to do here. Thanks

If there are many arguments in class/function/method, it's a little hard to read/scan all arguments (due to typehints).
Although there is a Parameters section, there might be missing some arguments (rarely though).
And we are duplicating type hints work in both signatures and docstring. Writing once can make less work on authors and less type hints mismatch can occur.

If we can remove type hints, it can be a little easier to read, and showing type hints only in Parameters section.

For example:
Before:
Screen Shot 2021-02-21 at 22 52 16
After:
Screen Shot 2021-02-21 at 22 51 40

Changing to this docs style needs a little work. It needs to

  • add
autoclass_content = "both"
autodoc_typehints = "description"  # new in sphinx 3.1

those lines in conf.py

  • removing type hints in docstring
  • leaving type hints only in signatures.

Let me know what you think.
cc: @vfdev-5 @sdesrozis @trsvchn

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions