Getting Started

Installation

python3 -m pip install enyaml

Writing a Simple Template

Here is a simple example template. Save this file to helloworld.yaml to run the example code below.

1---
2!set
3name: Guido
4greeting: Hello
5
6---
7foo: bar
8mygreeting: !$f "{greeting}, {name}!"

Rendering a Template

To render the template, simply run enyaml with the filename as the argument:

enyaml helloworld.yaml

The following output should be produced:

foo: bar
mygreeting: Hello, Guido!

Rendering Within Python

>>> import enyaml

>>> ctx = enyaml.Context()
>>> enyaml.render(open(filename), ctx)   # filename = 'helloworld.yaml'
{'foo': 'bar', 'mygreeting': 'Hello, Guido!'}

Next Steps

Once you have ENYAML installed, you can get started writing templates. See Template Syntax to learn how.