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

Abstractmethod docstrings are not inherited in API reference #255

Open
brynpickering opened this issue Sep 22, 2023 · 0 comments
Open

Abstractmethod docstrings are not inherited in API reference #255

brynpickering opened this issue Sep 22, 2023 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@brynpickering
Copy link
Contributor

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.

@brynpickering brynpickering added the documentation Improvements or additions to documentation label Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant