python / python/mypy

`--no-incremental` still writes `.mypy_cache`

Open
#19,489 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug documentation topic-configuration topic-incremental
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Bug Report

the help seems to indicate a cache will not be produced with --no-incremental:

$ mypy --help | grep -A2 no-inc
  --no-incremental          Disable module cache (inverse: --incremental)
  --cache-dir DIR           Store module cache info in the given folder in
                            incremental mode (defaults to '.mypy_cache')

a workaround is --cache-dir /dev/null though this isn't super portable

To Reproduce

print(1)
rm -rf .mypy_cache
mypy t.py --no-incremental
ls -ald .mypy_cache

Expected Behavior

$ rm -rf .mypy_cache
$ mypy t.py --no-incremental
Success: no issues found in 1 source file
$ ls -ald .mypy_cache
ls: cannot access '.mypy_cache': No such file or directory

Actual Behavior

$ rm -rf .mypy_cache
$ mypy t.py --no-incremental
Success: no issues found in 1 source file
$ ls -ald .mypy_cache
drwxr-xr-x 5 asottile wheel 160 Jul 22 07:36 .mypy_cache

Your Environment

  • Mypy version used: 1.17.0
  • Mypy command-line flags: --no-incremental
  • Mypy configuration options from mypy.ini (and other config files): n/a
  • Python version used:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the provided mypy t.py --no-incremental reproduction after removing .mypy_cache, then inspect the command-line handling and cache behavior associated with --no-incremental and --cache-dir. Done means the command still reports success without creating .mypy_cache, while incremental mode remains unaffected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.