I’m working on a package and trying to implement an easy interface for extensibility using abstract classes and parameterizing the classes. However, those two don’t play well together when used as superclasses together.
class BaseRAG(ABC, Parameterized):
some_name = param.String(default='Default Name')
@abstractmethod
def create_corpus(self):
pass
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
Thanks to Mr. Claude Opus, this seems to work(at least, for now):
from abc import ABCMeta
from param import Parameterized
class ParameterizedABCMeta(ABCMeta, type(Parameterized)):
pass
class BaseRAG(Parameterized, metaclass=ParameterizedABCMeta):
some_name = param.String(default='Default Name')
@abstractmethod
def create_corpus(self):
pass
Would this be the best path forward, or is there something I’m missing?