-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
Other info
-
Poetry version: Poetry 1.4.0 or later
-
Python version: Any Python version (I have tested with 3.8, 3.9, 3.10, and 3.11)
-
OS version and name: Ubuntu 20.04
-
pyproject.toml: The relevant
pyproject.tomlfile in the minimal repro is here:[tool.poetry] name = "bar" version = "0.1.0" description = "A library that depends on `foo`" authors = ["Ryan Scott"] license = "BSD License" include = [ "LICENSE", ] [tool.poetry.dependencies] python = "^3.8" foo = { path = "../foo/", develop = true } [tool.poetry.dev-dependencies] mypy = "^0.991" [build-system] requires = ["poetry>=1.1.4", "setuptools>=40.8.0"]
Note the
foo = { path = "../foo/", develop = true }line, which is vital to triggering the bug.
- I am on the latest stable Poetry version, installed using a recommended method.
- I have searched the issues of this repo and believe that this is not a duplicate.
- I have consulted the FAQ and blog for any relevant entries or release notes.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvvoption) and have included the output below.
Issue
Running mypy with Poetry 1.4.0 or later in a project with a local dependency unexpectedly fails due to a Cannot find implementation or library stub for module error involving the local dependency. This is a regression, as this did not occur with Poetry 1.3.2 or earlier.
I have prepared a minimal reproducer at the https://github.com/RyanGlScott/poetry-bug repository. To reproduce the bug, perform the following steps:
$ git clone https://github.com/RyanGlScott/poetry-bug
$ cd poetry-bug/bar
# First, try Poetry 1.3.2, which is known to work
$ poetry self update 1.3.2
$ rm -rf ~/.cache/pypoetry/ .mypy_cache && poetry update && poetry install
$ poetry run mypy --install-types --non-interactive bar/
Success: no issues found in 1 source file
$ # Next, try Poetry 1.4.2, which fails
$ poetry self update 1.4.2
$ rm -rf ~/.cache/pypoetry/ .mypy_cache && poetry update && poetry install
$ poetry run mypy --install-types --non-interactive bar/
bar/__init__.py:1: error: Cannot find implementation or library stub for module named "foo" [import]
bar/__init__.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)