GenericViewSet uses UsesQuerySet which is a Protocol, whose metaclass is ABCMeta, but during runtime type(GenericViewSet) is actually type
Using ABCMeta as base in custom metaclass fixes the issue, which is mostly fine although not entirely "correct".
I guess using protocols is more helpful than just satisfying an edge metaclass case. There seems to be some work in progress in mypy that might fix this issue, in the meantime, I wanted to open this issue here so that other people could see the cause & possible fix.
When using a custom metaclass with
GenericViewSet
will create "metaclass conflict" error. This seems to be due to some issue in mypy:https://github.com/python/mypy/issues/15040
GenericViewSet
usesUsesQuerySet
which is aProtocol
, whose metaclass isABCMeta
, but during runtimetype(GenericViewSet)
is actuallytype
Using
ABCMeta
as base in custom metaclass fixes the issue, which is mostly fine although not entirely "correct".I guess using protocols is more helpful than just satisfying an edge metaclass case. There seems to be some work in progress in mypy that might fix this issue, in the meantime, I wanted to open this issue here so that other people could see the cause & possible fix.