Reuse a hash in YAML

Try reusing a full group by importing it: Defaults: &defaults Company: foo Item: 123 Computer: <<: *defaults Price: 3000 Documentation: http://yaml.org/type/merge.html

If condition possible in yaml file?

As a supplement to Vaibhav’s response: although yml does not inherently support if statements, some applications that use yml files for instructions may be able to parse if statements included in the yml. GitLab is one notable example. In GitLab’s CI/CD, the .gitlab-ci.yml file can be configured to include if statements such as: job: script: … Read more

ConfigObj/ConfigParser vs. using YAML for Python settings file

It depends on what you want to store in your config files and how you use them If you do round tripping (yaml→code→yaml) and want comments preserved you cannot use PyYAML or ConfigParser. If you want to preserve the order of your keys (e.g. when you check in your config files), PyYAML doesn’t do that … Read more