Skip to main content

Getting started

This page will guide you through setting up and running Plugins for Tasks and Types, a Python project.

Prerequisites

Ensure you have Python installed on your system.

  • Python: >=3.10
  • Operating Systems: Linux, macOS, Windows

Install

The recommended way to install flyte is using uv.

  1. Install uv: If you don't have uv installed, you can get it with pip:

    pip install uv

    Alternatively, follow the instructions on the uv website.

  2. Install flyte: Once uv is installed, you can install the flyte package:

    uv pip install flyte

Hello world

Let's create a simple Flyte task and run it locally.

  1. Create a Python file (e.g., my_app.py):

    import flyte
    import asyncio

    @flyte.task
    def greet(name: str) -> str:
    """A simple task that greets the given name."""
    return f"Hello, {name}!"

    async def main_flow():
    # Initialize Flyte locally
    flyte.init()
    # Run the task and print its output
    result = await flyte.run(greet, name="Flyte User")
    print(result)

    if __name__ == "__main__":
    asyncio.run(main_flow())
  2. Run the application: Execute the script using uv run python:

    uv run python my_app.py

    You should see the output:

    Hello, Flyte User!

Verify

To ensure your installation is working correctly and all dependencies are met, you can run the project's unit tests.

  1. Install development dependencies: The unit tests require additional development dependencies. Install them using uv:

    uv pip install "flyte[dev]"
  2. Run unit tests: Use the provided Makefile to run the unit tests:

    make unit_test

    You should see output indicating the tests are running and their results.

Other install options

Besides uv, you can also install flyte using pip or pipx.

  • Using pip:

    pip install flyte
  • Using pipx (for CLI-only usage):

    pipx install flyte

Troubleshooting

  • Python version mismatch: If you encounter errors during installation related to Python versions, ensure your Python environment meets the >=3.10 requirement. You can check your version with python --version.
  • uv command not found: If uv is not recognized, make sure it's installed and its installation directory is in your system's PATH.
  • make command not found: The make unit_test command requires make to be installed. On Windows, you might need to install a build toolchain like MinGW or use a Linux subsystem.