Skip to content

Mypy doesn't find type hints in imported module #9944

@mvolfik

Description

@mvolfik

Bug Report

Mypy doesn't find type hints in my library.

To Reproduce

Pipfile:

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
mypy = "==0.800"

[packages]
kayaclock-utils = {git = "https://github.com/kayaclock/kayaclock-utils.git", ref = "5658111116af089b3b74684a36e284adf6728504"}

[requires]
python_version = "3.8"

program.py:

from kayaclock_utils.data.basic_types import GateID

a = GateID(8)

Steps:

pipenv --python 3.8
pipenv update
pipenv run mypy .

The library itself is checked correctly with mypy configured to be strict and use pydantic plugin, see the full mypy.ini. If i copy this config into the directory with the bug setup as above, nothing changes (just an idea - there maybe should be a way for libraries to define what mypy plugins they recommend/require to typecheck correctly).

Expected Behavior

Everything typechecks correctly

Actual Behavior

program.py:1: error: Skipping analyzing 'kayaclock_utils.data.basic_types': found module but no type hints or library stubs
program.py:1: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)

Your Environment

  • Mypy version used: 0.800
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files): none or strict + pydantic
  • Python version used: 3.8.5
  • Operating system and version: Ubuntu 20.04.1 LTS

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions