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

Handle Google style docstrings for Python properties #499

Closed
rodrigogiraoserrao opened this issue Dec 14, 2022 · 5 comments
Closed

Handle Google style docstrings for Python properties #499

rodrigogiraoserrao opened this issue Dec 14, 2022 · 5 comments
Labels
feature New feature or request

Comments

@rodrigogiraoserrao
Copy link

Hey, thank you so much for your work on mkdocstrings!

Currently, mkdocstrings has support for methods that have docstrings that follow the Google style, but sadly it does not have support for properties (@property) that follow the Google style for Python docstrings.

So, currently, I have to do something like:

class MyClass:
    # ...
    @property
    def my_int_property(self) -> int:
        """My brief description here.

        Returns:
            int: A typically redundant description here.
        """

Ideally, I would just do something like

class MyClass:
    # ...
    @property
    def my_int_property(self) -> int:
        """int: My brief description here."""

In a perfect world, mkdocstrings would even pick up the name of the return value from the property name itself!

@rodrigogiraoserrao rodrigogiraoserrao added the feature New feature or request label Dec 14, 2022
@pawamoy
Copy link
Member

pawamoy commented Dec 14, 2022

Hello! You can just remove int: from the docstring: the type is already fetched from the signature. Let me know if that works for you.

@rodrigogiraoserrao
Copy link
Author

You are right, I should remove int: from the docstring because mkdocstrings reads it from there, but that still doesn't address my issue of handling docstrings for properties.

@pawamoy
Copy link
Member

pawamoy commented Dec 29, 2022

Google-style documented properties are definitely supported. Could you expand on what your issue actually is? Is the property not showing up in the generated docs? Is it showing up but without the docstring? Something else?

@rodrigogiraoserrao
Copy link
Author

I was looking back to this and I can't really see what I was thinking / trying to do. Properties are documented as expected and they get appropriate labels...

I'll close this issue; thanks for your time!

@pawamoy
Copy link
Member

pawamoy commented Jan 31, 2023

Thanks for coming back and closing!

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

No branches or pull requests

2 participants