poetry: Poetry 1.1.x breaks mypy in a project with source dependencies
- I am on the latest Poetry version.
- I have searched the issues of this repo and believe that this is not a duplicate.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).
- OS version and name: MacOS 10.16.5
- Poetry version: 1.1.1
- Link of a Gist with the contents of your pyproject.toml file: link
Issue
This is an issue with mypy under .venv
created with latest Poetry (v1.1.x) which works just fine if the .venv
was created with older version (v1.0.10 or before)
Our project has two source dependencies on other internal projects.
After the upgrade (and re-creating the .venv
) running poetry run mypy .
produces a whole bunch of errors like:
error: Cannot find implementation or library stub for module named 'our_source_project1.something'
error: Cannot find implementation or library stub for module named 'our_source_project2.something_else'
Digging through the logs, diffs and then mypy source code I narrowed it down to this:
Under Poetry v1.0 a .venv/lib/python3.8/site-packages/easy-install.pth
file gets created which contains paths to each of our code dependency projects.
Under Poetry v1.1 this file doesn’t get created.
Thing is, mypy reads this specific file to find these source dependencies. (source). Without it it doesn’t know how to find them, hence the errors, and a broken build.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 5
- Comments: 21 (10 by maintainers)
Commits related to this issue
- cryptol-remote-api: Upgrade to mypy-0.812 This upgrades `mypy` to version `0.812`. This is primarily motivated by a need to work around python-poetry/poetry#3094, which currently happens if you try t... — committed to GaloisInc/cryptol by RyanGlScott 3 years ago
- cryptol-remote-api: Upgrade to mypy-0.812 This upgrades `mypy` to version `0.812`. This is primarily motivated by a need to work around python-poetry/poetry#3094, which currently happens if you try t... — committed to GaloisInc/cryptol by RyanGlScott 3 years ago
I just found this issue today when I started running into the problem. Looks like MyPy v.0.800 was released today, 22 Jan 2021. I’m getting this error with the new 0.800 version.
Fair call @abn . Now 🤞 mypy 0.800 gets released soon so I can upgrade :partyparrot:
The next release of mypy (0.800) will include a fix for this, but I’m not sure when it will come out since 0.790 was just released today
Yes. However, if there is anything we can do to keep things compatible, I am happy to look into it. We can, at least for
1.1
play nice and write toeasy-install.pth
as well if there are no undesired side-effects.Awesome. That would make things easier to triage/decide.
works fine with latest poetry / mypy - dunno which is fixed but this seems good now
To be completely honest, it seems like too much effort for a temporary workaround. I’ll think on it.
If there are other cases that are important relying on the file, it might be a different story. Right now, I just haven’t found any.
So I got carried away and created a reproduction @abn
This works under Poetry 1.0.10 and fails under 1.1.1 with the error from OP.