It appears that mypyc refreshes the entire cache upon every execution. I am running Windows Server with Python 3.14 free-threaded. The behavior is identical on the standard Python 3.14 build (non-free-threaded). Removing .mypy_cache doesn't help.
I've tried everything:
- --skip-cache-mtime-checks
- --cache-dir .mypyc_cache
- Different versions of Python and different versions of mypy
- Different machines
- Ubuntu (Windows Linux Subsystem)
Mypy works fine – it uses the cache, and mypyc refreshes every time. The problem is that installing each additional library (even if it's not used) increases the compilation time (20 seconds for me). Maybe refreshing the cache is by design?
I get the following output every single time:
LOG: Mypy Version: 1.20.0+dev.8eb14fb2a7f3b4683856b74babc637a845f0f8a5
LOG: Config File: Default
LOG: Configured Executable: C:\Users\admin\WPy64-31420\python\python.exe
LOG: Current Executable: C:\Users\admin\WPy64-31420\python\python.exe
LOG: Cache Dir: .mypy_cache
LOG: Compiled: True
LOG: Exclude: []
LOG: Found source: BuildSource(path='test.py', module='test', has_text=False, base_dir='C:\\Users\\admin\\Repos\\xxx', followed=False)
LOG: Metadata not found for test
LOG: Parsing test.py (test)
LOG: Metadata not found for time
LOG: Parsing C:\Users\admin\WPy64-31420\python\Lib\site-packages\mypy\typeshed\stdlib\time.pyi (time)
LOG: Metadata not found for builtins
LOG: Parsing C:\Users\admin\WPy64-31420\python\Lib\site-packages\mypy\typeshed\stdlib\builtins.pyi (builtins)
LOG: Metadata not found for sys
LOG: Parsing C:\Users\admin\WPy64-31420\python\Lib\site-packages\mypy\typeshed\stdlib\sys\__init__.pyi (sys)
LOG: Metadata not found for _typeshed
LOG: Parsing C:\Users\admin\WPy64-31420\python\Lib\site-packages\mypy\typeshed\stdlib\_typeshed\__init__.pyi (_typeshed)
LOG: Metadata not found for typing
LOG: Parsing C:\Users\admin\WPy64-31420\python\Lib\site-packages\mypy\typeshed\stdlib\typing.pyi (typing)
LOG: Metadata not found for typing_extensions
LOG: Parsing C:\Users\admin\WPy64-31420\python\Lib\site-packages\mypy\typeshed\stdlib\typing_extensions.pyi (typing_extensions)
LOG: Metadata not found for collections.abc
LOG: Parsing C:\Users\admin\WPy64-31420\python\Lib\site-packages\mypy\typeshed\stdlib\collections\abc.pyi (collections.abc)
LOG: Metadata not found for _ast
(...)
LOG: Writing zipimport C:\Users\admin\WPy64-31420\python\Lib\site-packages\mypy\typeshed\stdlib\zipimport.pyi zipimport.meta.json zipimport.data.json
LOG: Cached module zipimport has changed interface
LOG: Writing zipfile._path C:\Users\admin\WPy64-31420\python\Lib\site-packages\mypy\typeshed\stdlib\zipfile\_path\__init__.pyi zipfile\_path\__init__.meta.json zipfile\_path\__init__.data.json
LOG: Cached module zipfile._path has changed interface
LOG: Writing zipfile C:\Users\admin\WPy64-31420\python\Lib\site-packages\mypy\typeshed\stdlib\zipfile\__init__.pyi zipfile\__init__.meta.json zipfile\__init__.data.json
LOG: Cached module zipfile has changed interface
LOG: Writing warnings C:\Users\admin\WPy64-31420\python\Lib\site-packages\mypy\typeshed\stdlib\warnings.pyi warnings.meta.json warnings.data.json
LOG: Cached module warnings has changed interface
LOG: Writing typing_extensions C:\Users\admin\WPy64-31420\python\Lib\site-packages\mypy\typeshed\stdlib\typing_extensions.pyi typing_extensions.meta.json typing_extensions.data.json
LOG: Cached module typing_extensions has changed interface
LOG: Writing typing C:\Users\admin\WPy64-31420\python\Lib\site-packages\mypy\typeshed\stdlib\typing.pyi typing.meta.json typing.data.json
LOG: Cached module typing has changed interface
LOG: Writing types C:\Users\admin\WPy64-31420\python\Lib\site-packages\mypy\typeshed\stdlib\types.pyi types.meta.json types.data.json
LOG: Cached module types has changed interface
LOG: Writing sys._monitoring C:\Users\admin\WPy64-31420\python\Lib\site-packages\mypy\typeshed\stdlib\sys\_monitoring.pyi sys\_monitoring.meta.json sys\_monitoring.data.json
LOG: Cached module sys._monitoring has changed interface
LOG: Writing sys C:\Users\admin\WPy64-31420\python\Lib\site-packages\mypy\typeshed\stdlib\sys\__init__.pyi sys\__init__.meta.json sys\__init__.data.json
LOG: Cached module sys has changed interface
(...)
It appears that mypyc refreshes the entire cache upon every execution. I am running Windows Server with Python 3.14 free-threaded. The behavior is identical on the standard Python 3.14 build (non-free-threaded). Removing .mypy_cache doesn't help.
I've tried everything:
Mypy works fine – it uses the cache, and mypyc refreshes every time. The problem is that installing each additional library (even if it's not used) increases the compilation time (20 seconds for me). Maybe refreshing the cache is by design?
I get the following output every single time: