You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my own project, I have 27 modules in a single SCC, and mypy takes 26 seconds to analyze if any of them has reported errors. Same if I run mypy again without changing any of the modules. mypy is deleting all 27 cache files!
By the way, if I turn off error reporting on all these modules, then mypy does not delete the cache files. If I then enable error reporting on any one of them which has errors, mypy correctly reports the errors, using the existing cache files, but still deletes the cache files afterward.
I assert that #4045 is the wrong solution, and the cache files should not be deleted in this case. You can remove the following code from build.py\write_cache():
This is the only use of transitive_error, so you can remove all references to that elsewhere in the code.
Experiment
I removes the above mentioned code, and added a line if 'a' in scc: fresh = False, which treats module a as stale.
I repeated the calls to mypy cited in #4043, and this time got the expected results every time.
Proposed Fix
Let Sa be the State for module a, and Sb be the State for module b (if it exists). Sa.is_fresh() needs to recognize that it is out of date with respect to Sb.
Since both modules could be in the same SCC, one meta file will be later than the other, so using mtime is not the answer.
Instead, each meta file Sa should keep some data about each Sb at the time Sa was stored, so that it can detect if this is different from the current Sb in the filesystem. This could be a hash of the metadata, excluding the information for the Sb's.
Your Environment
Mypy version used: 0.930
Mypy command-line flags: -i
Python version used: 3.7
Operating system and version: Win 10
The text was updated successfully, but these errors were encountered:
Bug Report
Although #4043 has been fixed by #4045, it has adverse impact on performance. It results in multiple modules being checked unnecessarily.
To repeat the example from #4043:
In my own project, I have 27 modules in a single SCC, and mypy takes 26 seconds to analyze if any of them has reported errors. Same if I run mypy again without changing any of the modules. mypy is deleting all 27 cache files!
By the way, if I turn off error reporting on all these modules, then mypy does not delete the cache files. If I then enable error reporting on any one of them which has errors, mypy correctly reports the errors, using the existing cache files, but still deletes the cache files afterward.
I assert that #4045 is the wrong solution, and the cache files should not be deleted in this case. You can remove the following code from
build.py\write_cache()
:This is the only use of
transitive_error
, so you can remove all references to that elsewhere in the code.Experiment
I removes the above mentioned code, and added a line
if 'a' in scc: fresh = False
, which treats modulea
as stale.I repeated the calls to mypy cited in #4043, and this time got the expected results every time.
Proposed Fix
Let
Sa
be theState
for modulea
, andSb
be theState
for moduleb
(if it exists).Sa.is_fresh()
needs to recognize that it is out of date with respect toSb
.Since both modules could be in the same SCC, one meta file will be later than the other, so using
mtime
is not the answer.Instead, each meta file
Sa
should keep some data about eachSb
at the timeSa
was stored, so that it can detect if this is different from the currentSb
in the filesystem. This could be a hash of the metadata, excluding the information for theSb
's.Your Environment
The text was updated successfully, but these errors were encountered: