Skip to content

Dmypy only respects the follow_imports=skip override on the first run #16190

Description

@neob91-close

Bug Report

Dmypy ignores follow_imports=skip override on the second run.

To Reproduce

import IPython.terminal.prompts


reveal_type(IPython)
reveal_type(IPython.terminal.prompts)

pyproject.toml:

[tool.mypy]
python_version = "3.10"
follow_imports = "normal"

[[tool.mypy.overrides]]
module = [
    "IPython.terminal.prompts",
]
follow_imports = "skip"

Expected Behavior

All runs of dmypy run bar.py will show the same output:

bar.py:4: note: Revealed type is "types.ModuleType"
bar.py:5: note: Revealed type is "Any"

Actual Behavior

The first run of dmypy run bar.py shows:

bar.py:4: note: Revealed type is "types.ModuleType"
bar.py:5: note: Revealed type is "Any"

The second run of dmypy run bar.py shows:

bar.py:4: note: Revealed type is "types.ModuleType"
bar.py:5: note: Revealed type is "types.ModuleType"

Running mypy bar.py works correctly every time.

Your Environment

  • Mypy version used: mypy 1.4.0
  • Mypy command-line flags:
  • Mypy configuration options from mypy.ini (and other config files):
  • Python version used: Python 3.10.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions