From: Daniele Varrazzo Date: Wed, 1 Apr 2026 10:55:24 +0000 (+0200) Subject: chore: avoid using SQLite cache in Mypy runs X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=HEAD;p=thirdparty%2Fpsycopg.git chore: avoid using SQLite cache in Mypy runs 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`. --- diff --git a/pyproject.toml b/pyproject.toml index 9b7acfafc..dcf825878 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,6 +42,16 @@ exclude = '''(?x)( | 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.*",