Skip to content

Bug: Type hints not working as expected #109

Open
@YPCrumble

Description

@YPCrumble

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions