When I set the following in conf.py:
autoapi_file_patterns = ['*.pyi']
autoapi correctly reads the annotations and documentation from stubs only. However, for many of my function signatures which make use of typing.overload, I notice that the signature overload that comes first, which originally had type annotations:
@overload
def foo[T=int](bar: str, /, *, baz: T=...) -> list[T]: ...
@overload
def foo[T](quux: int, /, *, baz: T) -> set[T]: ...
renders to the following:
foo[T=int](bar, /, *, baz) [source]
foo(quux: int, /, *, baz: T) -> set[T]
Real example from my own library, with html output
Input:
# asyncutils/iters.pyi
from ._internal.protocols import SupportsIteration
from _collections_abc import AsyncGenerator
@overload
def agroupby[T](it: SupportsIteration[T], key: Callable[[T], T]=...) -> AsyncGenerator[tuple[T, AsyncGenerator[T, None]], None]: ...
@overload
def agroupby[T, R](it: SupportsIteration[T], key: Callable[[T], R]) -> AsyncGenerator[tuple[R, AsyncGenerator[T, None]], None]: ...
Output:
-
asyncutils.iters.agroupby[T](it, key=...)[source]
-
asyncutils.iters.agroupby(it: asyncutils._internal.protocols.SupportsIteration[T], key: _collections_abc.Callable[[T], R]) → _collections_abc.AsyncGenerator[tuple[R, _collections_abc.AsyncGenerator[T, None]], None]
When I set the following in conf.py:
autoapi correctly reads the annotations and documentation from stubs only. However, for many of my function signatures which make use of typing.overload, I notice that the signature overload that comes first, which originally had type annotations:
renders to the following:
Real example from my own library, with html output
Input:
Output: