Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Improved error message from: [directory] is not a valid Python package name #17108

Description

@doctrino

Bug Report

Executing mypy fails with some strange error message.

To Reproduce

>>> mypy run cognite/neat
source-graphs is not a valid Python package name

In the root of the public repo: https://github.com/cognitedata/neat

Same for dmypy

>>> dmypy run -- cognite/neat
source-graphs is not a valid Python package name

Expected Behavior

Execute validation of the files in the package.

Actual Behavior

It responds: source-graphs is not a valid Python package name

Digging into the source code of mypy it seems to be hitting here
https://github.com/python/mypy/blob/master/mypy/find_sources.py#L187

Your Environment

  • Mypy version used: 1.9
  • Mypy command-line flags:
  • Mypy configuration options from mypy.ini (and other config files):
[tool.mypy]
explicit_package_bases = true
allow_redefinition = true
plugins = ["pydantic.mypy"]
  • Python version used: 3.12
  • OS: Windows

If I specify a different path MyPy works as normal, for example,

mypy run cognite/neat/rules

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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