Skip to content

0.971: Namespace packages -> Source file found twice under different module names #13202

Closed
@pawamoy

Description

@pawamoy

Bug Report

With mypy 0.961 I was able to scan my namespace packages without any issue. I've just upgraded today to 0.971, and I'm now getting a Source file found twice under different module names error.

$ pdm run mypy src
src/namespace/package/module.py: error: Source file found twice under different module names: "package.module" and "namespace.package.module"
Found 1 error in 1 file (errors prevented further checking)

$ pdm run mypy src --namespace-packages
src/namespace/package/module.py: error: Source file found twice under different module names: "package.module" and "namespace.package.module"
Found 1 error in 1 file (errors prevented further checking)

$ pdm run mypy src --namespace-packages --explicit-package-bases
src/namespace/package/module.py: error: Source file found twice under different module names: "package.module" and "namespace.package.module"
Found 1 error in 1 file (errors prevented further checking)

$ pdm run mypy src/namespace
src/namespace/package/module.py: error: Source file found twice under different module names: "package.module" and "namespace.package.module"
Found 1 error in 1 file (errors prevented further checking)

$ pdm run mypy src/namespace --namespace-packages
src/namespace/package/module.py: error: Source file found twice under different module names: "package.module" and "namespace.package.module"
Found 1 error in 1 file (errors prevented further checking)

$ pdm run mypy src/namespace --namespace-packages --explicit-package-bases
src/namespace/package/module.py: error: Source file found twice under different module names: "package.module" and "namespace.package.module"
Found 1 error in 1 file (errors prevented further checking)

To Reproduce

Create a namespace package and try to run mypy on it. I'll try to give an actual reproduction example tomorrow.

Expected Behavior

No "found twice" error.

Actual Behavior

"Found twice" error.

Your Environment

  • Mypy version used: 0.971
  • Mypy command-line flags:
  • Mypy configuration options from mypy.ini (and other config files):
[mypy]
ignore_missing_imports = true
show_error_codes = true
warn_unused_ignores = true
warn_unused_configs = true
  • Python version used: 3.8.11
  • Operating system and version: Linux 3.10.0-862.6.3.el7.x86_64

Seems related to:

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