Flytekit

1.16.19 · active · verified Wed Apr 15

Flytekit is the Python SDK for Flyte, an open-source platform for building highly scalable, reliable, and reproducible data and ML workflows. It allows developers to author tasks, workflows, and launch plans using familiar Pythonic constructs like functions and decorators. Currently at version 1.16.19, Flytekit maintains a rapid release cadence with multiple minor updates typically published each month.

Warnings

Install

Imports

Quickstart

This quickstart defines a simple Flyte task `say_hello` and a workflow `hello_world_wf` that orchestrates it. Tasks are Python functions decorated with `@task`, and workflows are Python functions decorated with `@workflow`. All inputs and outputs must be type-annotated. The workflow can be run locally like a regular Python function or via the `pyflyte` CLI.

from flytekit import task, workflow

@task
def say_hello(name: str) -> str:
    return f"Hello, {name}!"

@workflow
def hello_world_wf(name: str = "world") -> str:
    res = say_hello(name=name)
    return res

if __name__ == "__main__":
    # Run locally
    print(f"Local execution: {hello_world_wf(name='Flyte')}")
    # Alternatively, use pyflyte CLI for local or remote execution:
    # pyflyte run your_script.py hello_world_wf --name Flyte

view raw JSON →