Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Hydra's override grammar allows quoted resolver args, but OmegaConf does not recognize them #891

Closed
2 tasks done
odelalleau opened this issue Aug 19, 2020 · 0 comments · Fixed by #907
Closed
2 tasks done
Labels
bug Something isn't working
Milestone

Comments

@odelalleau
Copy link
Collaborator

🐛 Bug

Description

Best explained with an example (assume a basic my_app.py that prints the resolved config):

python my_app.py +port='${env:PORT}'     # works, may crash if PORT is not defined
python my_app.py +port='${env:PORT,80}'  # crashes: not recognized by Hydra's grammar
python my_app.py +port='${env:PORT,"80"}'  # accepted by Hydra but OmegaConf does not resolve it

This is because in the current version of OmegaConf, quotes are not allowed inside interpolations.

Checklist

  • I checked on the latest version of Hydra
  • I created a minimal repro

To reproduce

** Minimal Code/Config snippet to reproduce **

from omegaconf import DictConfig, OmegaConf
import hydra

@hydra.main()
def my_app(cfg: DictConfig) -> None:
    print(OmegaConf.to_yaml(cfg, resolve=True))

if __name__ == "__main__":
    my_app()

Then try the examples above.

** Stack trace/error message **

Just showing the last example:

port: ${env:PORT,"80"}

Expected Behavior

Hydra should allow the same characters as OmegaConf.

System information

  • Hydra Version : current master (7afee09)
  • Python version : 3.8.3
  • Virtual environment type and version : conda 4.8.3
  • Operating system : MacOS
@odelalleau odelalleau added the bug Something isn't working label Aug 19, 2020
@omry omry added this to the 1.0.0 milestone Aug 19, 2020
@omry omry closed this as completed in #907 Aug 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants