Skip to content

Unable to run mypy against installed modules #14559

@bdrung

Description

@bdrung

Bug Report

I want to run mypy against an installed Python module (in my case distro_info) on Debian/Ubuntu, but all tries failed. I found no documentation about this use case.

To Reproduce

$ mypy /usr/lib/python3/dist-packages/distro_info.py
mypy: "../../usr/lib/python3/dist-packages/typing_extensions.py" shadows library module "typing_extensions"
note: A user-defined top-level module with name "typing_extensions" is not supported
$ mypy -m distro_info
mypy: can't find module 'distro_info'
$ MYPYPATH=/usr/lib/python3/dist-packages/ mypy -m distro_info
/usr/lib/python3/dist-packages is in the MYPYPATH. Please remove it.
See https://mypy.readthedocs.io/en/stable/running_mypy.html#how-mypy-handles-imports for more info

Expected Behavior

I expect that there is a way to call mypy to run against an installed module.

Your Environment

  • Mypy version used: 0.991-1
  • Python version used: 3.11.1-2

I can reproduce it in a minimal Debian unstable chroot after installing mypy and python3-distro-info.

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