-
-
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
in-project stubs cause mypy to bail in 0.971 #13214
Comments
In mypy 0.960 and for long, long before, mypy only looked at site packages, with some logic on top to handle The check you're running into was to prevent people from doing If you see the before side of #11143, this check was only against The connection with errors being reported in your stubs comes from Line 2458 in a6166b2
where mypy will automatically silence errors from things it's picked up from pyinfo and typeshed. Just to be explicit and reduce confusion, I'm quite sure the current pyinfo / #13161 is correct (and it matches the behaviour of mypy 0.960 too, in terms of what ends up where on I think the fix here is to either get rid of the check entirely, or to restrict it so that it only applies to actually site-package dirs, like it did in 0.960 |
And thanks for the report and the extra investigation, makes it much easier to figure out what's going on! |
Ok, I think I kinda-sorta understand what's going on. As a test, I reverted my hack to exclude For now, we'll stick to 0.961 until there's a patch to address this behavior. It may make sense to add a unittest for this scenario since it's a documented configuration, that way any future regressions could be caught? |
I think I've found the specific environment parts that are causing our error.
So our pyproject.toml looks like:
Upon
With this
If I comment-out the I also tried this with a simple setuptools-based setup: setup.py: from setuptools import setup
setup(
name='test_project',
version='2.0',
packages=['namespace_pkg'],
) Upon
|
To sum up my previous comment, I think that mypy is currently incompatible with an editable-installed package ( |
This was a regression in 0.971 Fixes python#13214
This was a regression in 0.971 Fixes #13214
Turn off in-project stubs for now until this bug is fixed and in a mypy release we can consume. python/mypy#13214 Change-Id: I079802bea4ae86ed29c57bd5273ef8e0e4bb6b3c
* Update cinder from branch 'master' to 09d7c16a78d33efd743e6f9e6a9abe0aa91e9622 - Merge "mypy: work around mypy bug #13214" - mypy: work around mypy bug #13214 Turn off in-project stubs for now until this bug is fixed and in a mypy release we can consume. python/mypy#13214 Change-Id: I079802bea4ae86ed29c57bd5273ef8e0e4bb6b3c
Today I am solving the ~same problem: typeddjango/django-stubs#1108 Mypy 0.960 works just fine, but 0.971 just does not see my stubs 😢 |
Turn off in-project stubs for now until this bug is fixed and in a mypy release we can consume. python/mypy#13214 Change-Id: Ica954cffd760d7a9d48ba38d01e0e01e84553ff8
* Update os-brick from branch 'master' to d5820f531901fd87b692b225c155c4e262731375 - mypy: work around mypy bug #13214 Turn off in-project stubs for now until this bug is fixed and in a mypy release we can consume. python/mypy#13214 Change-Id: Ica954cffd760d7a9d48ba38d01e0e01e84553ff8
Bug Report
We have a project that includes type stubs for a python package that does not provide it's own typing. We followed guidance per https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-library-stubs-or-py-typed-marker number 3
In mypy 0.961, type checks pass
In mypy 0.971, these now fail because the current path is being added to the path search
If i modify
mypy/pyinfo.py::getsearchdirs
to exclude the current working directory (effectively reverting 2132036) the type checks "work" except I now get type failures for the stubsExpected Behavior
Failures wouldn't occur or documentation would be updated to reflect how to accommodate this use case.
Actual Behavior
mypy now fails to type check our code because we include stubs as part of our source tree
Your Environment
mypy.ini
(and other config files):The text was updated successfully, but these errors were encountered: