Skip to content

bug: Overload only stubs are not detected #417

@iatkinson

Description

@iatkinson

This appears related to #116 (but is different as there is no concrete implementation here)

Description of the bug

When using stubs only, overloads do not get detected.

To Reproduce

# my_stub/__init__.py

from typing import overload

@overload
def foo(a: int) -> int: ...

@overload
def foo(a: str) -> str: ...


@overload
def bar(a: int) -> int: ...

@overload
def bar(a: str) -> str: ...

# This shoudn't be in the stub file, but without it Griffe does not detect the function.
def bar(a: int | str) -> int | str: ...
>>> griffe.load('my_stub').members
{'overload': Alias('overload', 'typing.overload'), 'bar': Function('bar', 18, 18)}

bar is detected but not foo in the stub.

Expected behavior

Expect foo in the above stub to be detected.

Environment information

griffe==1.14.0

Note

Using a stub-only package for doc generation using mkdocstrings to avoid pulling all dependencies of the full package.

Metadata

Metadata

Assignees

Labels

unconfirmedThis bug was not reproduced yet

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions