Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Allow extra keyword arguments in MetaModel.__new__ #867
import pydantic class CustomBaseModel(pydantic.BaseModel): def __init_subclass__(cls, special_parameter): # do something with special_parameter ... class NewModel(CustomBaseModel, special_parameter=42): # model definition here ...
should not raise any exceptions. But:
I can (and will) submit a PR for this if you accept it; it is an extremely simple fix (plus not-so-simple tests because metaclasses).
…__ (#868) * Fix #867 by accepting and passing on **kwargs in ModelMetaclass.__new__ pydantic.main.MetaModel.__new__ should include **kwargs at the end of the method definition and pass them on to the super call at the end in order to allow the special method __init_subclass__ to be defined with custom parameters on extended BaseModel classes. * MetaModel -> ModelMetaclass * shrink change notes * rename and reformat change description