I entered the command:
$ mypy mypycode.py
Then I run the following code in mypycode.py:
from mypyc.build import mypycify
from setuptools import setup
from timeit import timeit
import math
setup(
name="mypycode",
package=["mypycode"],
ext_module=mypycify(["mypycode.py"])
)
print("doing something that I want to optimize with mypy")
But it threw an error:
mypycode.py:1: error: Skipping analyzing "mypyc.build": module is installed, but missing library stubs or py.typed marker [import-untyped]
mypycode.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
mypycode.py:2: error: Skipping analyzing "setuptools": module is installed, but missing library stubs or py.typed marker [import-untyped]
People are only talking how to ignore the problem, but I want to actually annotate the module. I just want to see a concrete example of a program that works. I mean, what exactly do I need to do? I don’t know how to annotate the type of a module. The given link doesn’t contain any examples that works on my computer. Are there something to do with file path? If so, please let me know how to find the file path. Thanks!
Note: I use the setup things based on this YouTube video 3:38, I am not sure if it is the correct way to enable mypy.