Skip to content

Support 'Yields' in Google-style docstrings #89

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

Closed
jvfe opened this issue Jan 19, 2021 · 4 comments · Fixed by #116
Closed

Support 'Yields' in Google-style docstrings #89

jvfe opened this issue Jan 19, 2021 · 4 comments · Fixed by #116
Labels
docstrings Docstrings parsing docstrings-format:google feature New feature or request good first issue Good for newcomers

Comments

@jvfe
Copy link

jvfe commented Jan 19, 2021

I was using mkdocstrings, but I think this issue is specifically related to pytkdocs.

Is your feature request related to a problem? Please describe.

Yes. I had a docstring of a generator that I was using mkdocstrings (v0.14.0) to compile the documentation for, something like:

    """
    Get the next number in the sequence

    Args:
        n (int): The upper limit of the range to generate, from 0 to `n` - 1.

    Yields:
        int: The next number in the range of 0 to `n` - 1.
    """

Like specified in the Google style-guide.

But it was being rendered like !!! yields !!! int ...

Describe the solution you'd like

I'd like to be able to use Yields or Yield for generators.

Describe alternatives you've considered

Replacing Yields for Returns works as expected, but that is not an optimal solution.

Additional context

I've noticed napoleon seems to support both Yields and Yield for these cases.

And thanks for making mkdocstrings, it's really saved me a lot of time.

@jvfe jvfe added the feature New feature or request label Jan 19, 2021
@pawamoy
Copy link
Member

pawamoy commented Jan 19, 2021

Hello @jvfe, thank you for the detailed feature request! I'm totally in favor of adding support for Yields section 🙂
It should be quite easy to implement! Would you like to send a PR 😉?

@pawamoy pawamoy added good first issue Good for newcomers docstrings Docstrings parsing docstrings-format:google labels Jan 19, 2021
@jvfe
Copy link
Author

jvfe commented Jan 19, 2021

@pawamoy
Copy link
Member

pawamoy commented Sep 21, 2021

Oh, I realize I never answered, so sorry 🙇
Yes it should mimic other existing sections. I'll take care of it right now.

@pawamoy
Copy link
Member

pawamoy commented Sep 21, 2021

It will be released in version 0.13 as this would not be caught by mkdocstrings 0.16.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docstrings Docstrings parsing docstrings-format:google feature New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants