Tutorial: Your First Pipeline¶
This tutorial walks you through building and running a complete FlowerPower pipeline from scratch. By the end you will have a project, a pipeline that computes a greeting, and the result printed to your terminal.
Every snippet below was executed against FlowerPower 0.34.1 and is copy-pasteable.
What you should already know
Basic Python. You don't need to know Hamilton beforehand — the one pattern you need is explained in Step 3.
Prerequisites¶
- Python 3.11 or newer (
python --version). - FlowerPower installed:
uv pip install flowerpower(see Installation).
1. Create a project¶
A FlowerPower project is a directory with a conf/ folder (configuration) and a
pipelines/ folder (your code). Create one with the CLI:
…or with Python:
This produces the standard layout:
.new() creates, .load() opens
FlowerPowerProject.new(...) creates a new project.
FlowerPowerProject.load(...) opens an existing one. The two are not
interchangeable.
2. Create a pipeline¶
A pipeline is a Python module plus a YAML config. Scaffold both at once:
…or:
This writes pipelines/hello.py (your logic) and conf/pipelines/hello.yml
(its configuration).
3. Write the pipeline¶
Open pipelines/hello.py and replace its contents with:
How parameters connect to functions¶
FlowerPower turns the params: block in your YAML into Hamilton
@parameterize(...) arguments and exposes them as PARAMS. The rule is
simple:
Each params key matches the function it feeds, and its value is that function's keyword arguments.
Because PARAMS is a plain dictionary, you access entries with dictionary
syntax: PARAMS["greeting_message"] — not PARAMS.greeting_message.
Hamilton reads each function's signature to wire the DAG. full_greeting takes
greeting_message and target_name as inputs, so Hamilton calls the two
@parameterized functions first and feeds their outputs into full_greeting.
You never call these functions yourself.
4. Configure the pipeline¶
Open conf/pipelines/hello.yml and set the parameters and the output you want:
params holds values injected into your functions; run.final_vars lists which
nodes to compute and return.
5. Run it¶
From the CLI¶
From Python¶
Either way, you get:
🎉 You just built and ran a FlowerPower pipeline.
Override values at run time¶
You don't have to edit YAML to change a value. Pass overrides as kwargs (they win over the file):
Where to go next¶
- See the DAG you just built:
flowerpower pipeline show-dag hello. - Configure execution (executors, retry, caching): read Configuration & Concepts.
- Reuse nodes across pipelines with
additional_modules: see Compose Multiple Modules. - Run inside an event loop: see Asynchronous Execution.
- Track runs with the Hamilton Tracker / MLflow: see Use Adapters.
- Every command and flag: the CLI reference.