Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 940 Bytes

README.md

File metadata and controls

33 lines (23 loc) · 940 Bytes

Flytekit Pydantic Plugin

Warning

This plugin is deprecated and will be removed in the future.

Please directly install pydantic and use BaseModel in your Flyte tasks.

Introduction

Pydantic is a data validation and settings management library that uses Python type annotations to enforce type hints at runtime and provide user-friendly errors when data is invalid. Pydantic models are classes that inherit from pydantic.BaseModel and are used to define the structure and validation of data using Python type annotations.

The plugin adds type support for pydantic models.

To install the plugin, run the following command:

pip install flytekitplugins-pydantic

Type Example

from pydantic.v1 import BaseModel


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

@task
def train(cfg: TrainConfig):
    ...