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

autodoc inherited-members won't work for inherited attributes (data members). #741

Closed
shimizukawa opened this issue Jan 2, 2015 · 16 comments

Comments

@shimizukawa
Copy link
Member

autodoc searches for a cached docstring using (namespace, attrname) as search-key, but doesn't check for baseclass-namespace.


@shimizukawa
Copy link
Member Author

From mitar on 2012-01-07 18:21:47+00:00

Also {{{find_attr_doc}}} seems to not find inherited attributes?

@shimizukawa
Copy link
Member Author

From mitar on 2012-01-07 20:04:22+00:00

The problem is also that parser for attributes' doc strings parses only one module. It should also parses modules of all parent classes and combine everything.

@shimizukawa
Copy link
Member Author

From Jon Waltman on 2012-11-30 15:14:18+00:00

Issue #1048 was marked as a duplicate of this issue.

@halfak
Copy link

halfak commented Jan 15, 2016

I'm currently getting bit by this issue in 1.2.3. #2233 is preventing me from working with 1.3.x. Is there a workaround you might recommend?

@shimizukawa shimizukawa modified the milestones: 1.4, 1.4.1 Mar 28, 2016
@shimizukawa shimizukawa modified the milestones: 1.4.1, 1.4.2 Apr 12, 2016
@tk0miya tk0miya removed this from the 1.4.2 milestone May 28, 2016
@LevN0
Copy link

LevN0 commented Jun 15, 2016

Is there any hope of getting this fixed, or a workaround? As mentioned in #1048 even using autoattribute does not work.

@numberoverzero
Copy link

numberoverzero commented Nov 3, 2016

I'm also running into this. For now I'm manually duplicating docstrings, but it would be nice if :inherited-members: worked.

I'm not familiar with the code base at all, but if anyone's willing to point me in a direction I can try to write a fix.

@MatthieuPERIN
Copy link

Any news on this feature / bugfix ?

@tk0miya tk0miya added this to the 3.0.0 milestone Feb 4, 2020
@tk0miya tk0miya modified the milestones: 3.0.0, 3.1.0 Mar 14, 2020
@tk0miya tk0miya modified the milestones: 3.1.0, 3.2.0 May 30, 2020
@tk0miya tk0miya modified the milestones: 3.2.0, 3.3.0 Aug 7, 2020
@tk0miya tk0miya modified the milestones: 3.3.0, 3.4.0 Nov 1, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Dec 17, 2020
…ce attributes on super class

To support instance attributes on super class, get_class_members() scans
the instance attributes defined at super classes using ModuleAnalyzer.
It allows to generate document for them when users gives :
inherited-members: option.
tk0miya added a commit that referenced this issue Dec 18, 2020
Fix #741: autodoc: inherited-members doesn't support instance attributes on super class
@hagenw
Copy link

hagenw commented Dec 21, 2020

I saw that #8548 was merged and released inside sphinx 3.4.0.

But a simple :inherited-members: does still not include attributes, e.g.

class A(object):

    def __init__(self):
        self.a = a
        r"""My first attribute."""

class B(A):

    def __init__(self):
        self.b = b
        r"""My second attribute."""
.. automodule:: abtest

.. autoclass:: B
    :members:
    :inherited-members:

image

tk0miya added a commit to tk0miya/sphinx that referenced this issue Dec 25, 2020
…ce attributes on super class

To support instance attributes on super class, get_class_members() scans
the instance attributes defined at super classes using ModuleAnalyzer.
It allows to generate document for them when users gives
:inherited-members: option.

It was fixed once, but it only works on test script because
:inherited-members: option is recognized as expected on running Sphinx
from command line.  This fixes the option_spec handler and autodoc
itself.
tk0miya added a commit to tk0miya/sphinx that referenced this issue Dec 25, 2020
…ce attributes on super class

To support instance attributes on super class, get_class_members() scans
the instance attributes defined at super classes using ModuleAnalyzer.
It allows to generate document for them when users gives
:inherited-members: option.

It was fixed once, but it only works on test script because
:inherited-members: option is recognized as expected on running Sphinx
from command line.  This fixes the option_spec handler and autodoc
itself.

refs: sphinx-doc#8548
@tk0miya
Copy link
Member

tk0miya commented Dec 25, 2020

@hagenw Thank you for letting me know. Indeed, this option is only working on test script. I submit a fix for this again: #8587.

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

No branches or pull requests

10 participants