Skip to content

First overload of functions with multiple overloads in .pyi files fail to appear in resultant .html #557

Description

@jonathandung

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]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions