Florent VanDeMoortele
12/24/2025, 2:31 PMMarvin
12/24/2025, 2:31 PMMarvin
12/24/2025, 2:33 PMfrom typing import Literal
from prefect import flow
@flow
def my_flow(environment: Literal["dev", "staging", "prod"] = "dev"):
# In the UI, 'environment' is a dropdown with the three choices
...
from enum import Enum
from prefect import flow
class Environment(str, Enum):
DEV = "dev"
STAGING = "staging"
PROD = "prod"
@flow
def my_flow(environment: Environment = Environment.DEV):
# In the UI, 'environment' is a dropdown with the three choices
...
Notes:
- The parameter is required if you don’t provide a default; adding a default sets the initial selection in the dropdown.
- For string-valued enums, subclass both str and Enum (as shown) so the schema is typed as a string and renders correctly.
- The choices must be static (defined in code). Dynamic, runtime-populated dropdowns aren’t supported in the Launch form; if you need that, accept a free-form string and validate it inside the flow.
Helpful references:
- Python Literal: typing.Literal
- Python Enum: enum.Enum
- Prefect flows and parameters overview: Prefect Docs (see the Flows/Parameters section)
If you share your current parameter signature, I can suggest the minimal change to make it render as a dropdown.Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.
Powered by