Since Mypy 1.20 the SQLite cache is used by default. This highlights
Mypy concurrency issues running pre-commit in the CI, which are known to
the project devs but which we practically never encountered using the
file-based cache. See https://github.com/python/mypy/issues/21136.
The alternative solution of avoiding parallel Mypy runs in pre-commit
using `require_serial: false`, reveals other issues such as
https://github.com/python/mypy/issues/17362.
An alternative which would probably work could be to pass no file names
to mypy and re-mypy the entire codebase at every commit using
`pass_filenames: false`. See https://github.com/python/mypy/issues/13916.
This for me seems about 25% slower when changing a single file.
This commit restores the 1.19 behaviour of using the file-based cache,
which was working adequately for us. In the future we may decide to move
to `pass_filenames: false`.
| tests/test_tstring\.py
)'''
+# Don't use SQLite cache as it highlights Mypy concurrency issues.
+# See https://github.com/python/mypy/issues/21136
+# The issue is triggered by parallel mypy runs under pre-commit, setting
+# the parameter here allows the use of the same cache both by pre-commit and
+# every other Mypy usage.
+#
+# Check https://github.com/python/mypy/issues/13916 in the future to see
+# if new ways to run mypy under pre-commit emerge.
+sqlite_cache = false
+
[[tool.mypy.overrides]]
module = [
"numpy.*",