[Python] Why is mypy ignoring stub file? [duplicate]

Discussão em 'Python' iniciado por Stack, Agosto 24, 2025.

  1. Stack

    Stack Membro Participativo

    I have the two files in the following directory structure -

    .
    ├── mymod.py
    └── mymod.pyi


    The files are as follows -

    def add(a, b):
    return a + b

    if __name__ == "__main__":
    add(None, None)


    from typing import (
    Union,
    )

    def add(a: Union[int, str], b: Union[int, str]) -> Union[int, str]: ...


    I do not have any environment variables or config for stub files. The mypy cache is also cleared.

    When I run mypy mymod.py why does it not generate any errors?

    Continue reading...

Compartilhe esta Página