sphinx-doc / sphinx-doc/sphinx
`inherited-members` does not work properly for slotted attributes
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
The inherited attributes from a slotted superclass are not shown when using inherited-members option in autodoc:
from typing import List
class Circle:
"""A class representing a circle."""
__slots__ = ("radius",)
def __init__(self, radius: int) -> None:
#: Radius of a circle.
self.radius = radius
class Pizza(Circle):
"""A class representing a pizza."""
def __init__(self, ingredients: List[str]) -> None:
#: List of ingredients.
self.ingredients = ingredients
How to Reproduce
$ git clone https://github.com/jack1142/sphinx-issue-9583
$ cd sphinx-issue-9583
$ pip install sphinx
$ cd docs
$ make html
$ # open _build/html/index.html and see the issue
Expected behavior
I expected the inherited attributes to be shown.
Your project
https://github.com/jack1142/sphinx-issue-9583
Screenshots
Here's a link to generated docs:
https://sphinx-issue-9583.readthedocs.io/en/latest/
OS
Windows 10, Ubuntu 18.04
Python version
3.7, 3.8, 3.9
Sphinx version
4.1.2
Sphinx extensions
sphinx.ext.autodoc
Extra tools
No response
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by cloning the linked reproduction project, installing Sphinx, and running make html under docs to confirm the missing inherited attributes. Trace the sphinx.ext.autodoc handling of inherited-members for slotted superclass attributes, then add coverage and verify that the generated documentation shows those attributes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100