Read and evaluate YAML files or search for a certainYAML entry

Hi SG-Community ,

I am looking for a way to load a config’s full set YAML files into a python dict. The reason I am asking is to get a quick overview of a pipeline configuration. Working for different clients that manage their own shotgun configs with multiple projects, can become quite hard to oversee when not knowing the yaml values and the yaml file locations. Hence I am looking for way to either load them all in at once or query for a specific setting or entry (Ideally with knowing where the yaml file came from).

Specifically I am wondering about the following:
1.) How do tk-apps retrieve their settings from a set of relevant yaml files ? Could you point me to the code ? Is there a yaml.loads() call somewhere when an app is launching ?

2.) If I have a ‘resolved’ yaml for my setting or certain piece of configuration e.G.

 settings.tk-multi-publish2.nuke.shot_step:
  collector: "{self}/collector.py:{config}/tk-multi-publish2/nuke/collector.py"

Is there a way of knowing where the yaml entries are defined, which are higher up the hierarchy ? for example

# get file the location of settings.yml or 
# get file the location where settings: are defined
 settings.tk-multi-publish2.nuke.shot_step:
  collector: "{self}/collector.py:{config}/tk-multi-publish2/nuke/collector.py"

Thanks
Stu

3 Likes

Hi @sogrday

Unfortunately there are no guarantees when it comes to the order in which includes are evaluated.

Some useful coding resources:

If you can give us a better idea of what you’re hoping to achieve, we can give more directed advice.

2 Likes