Return type does not get linked if napoleon_use_rtype = True

Open
#8,290 11 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start by reproducing the two configurations described for sphinx.ext.napoleon with a basic Returns statement, then compare the sphinx-build output when napoleon_use_rtype is False and True. Trace the Napoleon return-type handling and make the linked type consistent in both formats; verify the generated documentation for each configuration.

Written by the indexing model from the issue text.

Description

extensions:napoleon type:proposal

Describe the bug
If I set napoleon_use_rtype to False, I get a nice link to the type of the return value.

However, if I change napoleon_use_rtype to True, because I much prefer the single-line format, there is no more link. Unless I manually add backticks

I find this to be wholly inconsistent with the rest of Napoleon and therefore consider it to be a bug.

To Reproduce
Steps to reproduce the behavior:

Write a basic napoleon "Returns" statement:

        Returns:
            bool: success or failure.

Set napoleon_use_rtype to False, run sphinx-build. You get a linked but separate "Rtype" field.

Set napoleon_use_rtype to True, run sphinx-build. The bool type is inlined with your text, but is no longer linked.

Expected behavior
Whether I want to have an inline return type, or a separated field, should have no impact on whether or not the type gets linked.

Environment info

  • Sphinx version: 3.2.1
  • Sphinx extensions: sphinx.ext.napoleon
Dominant language
Python
Stars
8k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

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.

More from sphinx-doc/sphinx

All issues in sphinx-doc/sphinx

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.