Is there a nice way to use enums (as strings) in c...
# announcements
k
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
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
Huh, this looks like it's exactly what I'm looking for. Thanks Cagatay
👍 1
a
Good catch @Cagatay K - I will update the API Docs section to include Enums