Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bmritz/dryyaml

Repository files navigation

DryYAML

Documentation Status Updates

A way to completely stop repeating yourself in YAML configs.

Installation

To install dryyaml, use pip:

$ pip install dryyaml

How it works

A DryYAML config file is like a regular YAML config file, plus Jinja2 variables and expressions. DryYAML transforms a DryYAML config file into plain vanilla YAML by passing the parsed YAML above each line of code to Jinja as the context under which each line in the DryYAML template is rendered.

An example might help sort that out. Here is some example DryYAML with a simple jinja variable:

node1: val1
node2:
  subnode1: subval1
  subnode2: {{ node1 }}

And here is what that would look like after running it through DryYAML:

$ dryyaml -f test-yaml.yaml
node1: val1
node2:
  subnode1: subval1
  subnode2: val1

Features

  • Write YAML with Jinja2 variables and expressions included to give more control
  • The context dictionary passed to the template at any point in the YAML file is the parsed YAML above that YAML line.
  • DryYAML is a superset of YAML. Vanilla YAML will be parsed by DryYAML as expected.
  • Hide parent nodes from the final YAML output by starting the keys with _

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

About

A way to completely stop repeating yourself in YAML configs.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published