Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:inherited-members: Excludes All Members from Base Classes Appearing After the Excluded Class in Multiple Inheritance #13316

Open
GaryFrewin opened this issue Feb 7, 2025 · 0 comments
Labels

Comments

@GaryFrewin
Copy link

Describe the bug

Description:
When documenting a class with multiple inheritance using sphinx.ext.autodoc, the :inherited-members: directive does not behave as expected. Specifically, if you exclude inherited members from one base class, Sphinx incorrectly excludes all members from base classes that appear after the excluded one in the inheritance hierarchy.

How to Reproduce

class MixinA:
    def method_a(self):
        """Method from MixinA."""

class MixinB:
    def method_b(self):
        """Method from MixinB."""

class MixinC:
    def method_c(self):
        """Method from MixinC."""

class MyClass(MixinA, MixinB, MixinC):
    def my_method(self):
        """Method from MyClass."""

Sphinx .rst Configuration:

.. autoclass:: MyClass
   :members:
   :inherited-members: MixinB

This results in a output doc that ALSO exclude members from MixinC.

Environment Information

Please paste all output below into the bug report template



Platform:              linux; (Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.35)
Python version:        3.11.2 (main, Oct  4 2024, 09:08:31) [GCC 11.3.0])
Python implementation: CPython
Sphinx version:        8.1.3
Docutils version:      0.21.2
Jinja2 version:        3.1.4
Pygments version:      2.18.0

Sphinx extensions

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant