-
-
Notifications
You must be signed in to change notification settings - Fork 640
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
bug with loading dependencies when running mypy #18519
Comments
Huh, interesting observation regarding the cache. I too have seen this issue on and off for months without being able to pin it down. |
Yeah I think there are potentially two problems here:
|
Spent some time debugging this with @stuhood in slack DM. A few things I have found–
|
I'm also experiencing this issue here: |
Patching the PR like diff --git a/BUILD b/BUILD
index c9bda9306..8d74b8143 100644
--- a/BUILD
+++ b/BUILD
@@ -23,7 +23,7 @@ python_requirements(
"types-PyYAML": ["yaml"],
"types-python-dateutil": ["dateutil", "dateutil.parser", "dateutil.tz"],
"types-redis": ["redis"],
- "types-six": ["six"],
+ "types-six": ["six", "graphql", "promise"],
"types-tabulate": ["tabulate"],
},
) resolves the issue. So this seems to be an issue of mismatch in transitive dependency resolution/requirement in mypy and pants. |
Still happens, especially with external package ( |
I had to do it like lablup/backend.ai@c7bb82e diff --git a/BUILD b/BUILD
index f85cfa7b..d9b923ba 100644
--- a/BUILD
+++ b/BUILD
@@ -23,8 +23,13 @@ python_requirements(
"types-PyYAML": ["yaml"],
"types-python-dateutil": ["dateutil", "dateutil.parser", "dateutil.tz"],
"types-redis": ["redis"],
- "types-setuptools": ["setuptools", "pkg_resources", "_pytest"],
- "types-six": ["six", "graphql", "promise", "_pytest", "ai.backend"],
+ "types-setuptools": [
+ "setuptools",
+ "pkg_resources",
+ "ai.backend.testutils",
+ "ai.backend.test",
+ ],
+ "types-six": ["six", "graphql", "promise", "ai.backend.manager.models"],
"types-tabulate": ["tabulate"],
},
) |
I'm running into some flakiness with mypy too. Blowing away the cache is unnecessary, merely re-running pants check is sufficient. I am running into this both in pre-commit as well as just running pants check from the command line. I am getting this error with other modules than mentioned here:
I have a separate lockfile for mypy due to some issue with the version of mypy that is bundled with pants, no idea if related. The error seems relatively new, I don't recall seeing anything like this pre 2.19.0 |
Having a similar bug with |
Not sure if related, but looking at Pants log, it seems like the the
Now, even successful run has the |
I'm actually thinking again, and doesn't it look like Playing in a venv with a similar configuration, I can run mypy without any of my dependency's dependencies and mypy will set them as This might be related to python/mypy#12162 |
Disregard this, I was able to get another failure and it didn't have this log. |
I found it. This is an issue with From pants side of things, I don't know if there could be a way to make the mypy cache specific to the venv and avoid reusing the same cache with different dependencies. |
FYI,
Should fix it until this bug get fixed in mypy. |
python/mypy#17420 should fix a thing here |
Thank you for the work on python/mypy#17420 ! With both
I have not been able to find a reproduction case yet. Note that here I'm interested if others have had more luck. |
Yes, sorry didn't have much time to come back, but I had similar issues... Unfortunately, unlike the previous instance of the bug, I'm unable to make a minimal repro. Like before, the cache end up in a state that will yield an error, but succeed on the next run. If I take a copy and reuse it I can reproduce the failure. (I can't share it since it's from our internal project though). |
Pants version
2.16, but also was happening on 2.15
OS
Mac
I have been trying to hunt down a bug in pants for a few weeks and finally have a reproduction, but don't know what do do with it.
From time to time, a mypy run will fail due to missing dependencies. Dependencies which are definitely configured and findable. Often a re-run will succeed, which has made this very hard to reproduce.
I now found a case where running a single file will fail, but running with
::
will succeed. I have both sandboxes and when I edit __files.txt in the latter it passes. However I don't know what to look for in these sandboxes to figure out what's going on.Failure from the "bad" sandbox:
Success from the good sandbox, edited to run only the file in question:
A fun complication is that the mypy cache appears to get poisoned. If I have a failed run on the "bad" sandbox, the good one will then fail. If I reset the cache it will work.
The text was updated successfully, but these errors were encountered: