pyment icon indicating copy to clipboard operation
pyment copied to clipboard

Feature Request: docstring style for sphinx-autodoc-typehints

Open jgarte opened this issue 3 years ago • 1 comments

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

jgarte avatar Jun 21 '22 19:06 jgarte

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.

gartangh avatar Oct 10 '22 19:10 gartangh