Incremental mode

By default, mypy will store type information into a cache. Mypywill use this information to avoid unnecessary recomputation whenit type checks your code again. This can help speed up the typechecking process, especially when most parts of your program havenot changed since the previous mypy run.

If you want to speed up how long it takes to recheck your codebeyond what incremental mode can offer, try running mypy indaemon mode.

  • —no-incremental
  • This flag disables incremental mode: mypy will no longer referencethe cache when re-run.

Note that mypy will still write out to the cache even whenincremental mode is disabled: see the —cache-dir flag belowfor more details.

  • —cache-dir DIR
  • By default, mypy stores all cache data inside of a folder named.mypy_cache in the current directory. This flag lets youchange this folder. This flag can also be useful for controllingcache use when using remote caching.

This setting will override the MYPY_CACHE_DIR environmentvariable if it is set.

Mypy will also always write to the cache even when incrementalmode is disabled so it can “warm up” the cache. To disablewriting to the cache, use —cache-dir=/dev/null (UNIX)or —cache-dir=nul (Windows).

  • —sqlite-cache
  • Use an SQLite database to store the cache.
  • —cache-fine-grained
  • Include fine-grained dependency information in the cache for the mypy daemon.
  • —skip-version-check
  • By default, mypy will ignore cache data generated by a differentversion of mypy. This flag disables that behavior.
  • —skip-cache-mtime-checks
  • Skip cache internal consistency checks based on mtime.