sphinx-doc / sphinx-doc/sphinx

`autodoc-process-signature` does not populate return signature for properties

Open
#10,396 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug

The signature and return_annotation arguments from the autodoc-process-signature callback is always None and None for properties. The return_annotation should be populated with the property return type.

How to Reproduce

Unzip sphinx-bug.zip and cd into its folder.

$  sphinx-build -b html -v docs/ docs/build/
Expected behavior
Current Sphinx build output
...
reading sources... [100%] index
class my_module.MyClass <class 'my_module.MyClass'> (arg1: str) None
method my_module.MyClass.my_classmethod <bound method MyClass.my_classmethod of <class 'my_module.MyClass'>> (b: int) str
method my_module.MyClass.my_method <function MyClass.my_method at 0x7fb668d558b0> (a: int) int
property my_module.MyClass.my_property <property object at 0x7fb668d4b040> None None
...
Expect Sphinx build output
...
reading sources... [100%] index
class my_module.MyClass <class 'my_module.MyClass'> (arg1: str) None
method my_module.MyClass.my_classmethod <bound method MyClass.my_classmethod of <class 'my_module.MyClass'>> (b: int) str
method my_module.MyClass.my_method <function MyClass.my_method at 0x7fb668d558b0> (a: int) int
property my_module.MyClass.my_property <property object at 0x7fb668d4b040> None str
...
Your project

Attached above

Screenshots

image

OS

Ubuntu 20.04 in WSL

Python version

3.8.10

Sphinx version

4.5.0

Sphinx extensions

sphinx.ext.autodoc

Extra tools

No response

Additional context

No response

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 with the sphinx.ext.autodoc handling of the autodoc-process-signature callback and reproduce the behavior with the attached project using sphinx-build -b html -v docs/ docs/build/. Done means property callbacks receive the property's return type in return_annotation instead of None, matching the expected output.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.