You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is just a personal Python library, and doesn’t need to be published or distributed. The usage consists of running pytest and mypy from the root directory.
Among other things, the pyproject.toml contains the following sections:
hello/__init__.py: error: Duplicate module named "hello" (also at "./build/lib/hello/__init__.py")
hello/__init__.py: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#mapping-file-paths-to-modules for more info
hello/__init__.py: note: Common resolutions include: a) using `--exclude` to avoid checking one of them, b) adding `__init__.py` somewhere, c) using `--explicit-package-bases` or adjusting MYPYPATH
Found 1 error in 1 file (errors prevented further checking)
Error: Process completed with exit code 2.
To Reproduce
Create a project as shown above, and run the pip install command.
Expected Behavior
I found a pip ticket for this exact problem where pytest was confused by the presence of a build directory. Apparently, in-place builds were introduced in pip 20.1, and is now the default.
One of the suggestions in the ticket was to ignore the build directory. pytest seems to have caught up since it no longer fails with the error reported in the ticket. Surprisingly, mypy does't exclude the build directory automatically, and needs to be told explicitly.
[tool.mypy]
exclude = [
"venv",
"build",
]
The expectation from this ticket is to ignore the directories like venv and build by default without needing to be specified by the user. Better yet, use the .gitignore.
Actual Behavior
Shown above.
Your Environment
Mypy version used: 1.14.1
Mypy command-line flags: --strict .
Mypy configuration options from mypy.ini (and other config files): Shown above.
Python version used: 3.13.1
The text was updated successfully, but these errors were encountered:
Bug Report
I’ve a project structured as follows:
This is just a personal Python library, and doesn’t need to be published or distributed. The usage consists of running pytest and mypy from the root directory.
Among other things, the
pyproject.toml
contains the following sections:The dependencies are installed as follows:
But my GitHub CI fails with the following error:
To Reproduce
Create a project as shown above, and run the
pip install
command.Expected Behavior
I found a pip ticket for this exact problem where
pytest
was confused by the presence of abuild
directory. Apparently, in-place builds were introduced in pip 20.1, and is now the default.One of the suggestions in the ticket was to ignore the
build
directory.pytest
seems to have caught up since it no longer fails with the error reported in the ticket. Surprisingly, mypy does't exclude thebuild
directory automatically, and needs to be told explicitly.The expectation from this ticket is to ignore the directories like
venv
andbuild
by default without needing to be specified by the user. Better yet, use the.gitignore
.Actual Behavior
Shown above.
Your Environment
--strict .
mypy.ini
(and other config files): Shown above.The text was updated successfully, but these errors were encountered: