Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core feature] Pydantic BaseModel V2 in Dataclass #5925

Open
2 tasks done
Future-Outlier opened this issue Oct 28, 2024 · 0 comments
Open
2 tasks done

[Core feature] Pydantic BaseModel V2 in Dataclass #5925

Future-Outlier opened this issue Oct 28, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request flytekit FlyteKit Python related issue

Comments

@Future-Outlier
Copy link
Member

Motivation: Why do you think this is important?

Some users want the below example works in a task/workflow.

from dataclasses import dataclass, field

# Define InnerBM using Pydantic BaseModel
class InnerBM(BaseModel):
    a: int = -1
    b: float = 3.14
    c: str = "Hello, Flyte"
    d: bool = False

# Define the dataclass DC
@dataclass
class DC:
    a: int = -1
    b: float = 3.14
    c: str = "Hello, Flyte"
    d: bool = False
    inner_bm: InnerBM = field(default_factory=lambda: InnerBM())

Goal: What should the final outcome look like, ideally?

These 2 cases should work.

https://github.com/flyteorg/flytekit/pull/2792/files#diff-779944519da7ce37ef29492b53edb53d653884263629341e4721c22d2223dedd

Describe alternatives you've considered

Keep it the same.

Propose: Link/Inline OR Additional context

flyteorg/flytekit#2792 (comment)

Are you sure this issue hasn't been raised already?

  • Yes

Have you read the Code of Conduct?

  • Yes
@Future-Outlier Future-Outlier added enhancement New feature or request untriaged This issues has not yet been looked at by the Maintainers flytekit FlyteKit Python related issue and removed untriaged This issues has not yet been looked at by the Maintainers labels Oct 28, 2024
@Future-Outlier Future-Outlier self-assigned this Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request flytekit FlyteKit Python related issue
Projects
None yet
Development

No branches or pull requests

1 participant