facebookresearch/hydra

[Bug][configen] Generates unquoted str defaults when type hints include Optional[ ]

Open

#1.174 geöffnet am 30. Nov. 2020

Auf GitHub ansehen
 (2 Kommentare) (1 Reaktion) (0 zugewiesene Personen)Python (608 Forks)batch import
bugconfigenhelp wanted

Repository-Metriken

Stars
 (7.539 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 37T 6h) (25 gemergte PRs in 30 T)

Beschreibung

🐛 Bug

Almost identical issue to: #1071 except on a new edge case. Configen will create fields typed with Optional[str], but if there's a default value which is a str type, it will not include it in quotes. We should also test other supported Type hint permutations.

Ex: Generates the field weights_summary: Optional[str] = top instead of the desired: weights_summary: Optional[str] = "top"

To reproduce

git clone https://github.com/romesco/hydra-lightning
configen --config-dir=configen/conf

Will create PR similar to #1072 for fix.

System information

  • Hydra Version : configen==0.9.0dev4
  • Python version : 3.8.6
  • Virtual environment type and version : pyenv-virtualenv 1.2.20
  • Operating system : Ubuntu 18.04

Contributor Guide