-
Notifications
You must be signed in to change notification settings - Fork 11
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
Ignore mypy false positive #275
Conversation
Hm.. great :( |
@inducer Dug into this a bit more and it seems like the problem is that we pin From what I can tell the possible fixes are: bump the mypy python version or ignore it harder (i.e. add a temporary EDIT: The main difference between Github and Gitlab seems to be that one builds with conda and the other with pip. I haven't managed to see which package is different and causes the mismatch in errors.. |
Thanks for digging into this! So is the overall issue intermittent? (Given that it passed here when it, IIUC, wasn't expected to?) Is there a mypy issue we can point to? To my mind, a Py3.8 codebase that imports 3.11 stuff from |
It's not intermittent. It's seems to pass consistently on Github in the conda env and fail consistently on Gitlab in the pip virtual env. I see the same failures locally as on Gitlab.
Yeah, agreed, not sure why mypy is confused about it here.. |
Bleah, I think I know what it doesn't like. Gitlab seems to install pytools from git and Github from conda (or something?). This simple reproducer fails for me. If you only import from __future__ import annotations
from dataclasses import dataclass
from typing import TypeVar
try:
from typing import dataclass_transform
except ImportError:
from typing_extensions import dataclass_transform
T = TypeVar("T")
@dataclass_transform(eq_default=True, frozen_default=True)
def tag(cls: type[T]) -> type[T]:
return dataclass(init=True, frozen=True, eq=True, repr=True)(cls)
@tag
class Tag:
pass
@tag
class UniqueTag(Tag):
pass
@tag
class _BaseNamedTag(Tag):
pass
@tag
class SomeTag(_BaseNamedTag):
name: str
t1 = Tag()
t2 = SomeTag("name") |
I'll go ahead and close this since it just needs a new pytools with the fix. |
Haven't managed to track down the actual issue, but the error here goes away if
tag_dataclass
is replaced with justdataclass
. mypy has multipledataclass_transform
issues still open, so it's likely not quite ironed out..Gitlab is passing though: https://gitlab.tiker.net/fikl2/arraycontext/-/pipelines/575042