I'm using Python with AWS CDK to describe my infrastructure and I'm writing it using NeoVim.
I use ALE to check my code using mypy, so every time I make any change to a file, it runs mypy on it. The problem is that it takes around 40 seconds to verify a file and pegs a single core (thread) to 100%. If I have multiple buffers open at the same time, it will run a mypy process for each file, which quickly starts chewing away at my CPU and therefore battery.
I presume that it has to do with just the sheer number of CDK Constructs from the library that it has to check every time (the .mypy_cache directory for aws_cdk is ~40MiB), but I'm still hoping that there is a way to speed it up.
This seems to have fixed itself over time. I assume that someone made a change somewhere that sped it up significantly and now the check only takes longer the first time. When it has generated the .mypy_cache
, subsequent checks usually run in a second or less.