Creating a Flyte Project#

So far we’ve been dealing with fairly simple workflows composed of a handful of tasks, all of which can fit into a single Python script. In this guide, you’ll learn how to organize a Flyte project so that it can scale to a larger codebase.


A Flyte project is essentially a directory containing workflows, internal Python source code, configuration, and other artifacts needed to package up your code so that it can be run on a Flyte cluster.

pyflyte, the CLI tool that ships with flytekit, comes with an init command that you can use to quickly initialize a Flyte project according to the recommended file structure.

pyflyte init my_project
cd my_project
git init  # initialize a git repository

Project Structure#

If you examine my_project, you’ll see the following file structure:

├── Dockerfile        # Docker image
├──   # Docker build helper script
├── requirements.txt  # Python dependencies
└── workflows
    └──    # Example Flyte workflows


You can create your own conventions and file structure for your Flyte projects. The pyflyte init command simply provides a good starting point.

In the rest of this guide we’ll orient you to all the important pieces of the minimal Flyte project template.

Create a Virtual Environment#

We recommend creating a virtual environment for your Flyte project so you that you can isolate its dependencies:

python -m venv ~/venvs/my_project
source ~/venvs/my_project/bin/activate
pip install -r requirements.txt


You can also use other tools like miniconda to create a virtual environment.

Example Workflows#

The workflows/ module contains a simple set of tasks and workflows that you can use to make sure that everything’s working as expected:

python workflows/

Expected output

Running wf() DefaultNamedTupleOutput(o0='hello passengers!', o1=17)

Python Dependencies#

You can specify additional Python dependencies in your project by updating the requirements.txt file. This gives you the flexibility to use any pip-installable package that your project may need.


We recommend using pip-compile to manage the requirements of your project.


The minimal Flyte project ships with a Dockerfile that defines the system requirements for running your tasks and workflows. You can customize this image to suit your needs:

What’s Next?#

In summary, this guide took you through the recommended way of initializing and structuring a larger Flyte codebase. In the next guide, we’ll walk through how to package and register your tasks and workflows so that they can be executed on a Flyte cluster.