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

Bug: Type hints not working as expected #109

Open
YPCrumble opened this issue Sep 23, 2022 · 1 comment
Open

Bug: Type hints not working as expected #109

YPCrumble opened this issue Sep 23, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@YPCrumble
Copy link
Contributor

Steps to reproduce

  1. Check out this example repository: https://github.com/YPCrumble/amazon-paapi-test
  2. Create a virtualenvironment and install mypy
  3. Run mypy . and you should get this following error:
example/example.py:1: error: Skipping analyzing "amazon_paapi.models.item_result": module is installed, but missing library stubs or py.typed marker
example/example.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
example/example.py:5: note: Revealed type is "Any"

Current behavior
MyPy type hints are not being picked up from the package

Expected behavior
I would expect the revealed type of result to be Item, and I would expect MyPy to raise an error for the subsequent statement, print(result.item_info.content_info), because item_info.content_info could be None per my previous commit, so item_info.content_info.publication_date can potentially raise an AttributeError.

@YPCrumble YPCrumble added the bug Something isn't working label Sep 23, 2022
@YPCrumble
Copy link
Contributor Author

This is the relevant section of the MyPy docs as to why this might be happening: https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-library-stubs-or-py-typed-marker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant