Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Parameters of type enum #2117

Open
svpino opened this issue Oct 24, 2024 · 1 comment
Open

Add support for Parameters of type enum #2117

svpino opened this issue Oct 24, 2024 · 1 comment

Comments

@svpino
Copy link

svpino commented Oct 24, 2024

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.

@savingoyal
Copy link
Collaborator

that's a neat proposal. we will discuss internally and get back to you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants