You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ah, I need to tweak the type annotation (turns out Type[C] basically only works for classes, not abstract types like Tuple or Optional). Will do in the next couple of days.
I actually needed to add some overloads. There's no way to correctly check cattr.structure([1.0, 2, "3"], Tuple[int, int, int]) with current Mypy as far as I'm aware. So in those cases you will have to suppress the error in any case.
The PEP was formally accepted 13 days ago. In Mypy it's still behind a feature flag, so not many will have it enabled by default.
And it won't work by default, we'll need to change our type hints to use TypeForm[T] instead of type[T] in places. I've started on this in a branch but I don't think I want to merge it until Mypy supports it by default.
Activity
[-]Mypy error on ctructure[/-][+]Mypy error on structure[/+]Tinche commentedon Jan 22, 2021
Ah, I need to tweak the type annotation (turns out
Type[C]basically only works for classes, not abstract types likeTupleorOptional). Will do in the next couple of days.Tinche commentedon Jan 22, 2021
Note that I have to change this type annotation to
Any, since there's no better way to type check this atm.Tinche commentedon Jan 23, 2021
I actually needed to add some overloads. There's no way to correctly check
cattr.structure([1.0, 2, "3"], Tuple[int, int, int])with current Mypy as far as I'm aware. So in those cases you will have to suppress the error in any case.Tinche commentedon Jan 23, 2021
We're waiting on this: python/mypy#9773
AdrianSosic commentedon Mar 4, 2026
Is completed since end of last year. Does it auto-solve this issue?
Tinche commentedon Mar 4, 2026
The PEP was formally accepted 13 days ago. In Mypy it's still behind a feature flag, so not many will have it enabled by default.
And it won't work by default, we'll need to change our type hints to use TypeForm[T] instead of type[T] in places. I've started on this in a branch but I don't think I want to merge it until Mypy supports it by default.
layday commentedon Sep 26, 2026
It'd be nice to get this in. Support for
TypeFormlanded in mypy 1.19 and has been enabled by default since 1.21.Tinche commentedon Sep 27, 2026
Yeah, it's probably time. Started preliminary work over at #786.