Skip to content

Abstractmethod docstrings are not inherited in API reference #255

@brynpickering

Description

@brynpickering

Description

As is being tracked here, we do not get docstrings in our reference API for abstract methods that are set by child classes, i.e.,

class DiscretionaryTrip(ABC):
    ...
    @abstractmethod
    def choose_destination(self) -> str:
        """Selects a destination for the discretionary activity.

        Returns:
            str: Selected destination zone name.
        """

class DiscretionaryTripOD(DiscretionaryTrip):
    ...
    def choose_destination(self) -> str:
        zone = sample_weighted(self.destination_p)
        area = self._od.labels.destination_zones[zone]

        return area

Python passes the abstract method docstring down to the child class (help(my_discretionary_trip_od_model.choose_destination) will return the expected docstring), but this isn't the case in the docs:

image

Related links

Version

0.2

Proposed change

Repeat docstring in child class methods until mkdocstrings/griffe#96 is fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions