When running mypy --strict on my pyxel project, I am getting the following error messages:
ichor\world\level.py:89: error: "Tilemap" has no attribute "set" [attr-defined]
ichor\world\world.py:26: error: "Tilemap" has no attribute "image" [attr-defined]
ichor\game.py:18: error: "Image" has no attribute "load" [attr-defined]
ichor\game.py:19: error: "Image" has no attribute "load" [attr-defined]
ichor\game.py:20: error: "Image" has no attribute "load" [attr-defined]
Upon inspection, it looks like there is a part of __init__.pyi that defines Image and Tilemap as a sort of forward declaration:
# Graphics
class Image: ...
class Tilemap: ...
If I delete the forward declarations and move the correct definitions from later in the file to where these forward declarations were, mypy can now find the methods on the class just fine.
I am running Python 3.11.5 with the following requirements.txt:
When running
mypy --strict
on my pyxel project, I am getting the following error messages:Upon inspection, it looks like there is a part of
__init__.pyi
that defines Image and Tilemap as a sort of forward declaration:If I delete the forward declarations and move the correct definitions from later in the file to where these forward declarations were,
mypy
can now find the methods on the class just fine.I am running Python 3.11.5 with the following
requirements.txt
: