Do newer versions of flyte have pydantic inputs to...
# flyte-v1-support
n
Do newer versions of flyte have pydantic inputs to workflows/tasks show up as something other than structs? I've been using dataclassjsonmixin to get well formatted input in the UI but want to try switching over to pydantic but on a flyte 1.16.2 deployment, an example wf shows up as struct
Copy code
from pydantic import BaseModel
from flytekit import task, workflow

class Datum(BaseModel):
    x: int
    y: str
    z: dict[int, str]


@task
def add(x: Datum, y: Datum) -> Datum:
    x.z.update(y.z)
    return Datum(x=x.x + y.x, y=x.y + y.y, z=x.z)

@workflow
def pydantic_add(x: Datum) -> Datum:
    return add(x=x, y=x)
python env from where i'm fast registering
Copy code
pydantic                    2.12.4
pydantic_core               2.41.5
pydantic-yaml               1.6.0
flyteidl                    1.16.2
flytekit                    1.16.2
flytekitplugins-pod         1.16.9
flytekitplugins-polars      1.16.9
flytekitplugins-wandb       1.16.9
g
pydantic inputs will show up as struct as well
f
Laura want to try v2?
n
ah, so only in v2 will the pydantic inputs show up in the UI well and not struct blobs
f
What do you mean?
In v1 also they are supported but in v2 we have gone deep
l
Do you recommend pydantic for all structured data in V2? I think traditionally folks will use it to validate peripheral inputs and then dataclasses everywhere else for perf, but I'm curious.
f
Data classes also work really well in v2. So it's your choice
👍 1