Skip to content

Issue with havivng .pyi files in a separate folder [Question - Need help] #4933

Closed
@waseem18

Description

@waseem18

This is more of a question than an issue.

I'm starting on using mypyand here's the minimal version of the project I'm type hinting - https://github.com/waseem18/mypy

We planned to have .pyi stubs of each python file separately in a folder named stubs and give the path to stubs folder in mypy.ini file.

I learnt from this stack overflow answer that the stub file works only when importing a module. So I wrote a basic test file in tests folder which basically imports and calls the methods present in mypy/main.py.

When I run mypy tests/test-main.py I get

mypy/main.py:1: error: Function is missing a type annotation
mypy/main.py:5: error: Function is missing a type annotation
mypy/main.py:9: error: Function is missing a type annotation

Though I gave path to stubs folder in mypy.ini file I believe mypy is still not considering stubs/mypy/main.pyi file. If stubs/mypy/main.pyi is considered it should throw me some errors as some of the returns types mentioned in main.pyi are incorrect.

Can someone please help me in knowing where am I exactly going wrong? In other words how do I place .pyi files in a separate folder and run mypy?

Just to point out, if both main.py and main.pyi are in same folder things are working.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions