Setup a Project#

Prerequisites#

Make sure you have git and python >= 3.7 installed.

Start a new project#

Create a virtual environment :

python -m venv ~/venvs/flyte
source ~/venvs/flyte/bin/activate

Then install Flytekit on it:

pip install flytekit

Then run pyflyte init <project_name>, where <project_name> is the directory that will be created containing the scaffolding for a flyte-ready project. For this guide we’re going call it my_flyte_project:

pyflyte init my_flyte_project
cd my_flyte_project

The my_flyte_project directory comes with a sample workflow, which can be found under flyte/workflows/example.py. The structure below shows the most important files and how a typical Flyte app should be laid out.

Run the Workflow Locally#

The workflow can be run locally, simply by running it as a Python script:

python flyte/workflows/example.py

Note

The workflow needs to be invoked after the if __name__ == "__main__" entrypoint at the bottom of flyte/workflows/example.py.

Expected output:

Running my_wf() hello world

Conclusion#

We’ve successfully created a Flyte project and executed your workflows on a python runtime environment! 🎉 Next, let’s learn how to deploy to the cloud.

Total running time of the script: ( 0 minutes 0.000 seconds)

Gallery generated by Sphinx-Gallery