Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use cloudpathlib with mypy #243

Closed
sid-kap opened this issue Aug 3, 2022 · 4 comments · Fixed by #248
Closed

Can't use cloudpathlib with mypy #243

sid-kap opened this issue Aug 3, 2022 · 4 comments · Fixed by #248
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@sid-kap
Copy link

sid-kap commented Aug 3, 2022

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
Copy link
Author

sid-kap commented Aug 3, 2022

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?

@jayqi
Copy link
Member

jayqi commented Aug 3, 2022

Thanks for reporting! A PR is welcome.

@jayqi jayqi added the enhancement New feature or request label Aug 3, 2022
@pjbull pjbull added the good first issue Good for newcomers label Aug 5, 2022
@pjbull
Copy link
Member

pjbull commented Aug 19, 2022

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

@sid-kap
Copy link
Author

sid-kap commented Aug 19, 2022

Awesome, thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants