How can I parametrize my flow?

Prefect 2.0

Parameters can be added as input arguments to the main flow function, i.e., function decorated with @flow.

from prefect import flow

@flow
def say_hi(user_name: str):
    print(f"Hi {user_name}!")

if __name__ == "__main__":
    say_hi("Marvin")

Prefect 1.0

Prefect 1.0 uses a special Parameter task. Here is the same example in Prefect 1.0:

from prefect import Flow, Parameter, task

@task
def say_hi(user_name: str):
    print(f"Hi {user_name}!")

with Flow("parameter_example") as flow:
    user = Parameter("user_name", default="Ford")
    say_hi(user)

if __name__ == "__main__":
    flow.run(parameters=dict(user_name="Marvin"))