sphinx-doc / sphinx-doc/sphinx

Napoleon: Enable numpydoc “Returns” section without type

Open
#5,887 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

extensions:napoleon type:question
Dominant language
Python
Stars
8k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

I use sphinx-autodoc-typehints, but can’t seem to find a way to write a Returns section in numpydoc style that doesn’t result in a :rtype: being inserted.

name
    Desc

… results in “name” being treated as type

name: _
    Desc

… results in “” being treated as type. Leaving out the “” just results in “name” being treated as type again.

Desc

… results in an empty description and “Desc” being used as return type.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the three numpydoc Returns examples from the issue with sphinx-autodoc-typehints. Trace how Napoleon parses the Returns section and how :rtype: is generated; the issue is done when a return description can be documented without an inserted type.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.