omegaconf icon indicating copy to clipboard operation
omegaconf copied to clipboard

Look into supporting Union in Structured configs

Open omry opened this issue 5 years ago • 16 comments

omry avatar Jan 30 '20 01:01 omry

Bouncing to 2.2.

omry avatar Feb 22 '21 21:02 omry

comments from receipe team:

Does this Union support include the new syntax being introduced (eg. TypeA | TypeB) ?

jieru-hu avatar Dec 17 '21 19:12 jieru-hu

For context, this is the proposal (https://www.python.org/dev/peps/pep-0604/), which is introduced in Python 3.10 (which is now also made available at Meta).

It's a big readability win. I'd say it's of middle-to-low importance for us, but just checking if it'll work with the support here in hydra. I suspect so since I assume Union[A, B, ...] and A | B | ... will translate to the same underlying code, so might be entirely transparent to you.

Thanks for thinking of this!

kandluis avatar Dec 17 '21 19:12 kandluis

Yes, it should be possible to support PEP 604 in structured config type hints.

Jasha10 avatar Dec 17 '21 20:12 Jasha10