-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Unintuitive behaviour when only subpackage provides py.typed #16149
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
Comments
The same is happening with ExampleTake the following snippet as example: import pydantic
class CustomModel(pydantic.BaseModel):
"""Base class for pydantic models."""
prop1: str = pydantic.Field(alias="property1", frozen=True) This code will produce the following
|
This is because the numba.typed subpackage provides a I don't know what LukeSavefrogs is about, I cannot reproduce nor have you provided enough information to truly reproduce. |
Sorry if I was not clear, when I come back home I'll try and see if the issue is related to what you said. Otherwise I'll open a new issue. 😄 |
Thanks. I hadn't noticed the I don't think from numba import njit
|
As an addition, I can confirm that |
is there any solution/workaround to this? I can add
to pyproject.toml, but I would rather this happens at a module level
does not work because the error happens in my modules at import time |
In my case, I cannot simply disable error by code for whole module (readline), though disabling globally in mypy works [mypy]
strict = True
; # beware of enabling option, it can lead to false positives
; disable_error_code = attr-defined
; this doesn't work xD
[mypy-readline]
disable_error_code = attr-defined
[mypy-readline.*]
disable_error_code = attr-defined |
Is there any update on this or recommended way of dealing with it? |
I don't know about recommended, but here's one possible workaround:
It will make mypy simply skip analysis of numba and anything originating from it will be Any. |
+1 types-protobuf has the same issue, where
errors with "Library google not found" |
Bug Report
from numba import typed
causes mypy to generate spurious attr-defined errors for everything else imported from numba.To Reproduce
Expected Behavior
Actual Behavior
Your Environment
mypy.ini
(and other config files): noneThe text was updated successfully, but these errors were encountered: