Replies: 3 comments 1 reply
-
Hi @hogru, Currently Hydra does not have an API for getting a list of available config group options at runtime. You could reverse-engineer this CLI completion if you don't mind a text-based solution. Using $ COMP_LINE='python my_app.py db=' python my_app.py -sc query=bash
db=mysql db=postgresql You could do this via a python script using a subprocess: # get_completions.py
import subprocess
import os
stdout = subprocess.run(
["python", "my_app.py", "-sc", "query=bash"],
env={"COMP_LINE": "python my_app.py db=", **os.environ},
capture_output=True
).stdout
print(stdout.decode()) $ python get_completions.py
db=mysql db=postgresql Anyway, feel free to open a feature request for a less-hacky way to get a list of config group options :) |
Beta Was this translation helpful? Give feedback.
-
if you use ConfigStore, you can probably look into using the |
Beta Was this translation helpful? Give feedback.
-
Thank you @jieru-hu. I experimented a bit but without success. I can run
and the result is If you feel I am close and need just another hint, I am happy to get a push in the right direction, and otherwise I will just "copy" the config group options into a global variable. |
Beta Was this translation helpful? Give feedback.
-
Hi, sorry if this is a basic question, I am hydra noob. I have several config groups with the corresponding defaults in config.yaml. So far, so good.
Is there a way that I can access the names of all potential config group options aside from the default config during runtime?
So, following the examples in the documentation, I would have a
db
config group andmysql
is the default. During runtime, can I get a list of all config group options, i.e.,mysql
andpostgresql
?In my case, this is a config group of encodings, of which I use one (the default), but I want to do a bit with the other config group options.
Beta Was this translation helpful? Give feedback.
All reactions