Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type: ignore only works when deleting mypy cache #9777

Closed
l0b0 opened this issue Dec 2, 2020 · 1 comment
Closed

type: ignore only works when deleting mypy cache #9777

l0b0 opened this issue Dec 2, 2020 · 1 comment
Labels
bug mypy got something wrong

Comments

@l0b0
Copy link

l0b0 commented Dec 2, 2020

Bug Report

mypy reliably fails to take into account a type: ignore comment on the second run after deleting the cache.

To Reproduce

  1. rm -r .mypy_cache
  2. mypy .
  3. mypy .

Expected Behavior

The second run of mypy should behave exactly the same as the first run.

Actual Behavior

$ rm -r .mypy_cache
$ mypy .
Success: no issues found in 23 source files
$ mypy .
infra/app.py:9: error: Skipping analyzing 'aws_cdk': found module but no type hints or library stubs
infra/datalake/datalake_stack.py:4: error: Skipping analyzing 'aws_cdk': found module but no type hints or library stubs
infra/datalake/datalake_stack.py:4: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
Found 2 errors in 2 files (checked 23 source files)

Some subsequent runs will succeed, but I've not looked into the pattern. I was able to run while pre-commit run --all-files mypy; do rm -r .mypy_cache; done a bunch of rounds without failure.

Your Environment

  • Mypy version used: 0.790
  • Mypy command-line flags: None
  • Mypy configuration options from mypy.ini (and other config files): None
  • Python version used: 3.8.6
  • Operating system and version: Arch Linux

Relevant commit

Workaround

Add --no-incremental to the mypy arguments.

@hauntsaninja
Copy link
Collaborator

Fixed by #10937

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

2 participants