Skip to main content

YAML glue for structural templating and processing

Project description

Build Status PyPI version

Yglu ᕄ

Yglu is YAML enriched with an advanced expression language. Unlike usual text templating, Yglu relies on the YAML structure and leverage its typing features combined with the YAQL query language.

This association enables templating and functional processing a bit like if YAML nodes where spreadsheet cells.

Yglu input documents are pure YAML using tags for computed nodes.

input
a: 1
b: ?! $.a + 1  
output
a: 1
b: 2  

See the test samples for more examples.

Install

pip install yglu

Run

Usage: yglu [options] [<filename>]

Options:
  -v - -version          Print version and exit.
  -h - -help             Print help and exit.

Tags

Tags specify an alteration of the structure of the document.

Tag    Description
!? Replace the node value with the result of an expression
!- Hide the node in the output but keep it accessible from expressions. If the node value is a string, it is replaced with the result of the expression.
!() Make the node reusable in expressions as a function. It is also hidden.

Expressions

Expressions are written in YAQL.

They receive a context with predefined variables.

Variable Description
$ Refers to the document root, or implicit argument in function blocks.
$_ Always refers to the document root. So that the root is accessible from functions. Will be available in version 0.3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yglu-0.2.0.tar.gz (4.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page