flyte

module
v2.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2026 License: Apache-2.0

README

Flyte 2

Reliably orchestrate ML pipelines, models, and agents at scale — in pure Python.

Version Python License Try in Browser Docs SDK Reference CLI Reference

Install

uv pip install flyte

For the full SDK and development tools, see the flyte-sdk repository.

Example

import asyncio
import flyte

env = flyte.TaskEnvironment(
    name="hello_world",
    image=flyte.Image.from_debian_base(python_version=(3, 12)),
)

@env.task
def calculate(x: int) -> int:
    return x * 2 + 5

@env.task
async def main(numbers: list[int]) -> float:
    results = await asyncio.gather(*[
        calculate.aio(num) for num in numbers
    ])
    return sum(results) / len(results)

if __name__ == "__main__":
    flyte.init()
    run = flyte.run(main, numbers=list(range(10)))
    print(f"Result: {run.result}")
PythonFlyte CLI
python hello.py
flyte run hello.py main --numbers '[1,2,3]'

Serve a Model

# serving.py
from fastapi import FastAPI
import flyte
from flyte.app.extras import FastAPIAppEnvironment

app = FastAPI()
env = FastAPIAppEnvironment(
    name="my-model",
    app=app,
    image=flyte.Image.from_debian_base(python_version=(3, 12)).with_pip_packages(
        "fastapi", "uvicorn"
    ),
)

@app.get("/predict")
async def predict(x: float) -> dict:
    return {"result": x * 2 + 5}

if __name__ == "__main__":
    flyte.init_from_config()
    flyte.serve(env)
PythonFlyte CLI
python serving.py
flyte serve serving.py env

Local Development Experience

Install the TUI for a rich local development experience:

uv pip install flyte[tui]

Watch the local development experience

Try the hosted demo in your browser — no installation required.

Open Source Backend

The open source backend for Flyte 2 is coming soon. This repository will contain the Kubernetes-native backend infrastructure for deploying Flyte 2 as a distributed, multi-node service. See the Backend README for the current state of the backend, protocol buffer definitions, and contribution guide.

If you need an enterprise-ready, production-grade backend for Flyte 2 today, it is available on Union.ai.

Learn More

Contributing

We welcome contributions! See the Backend README for backend development, or join us on slack.flyte.org.

License

Apache 2.0 — see LICENSE.

Directories

Path Synopsis
cmd command
k8s
cmd command
cmd command
cmd command
api/v1
Package v1 contains API Schema definitions for the flyte.org v1 API group.
Package v1 contains API Schema definitions for the flyte.org v1 API group.
cmd command
pkg/webhook
Package webhook contains PodMutator.
Package webhook contains PodMutator.
cmd
data
This module contains Flyte CoPilot related code.
This module contains Flyte CoPilot related code.
flyteidl2
clients/go/coreutils
Contains convenience methods for constructing core types.
Contains convenience methods for constructing core types.
flyteplugins
go/tasks/aws
Package aws contains AWS-specific logic to handle execution and monitoring of batch jobs.
Package aws contains AWS-specific logic to handle execution and monitoring of batch jobs.
go/tasks/pluginmachinery/core/template
Package template exports the Render method Render Evaluates templates in each command with the equivalent value from passed args.
Package template exports the Render method Render Evaluates templates in each command with the equivalent value from passed args.
go/tasks/pluginmachinery/flytek8s/config
Package config contains configuration for the flytek8s module - which is global configuration for all Flyte K8s interactions.
Package config contains configuration for the flytek8s module - which is global configuration for all Flyte K8s interactions.
go/tasks/pluginmachinery/ioutils
Package ioutils contains utilities for interacting with the IO Layer of FlytePropeller Metastore For example, utilities like reading inputs, writing outputs, computing output paths, prefixes.
Package ioutils contains utilities for interacting with the IO Layer of FlytePropeller Metastore For example, utilities like reading inputs, writing outputs, computing output paths, prefixes.
go/tasks/pluginmachinery/k8s
Simple implementation of a KubeClient that caches reads and falls back to make direct API calls on failure.
Simple implementation of a KubeClient that caches reads and falls back to make direct API calls on failure.
go/tasks/pluginmachinery/webapi
Defines the interfaces to implement to add a Web API Plugin (AsyncPlugin and SyncPlugin) to the Flyte system.
Defines the interfaces to implement to add a Web API Plugin (AsyncPlugin and SyncPlugin) to the Flyte system.
flytestdlib
bitarray
Contains efficient array that stores small-range values (up to uint64) in a bit array to optimize storage.
Contains efficient array that stores small-range values (up to uint64) in a bit array to optimize storage.
config
A strongly-typed config library to parse configs from PFlags, Env Vars and Config files.
A strongly-typed config library to parse configs from PFlags, Env Vars and Config files.
contextutils
Package contextutils contains common flyte context utils.
Package contextutils contains common flyte context utils.
errors
Contains utilities to use to create and consume simple errors.
Contains utilities to use to create and consume simple errors.
fastcheck
This package contains implementation for checking if an item has been seen previously.
This package contains implementation for checking if an item has been seen previously.
futures
Package futures implements a simple Async Futures for golang
Package futures implements a simple Async Futures for golang
k8s
logger
Defines global context-aware logger.
Defines global context-aware logger.
pbhash
This is a package that provides hashing utilities for Protobuf objects.
This is a package that provides hashing utilities for Protobuf objects.
promutils
Source: https://raw.githubusercontent.com/kubernetes/kubernetes/3dbbd0bdf44cb07fdde85aa392adf99ea7e95939/pkg/util/workqueue/prometheus/prometheus.go
Source: https://raw.githubusercontent.com/kubernetes/kubernetes/3dbbd0bdf44cb07fdde85aa392adf99ea7e95939/pkg/util/workqueue/prometheus/prometheus.go
storage
Package storage defines extensible storage interface.
Package storage defines extensible storage interface.
gen
go/gateway/flyteidl2/connector
Package connector is a reverse proxy.
Package connector is a reverse proxy.
go/gateway/flyteidl2/dataproxy
Package dataproxy is a reverse proxy.
Package dataproxy is a reverse proxy.
go/gateway/flyteidl2/secret
Package secret is a reverse proxy.
Package secret is a reverse proxy.
manager
cmd command
testclient command
cmd command
testclient command
cmd command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL