telekom / lazy-imports

Python tool to support lazy imports.
Apache License 2.0
25 stars 1 forks source link

Issue with type checkers #13

Open jplu opened 1 year ago

jplu commented 1 year ago

Hello!

When I use your package, apparently mypy and PyLance are not happy with it. They raises warning saying:

Stub file not found for "lazy_imports"

Indeed some of your datatypes cannot be properly understood by the type checkers because of this missing file (see https://mypy.readthedocs.io/en/stable/stubs.html). Any chance you can fix this at some point ?

Thanks :)

PhilipMay commented 1 year ago

Hi @jplu ! Thanks for reporting this. I will investigate it.

Do you think providing a stub would be the best solution? Would it help to add more type annotations to this python source code?

I'm not super familiar with mypy and PyLance, unfortunately. Do you know more?

jplu commented 1 year ago

In order to be sure, better to add the stub file, py.typed with:

partial

And doing a simple:

pip install mypy
mypy .

And fix all the raised warning by mypy.

PhilipMay commented 1 year ago

https://peps.python.org/pep-0561/#packaging-type-information

PhilipMay commented 1 year ago

Which Python version do you use? I have strange issues with Python 3.7 which disappeared when using Python 3.8.

jplu commented 1 year ago

I'm using Python 3.10, so it should be ok then :)