<#1660 Feat: Add type support for pydantic BaseMod...
# flyte-github
a
#1660 Feat: Add type support for pydantic BaseModels Pull request opened by ArthurBook TL;DR Lets you use pydantic basemodels as inputs and outputs in tasks. Also extends the basemodels to have any flyte supported file as field. Type ☐ Bug Fix ☑︎ Feature ☑︎ Plugin Are all requirements met? ☑︎ Code completed ☑︎ Smoke tested ☑︎ Unit tests added ☑︎ Code documentation added ☐ Any pending items have an associated Issue Complete description Added serializer/deserializers for flytepath and flytedirectory s.t. pydantic can jsonify these objects too. Type Example
Copy code
from pydantic import BaseModel

class Config(BaseModel):
    lr: float = 1e-3
    batch_size: int = 32
    files: List[FlyteFile]
    directories: List[FlyteDirectory]

@task
def train(cfg: Config):
    ...
Tracking Issue flyteorg/flyte#2686 Follow-up issue NA flyteorg/flytekit All checks have passed 30/30 successful checks