Open tmke8 opened 2 years ago
Cool idea!
A related category of possible typing improvements is more precise use of @typing.overload
for the omegaconf.OmegaConf
methods.
I suspect that such a change would not be backward compatible. For example, currently annotations like this are legal:
cfg: DictConfig = OmegaConf.structured(...)
If we make the change you've proposed, mypy will probably require annotations like this:
cfg: DictConfig[SomeType] = OmegaConf.structured(...)
Since we don't want to break the annotations in existing code, I'll milestone this feature request for OmegaConf 3.0.
This feature would be grate. I'm using OmegaConf with Metaflow. Being able to parse a config file into a structured (read: correct type) config would eliminate a day or two of wokarounds I need to add.
Is your feature request related to a problem? Please describe. The return type of a lot of functions in omegaconf is a union of a lot of types, which makes them not very useful. For example,
to_object
returns aUnion
withAny
, so it's effectivelyAny
.Describe the solution you'd like Proof of concept for a generic
DictConfig
:Describe alternatives you've considered There might be other solutions to the problem of unspecific return types, but I haven't thought of one yet.
Additional context None.