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

Feature Request: docstring style for sphinx-autodoc-typehints #124

Open
jgarte opened this issue Jun 21, 2022 · 1 comment
Open

Feature Request: docstring style for sphinx-autodoc-typehints #124

jgarte opened this issue Jun 21, 2022 · 1 comment

Comments

@jgarte
Copy link
Contributor

jgarte commented Jun 21, 2022

https://pypi.org/project/sphinx-autodoc-typehints/

Instead of

def format_unit(value, unit):
    """
    Formats the given value as a human readable string using the given units.

    :param float|int value: a numeric value
    :param str unit: the unit for the value (kg, m, etc.)
    :rtype: str
    """
    return f"{value} {unit}"

We produce this

from typing import Union


def format_unit(value: Union[float, int], unit: str) -> str:
    """
    Formats the given value as a human readable string using the given units.

    :param value: a numeric value
    :param unit: the unit for the value (kg, m, etc.)
    """
    return f"{value} {unit}"

wdyt

@gartangh
Copy link

I would also like a flag that disables types for parameters / return types (especially for Google style docstrings), so that sphinx-autodoc-typehints can do its thing.

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

No branches or pull requests

2 participants