python / python/mypy

ignore_missing_imports removed from mypy.ini not noticed due to cache.

Open
#8,753 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug priority-1-normal
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

  • Are you reporting a bug, or opening a feature request?

bug

  • Please insert below the code you are checking with mypy,
    or a mock-up repro if the source is private. We would appreciate
    if you try to simplify your case to a minimal repro.
$ cat >test.py <<__EOF__
import foobarxyz
__EOF__

$ cat >mypy.ini <<__EOF__
[mypy]
[mypy-foobarxyz]
ignore_missing_imports = True
__EOF__

$ mypy test.py
--> passes typecheck - GOOD

$ cat >mypy.ini <<__EOF__
[mypy]
__EOF__

$ mypy test.py
--> passes typecheck - BAD (*)

$ rm -R .mypy_cache
$ mypy test.py
--> fails typecheck - GOOD
  • What is the actual behavior/output?
    In (*), the file passes typecheck even if we removed ignore_missing_imports from config, which should result in an unresolved import.

  • What is the behavior/output you expect?
    A failed typecheck - the result with cache should be the same as without.

  • What are the versions of mypy and Python you are using?
    0.770

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

Reproduce the behavior with the issue's test.py and mypy.ini commands, then compare the cached run with the run after removing .mypy_cache. Trace how configuration changes affect the cache, and verify that removing ignore_missing_imports produces the same unresolved-import result with and without an existing cache.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.