https://dagster.io/ logo
#announcements
Title
# announcements
k

Kevin

11/19/2019, 11:15 AM
Is there a nice way to use enums (as strings) in configs? I.e. I'd like to expose several options to the user via a config, e.g. picking one of many algorithms. Those could be identified by a string that is then used for a lookup in a dict. There are two downsides: - Errors (i.e. wrong spelling, option does not exist) are only caught at run time when the actual lookup happens - There's no (easy?) way of showing the options in the nice config editor in dagit
c

Cagatay K

11/19/2019, 2:31 PM
There's
dagster.Enum
and
dagster.EnumValue
in the API; not sure if there's documentation. I saw some example usages in https://github.com/dagster-io/dagster/blob/master/python_modules/dagster/dagster_tests/core_tests/types_tests/test_config_enums.py but there may be better examples I'm missing
👍 2
k

Kevin

11/19/2019, 2:33 PM
Huh, this looks like it's exactly what I'm looking for. Thanks Cagatay
👍 1
a

alex

11/19/2019, 4:11 PM
Good catch @Cagatay K - I will update the API Docs section to include Enums