omry / omegaconf

Flexible Python configuration system. The last one you will ever need.
BSD 3-Clause "New" or "Revised" License
1.94k stars 105 forks source link

[Question] - How does OmegaConf treat dot config. Is `a.b.c: 1` treated as a flat key or nested one? #1189

Closed noklam closed 1 month ago

noklam commented 1 month ago

This is a clarification question as we use OmegaConf to support our configuration system.

Omegaconf support an API with . syntax, i.e. Omegaconf.select("a.b.c"). This implicitly assume that the internal dictionary is a nested dictionary.

For this example

conf = {"a.b.c": 1}
omega_conf = Omegaconf.create(conf)
omega_conf.select("a.b.c") # Return nothing
omega_conf["a.b.c"] # Return 1

Is using nested . key discouraged with OmegaConf or is this a bug? I cannot find any example in the docs so I am raising this issue.

In case flat key is a bad practice, would you be open to support OmegaConf.create converts flat key to nested dict automatically?

odelalleau commented 1 month ago

This isn't a bug. I'll follow-up in #1188 to avoid duplicated discussions.