-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
1.7.0: Cannot find implementation or library stub for module named "scribe" #16466
Comments
We also saw this in Debian; I presumed it was due to the [purposeful] lack of internet connectivity on our build hosts. https://salsa.debian.org/python-team/packages/mypy/-/commit/d43794178b2f0421654ad0ca2cb0eedd49cde6e0 |
I'm pretty confident it is permanent issue, not related to internet connectivity. Proof: testing of |
@mtelka Could be! We never allow internet connections on our build hosts. I forcibly enabled internet access and The second failing test looks like what we experience in Debian with our big package of the entire typeshed: for us, |
I think both failures are caused by |
I just confirmed that when I uninstall
|
The test was changed as part of 10dfafe (see #16226 (comment))
Sure, yes, I just selected a random Ultimately, I feel the fundamental problem here is that mypy's tests aren't guaranteed to pass if you create an environment that has extra packages etc. installed. I feel like we only guarantee the tests will pass if you create an isolated environment according to the instructions we give in https://github.com/python/mypy/blob/master/CONTRIBUTING.md#getting-started-with-development :) |
Why it must be an actively maintained
Of course, you cannot guarantee interoperability with the whole world. We just need some sort of interoperability with the small subset of that to make our packaging and testing working properly. You do that well. Thanks for that. Some minor issues like this one are just small fee to achieve our goals. |
If you don't have stubs for Okay, let's say typeshed removes its stubs for The upshot of this all is that, yeah, almost all the stubs packages hardcoded in |
Okay, I think I understand. Thanks for explanation. I was about to suggest |
yes, we've already removed those stubs from typeshed; we shouldn't be recommending to users that they install the stubs package anymore, as it's no longer maintained. It's arguably a bug that it's still there in the The trouble with a hardcoded list is that it's hard to keep it up to date ;) |
FWIW, some reasons why
|
Yes, it is so popular that the probability it will be already preinstalled is very high. Otherwise we won't see this bug filled :-). Then what about something like |
Sounds fine to me (though I'm not a maintainer here, just a triager and regular contributor :) |
For now I just patched out both tests and I will wait for a better solution. Thanks. |
I think the right solution (as Alex mentioned above) is to run mypy tests in an isolated environment. We don't and can't guarantee that the tests will pass when unknown other packages are installed. |
As discussed above, this change would just be papering over the underlying issue, which is that we do not and cannot guarantee our test suite will succeed if it isn't run in an isolated environment. However, if you want to propose a PR for this change, I think we'd be happy to consider it; There's no bug in mypy's test suite here, though, so there's nothing actionable for mypy maintainers or triagers. As such, I'm closing this issue. |
@AlexWaygood, it looks like the root cause is something different. I just tried the following patch:
and both tests failed with (almost) the same error:
And no, I have no |
Ah, the patch I tried was wrong. Sorry for noise. |
yes, |
Exactly, I replaced it by |
The current version of the patch:
Test results:
Any suggestion? Thank you. |
Oh -- for the first of the two tests, it needs to be an import that's included in the first of these two dictionaries. Try this patch instead: --- a/test-data/unit/pythoneval.test
+++ b/test-data/unit/pythoneval.test
@@ -1568,24 +1568,24 @@ note: A user-defined top-level module with name "typing" is not supported
# flags: --ignore-missing-imports
import scribe # No Python 3 stubs available for scribe
from scribe import x
-import docutils # Python 3 stubs available for docutils
+import waitress # Python 3 stubs available for waitress
import foobar_asdf
import jack # This has a stubs package but was never bundled with mypy, so ignoring works
[out]
-_testIgnoreImportIfNoPython3StubAvailable.py:4: error: Library stubs not installed for "docutils"
-_testIgnoreImportIfNoPython3StubAvailable.py:4: note: Hint: "python3 -m pip install types-docutils"
+_testIgnoreImportIfNoPython3StubAvailable.py:4: error: Library stubs not installed for "waitress"
+_testIgnoreImportIfNoPython3StubAvailable.py:4: note: Hint: "python3 -m pip install types-waitress"
_testIgnoreImportIfNoPython3StubAvailable.py:4: note: (or run "mypy --install-types" to install all missing stub packages)
_testIgnoreImportIfNoPython3StubAvailable.py:4: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
[case testNoPython3StubAvailable]
import scribe
from scribe import x
-import docutils
+import pythonwin
[out]
_testNoPython3StubAvailable.py:1: error: Cannot find implementation or library stub for module named "scribe"
_testNoPython3StubAvailable.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
-_testNoPython3StubAvailable.py:3: error: Library stubs not installed for "docutils"
-_testNoPython3StubAvailable.py:3: note: Hint: "python3 -m pip install types-docutils"
+_testNoPython3StubAvailable.py:3: error: Library stubs not installed for "pythonwin"
+_testNoPython3StubAvailable.py:3: note: Hint: "python3 -m pip install types-pywin32"
_testNoPython3StubAvailable.py:3: note: (or run "mypy --install-types" to install all missing stub packages) |
Then I'll probably go with the |
While updating mypy package for OpenIndiana from version 1.6.1 to version 1.7.0 I noticed two new test failures:
The text was updated successfully, but these errors were encountered: