Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mypy running extremely slow, are there any known possible causes?

Tags:

python

mypy

When I say extremely slow I really mean it. It takes about half a minute for it the print the error in the following very simple code:

def aaa(a: int, b: int, c: int) -> int:
    return 1

print(aaa(1, 2, 3, 4, 5))

For real code it takes forever, after several minutes waiting I gave up on waiting for it to end. I tried doing a pip install --upgrade --force-reinstall mypy but that didn't change anything.

like image 665
Janilson Avatar asked Jan 29 '26 22:01

Janilson


1 Answers

I don't know why exactly it's so slow, but running it like mypy --cache-fine-grained <args...> is the only thing that helped. Using the daemon as suggested by mypy didn't speed it up, but caching sped up subsequent runs. The first one still takes many seconds.

https://mypy.readthedocs.io/en/stable/additional_features.html#remote-cache

like image 81
wordsforthewise Avatar answered Feb 02 '26 16:02

wordsforthewise