Skip to main content

Add your description here

Project description

Flyte 2 SDK

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

Version Python License Try in Browser Docs SDK Reference CLI Reference

Install

pip install flyte

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:

pip install flyte[tui]

Watch the local development experience

Learn More

License

Apache 2.0 — see LICENSE.

Project details


Release history Release notifications | RSS feed

This version

2.1.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flyte-2.1.2-py3-none-any.whl (614.6 kB view details)

Uploaded Python 3

File details

Details for the file flyte-2.1.2-py3-none-any.whl.

File metadata

  • Download URL: flyte-2.1.2-py3-none-any.whl
  • Upload date:
  • Size: 614.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for flyte-2.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3356de114e8b70b29f3d29db985d7625e93a56e81773796bae1658320ff82f68
MD5 f31eb2e45960c2eaa8cdd4059aaef9ff
BLAKE2b-256 ae24d00c9274b3c14efa9ad55cc5612f7668466850f22956e5dd3b1fd1058856

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page