python / python/mypy

Dmypy only respects the `follow_imports=skip` override on the first run

Open
#16,190 3 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug topic-daemon
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

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

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

Start by reproducing the issue with dmypy run bar.py twice using the shown pyproject.toml and bar.py contents, then compare the daemon's output with repeated mypy bar.py runs. Done means every dmypy run respects the follow_imports = "skip" override and reports the expected revealed types.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.