A YAML template engine with Python expressions
Project description
YTE - A YAML template engine with Python expressions
YTE is a template engine for YAML format that utilizes the YAML structure in combination with Python expressions for enabling to dynamically build YAML documents.
The key idea of YTE is to rely on the YAML structure to enable conditionals, loops and other arbitrary Python expressions to dynamically render YAML files.
Python expressions are thereby declared by prepending them with a ?
anywhere in the YAML.
Any such value will be automatically evaluated by YTE, yielding plain YAML as a result.
Importantly, YTE templates are still valid YAML files (for YAML, the ?
expressions are just strings).
Documentation of YTE can be found at https://yte-template-engine.github.io.
Comparison with other engines
Lots of template engines are available, for example the famous generic jinja2. The reasons to generate a YAML specific engine are
- The YAML syntax can be exploited to simplify template expression syntax, and make it feel less foreign (i.e. fewer special characters for control flow needed) while increasing human readability.
- Whitespace handling (which is important with YAML since it has a semantic there) becomes unnecessary (e.g. with jinja2, some tuning is required to obtain proper YAML rendering).
Of course, YTE is not the first YAML specific template engine. Others include
The main difference between YTE and these two is that YTE extends YAML with plain Python syntax instead of introducing another specialized language. Of course, the choice is also a matter of taste.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file yte-1.5.4.tar.gz
.
File metadata
- Download URL: yte-1.5.4.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.9.18 Linux/6.2.0-1018-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2d77e53eafca74f58234fcd3fea28cc0a719e4f3784911511e35e86594bc880 |
|
MD5 | e272154166df82400e7090a7c9476241 |
|
BLAKE2b-256 | 584b3f89f96417e4e39c3f3e3f4a17d6233e81dc1e5cd5b5ed0a2498faedf690 |
File details
Details for the file yte-1.5.4-py3-none-any.whl
.
File metadata
- Download URL: yte-1.5.4-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.9.18 Linux/6.2.0-1018-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14ccfcb57d60b7652041b606129851423805140b22f52f5152f7c2692cd7b905 |
|
MD5 | 41670f117597e9cf6c58adbbc77ea2da |
|
BLAKE2b-256 | 156497df1886abf11291e9a18b1672b2b79eb940499263c85339a1645d870600 |