-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Poetry 1.1.x breaks mypy in a project with source dependencies #3094
Comments
Hello @kkozmic, is this related: #2194 (comment) ? fin swimmer |
hey @finswimmer I looked at that workaround, but if I understand it correctly, That's not what I want - I want those additional dependencies to be treated as dependencies, not as my project code. Additionally, running mypy with I want paths to those two projects to end up in |
@kkozmic I am guessing in this scenario your dependencies are poetry projects installed with |
|
OK? I saw that issue before submitting this one, and it looked related, albeit concerned with race conditions whereas my problem is broken mypy.
We've got |
I tried it with |
@kkozmic I was on my mobile. So looking at the EDIT: The code above the referenced one seems to be processing site packages. I wonder why the paths do not get loaded. EDIT2: Would be great to get a sample project to test this. |
Right, so you're basically saying it's more of a mypy bug than Poetry (which is fair enough).
I'd have to put something together from scratch as obviously I can't use our production code. I'll look into it over the coming weekend |
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
Awesome. That would make things easier to triage/decide. |
Awesome, and I appreciate it 👏 |
So I got carried away and created a reproduction @abn git clone git@github.com:bug-repros/poetry-main.git
cd poetry-main
poetry install
make This works under Poetry 1.0.10 and fails under 1.1.1 with the error from OP. |
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 |
No worries, I'll be keeping an eye out for it. Thanks @bryanforbes |
@kkozmic thank you for the reproducer. It is extremely helpful. Had a quick look into this, and I am leaning towards not making any changes at the moment as I could not find any other cases where the If anyone has a compelling case other than |
My only suggestion would be to add a flag to optionally generate |
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. |
Fair call @abn . Now 🤞 mypy 0.800 gets released soon so I can upgrade :partyparrot: |
Can the problem I have be related to this issue https://stackoverflow.com/questions/65512870/mypy-failing-on-test-source-folders-because-of-absence-of-type-hints-or-library?noredirect=1#comment115833764_65512870 ? And if that's the same cause, is there a known workaround? |
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. |
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 to include the SAW Python bindings in a `poetry` project as a `develop` dependency. For the most part, this is a matter of adjusting version bounds. In a handful of cases, we are able to remove `type: ignore` comments due to `mypy-0.8` being smarter than `mypy-0.7`.
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 to include the SAW Python bindings in a `poetry` project as a `develop` dependency. For the most part, this is a matter of adjusting version bounds. In a handful of cases, we are able to remove `type: ignore` comments due to `mypy-0.8` being smarter than `mypy-0.7`.
works fine with latest poetry / mypy - dunno which is fixed but this seems good now |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
-vvv
option).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
) runningpoetry run mypy .
produces a whole bunch of errors like: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.
The text was updated successfully, but these errors were encountered: