Skip to content

--ignore-missing-imports not working for modularized typeshed types #10283

Closed
@FuegoFro

Description

@FuegoFro

Bug Report

Mypy does not respect the --ignore-missing-imports flag/ignore_missing_imports = True config for types that are now modularized out of typeshed (eg the legacy_bundled_packages).

I don't think this is a typeshed bug, but let me know if you disagree and I can make an issue there instead.

To Reproduce

Given the following file:

from redis.sentinel import Sentinel

I always get the following output:

python -m mypy --ignore-missing-imports example.py
example.py:1: error: Library stubs not installed for "redis.sentinel" (or incompatible with Python 3.7)
example.py:1: note: Hint: "python3 -m pip install types-redis"
example.py:1: note: (or run "mypy --install-types" to install all missing stub packages)
example.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)

It doesn't matter whether --ignore-missing-imports is included or whether types-redis is installed, it will always give me exactly that output.

Note that a line like from foo_asdf import bar is correctly ignored by the --ignore-missing-imports flag and types that are defined by types-redis (like redis.StrictRedis) will work correctly (with or without the flag) when that package is installed.

Your Environment

  • Mypy version used: mypy 0.820+dev.e46aa6df6126cf47bea97bf9f94d7cba093d0103 (latest master at time of filing)
  • Mypy command-line flags: --ignore-missing-imports
  • Mypy configuration options from mypy.ini (and other config files): N/A
  • Python version used: Python 3.7.6
  • Operating system and version: macOS 10.15.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions