Add support for Parameters of type enum
It'd be great if we had support for enum parameters.
Here is how we would define a Parameter today:
action = Parameter(
"action",
help="The action you want to perform. Supported values are 'traffic' and 'labeling'.",
default="traffic"
)
Notice how we need to rely on documentation to let the user know which values are supported. We also need to validate as part of the flow that the supplied value is supported.
Instead, it would be great to do something like this:
action = Parameter(
"action",
help="The action you want to perform.",
type="enum",
values=["traffic", "labeling"],
default="traffic"
)
Metaflow could automatically validate the value of the parameter and we won't have to do that as part of the flow.
that's a neat proposal. we will discuss internally and get back to you!
Maybe even allow arbitrary types, so that you can just:
action = Parameter(
"action",
help="The action you want to perform.",
type=Literal["traffic", "labeling"]
default="traffic"
)
If you make Parameter a generic you could even have full type hint / check support
Bumping this up for consideration.