sphinx-doc / sphinx-doc/sphinx

`inherited-members` does not work properly for slotted attributes

Open
#9,583 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:bug
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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.