cloudpathlib icon indicating copy to clipboard operation
cloudpathlib copied to clipboard

Can't use cloudpathlib with mypy

Open sid-kap opened this issue 3 years ago • 2 comments

I'm interested in using cloudpathlib in my project, but I'm currently not able to because of the following error:

[file in my project]:8:1: error: Skipping analyzing "cloudpathlib": module is installed, but missing library stubs or py.typed marker  [import]

According to the mypy documentation, this is because cloudpathlib doesn't include type hints or declare itself as a PEP 561 compliant stub package.

Is cloudpathlib supposed to work with type checkers? I see that the code has type hints, so I'm surprised that it doesn't work for me out of the box.

sid-kap avatar Aug 03 '22 02:08 sid-kap

It looks like it's as easy as adding an empty file called py.typed in the cloudpathlib directory, and adding package_data={"cloudpathlib": ["py.typed"]}) to setup.py. (See https://blog.whtsky.me/tech/2021/dont-forget-py.typed-for-your-typed-python-package/.)

Would you accept a PR that adds this?

sid-kap avatar Aug 03 '22 02:08 sid-kap

Thanks for reporting! A PR is welcome.

jayqi avatar Aug 03 '22 14:08 jayqi

@sid-kap This is released now in version 0.10.0 on PyPI

pjbull avatar Aug 19 '22 01:08 pjbull

Awesome, thanks!!

sid-kap avatar Aug 19 '22 01:08 sid-kap