cuddly-jelly-27016
05/15/2025, 12:12 AMpydantic.BaseModel subclasses in my flyte tasks and workflows
from datetime import datetime
from typing import List, Optional
from pydantic import BaseModel
class User(BaseModel):
id: int
name = 'John Doe'
signup_ts: Optional[datetime] = None
friends: List[int] = []
from flytekit import task
@task
def my_task(user: User) -> User:
...
### Describe alternatives you've considered
Create some sort of utility function that converts BaseModels to dataclasses.
### Propose: Link/Inline OR Additional context
No response
### Are you sure this issue hasn't been raised already?
• Yes
### Have you read the Code of Conduct?
• Yes
flyteorg/flytecuddly-jelly-27016
05/15/2025, 12:12 AM