astropy / sphinx-automodapi

Sphinx extension for generating API documentation
https://sphinx-automodapi.readthedocs.io
BSD 3-Clause "New" or "Revised" License
65 stars 45 forks source link

Members not listed for ABC-derived classes with custom metaclass #132

Closed pkgw closed 3 years ago

pkgw commented 3 years ago

This issue is an iteration on #52 / #53. Members of a class fail to be listed when the following circumstances hold:

Sounds incredibly esoteric, but this is biting me in wwt_data_formats right now.

The problem is that the fix for the earlier bug, #53, only tests if the metaclass of the class in question is exactly ABCMeta. If the class uses a custom metaclass that derives from ABCMeta, the check fails. For example:

from abc import ABC, ABCMeta

class IntermediateMeta(ABCMeta):
    pass

class Concrete(ABC, metaclass=IntermediateMeta):
    def mymethod(self):
        """This is a great method."""
        pass

The fix is a one-liner, and I'll submit a PR momentarily.

pkgw commented 3 years ago

BTW, I am working around this by turning on :inherited-members: for now, but it pollutes the namespaces of my classes with lots of extraneous traitlets cruft, so it's really not an acceptable long-term solution.

simaoafonso-pwt commented 3 years ago

133 is merged, should this be closed?

pkgw commented 3 years ago

Yup!