Alexis Manin
02/19/2024, 7:20 AMConfig
object ? I have a set of parameters defined as a Pydantic model from a third-party library. I would like to make it configurable on run. I could duplicate the model fields as pure Config
class, but it would be a little tedious, because there's nested types in it. Quick example :
# Defined in third-party lib
class LogParams(BaseModel):
level: Literal["DEBUG", "INFO", "WARNING"]
date_format: Optional[str] = None
class RunParams(BaseModel):
batch_size: int = 1000
logs: LogParams = Field(LogParams(level="INFO"))
# My run configuration class
class RunConf(Config):
spec: RunParams
Davis Kirkendall
05/03/2024, 9:44 AMAlexis Manin
05/03/2024, 9:54 AM