Augment your YAML with Jinja
__platform__
__version__
__file__
Path
wkdir()
parent_dir(path)
concat(str1, str2)
env(var)
__platform__
{{ __platform__ }}
returns the operating system on which your project is running. It’s
identical to sys.platform. You probably won’t use this much in your projects.Example:__version__
{{ __version__ }}
returns the Python version on which your project is running, in
the format "{major}.{minor}.{micro}"
. As with __platform__
, you probably won’t use
this much in your projects.Example:__file__ and Path
{{ __file__ }}
allows you to access the the path to the YAML file.{{ Path(...) }}
allows you convert any string to a pathlib
Path object. When using this Jinja
function, users also get access to Path’s methods and operators.{{ __file__ }}
and {{ Path(...) }}
can be used together to define relative paths.Example:wkdir()
{{ wkdir() }}
allows you to access the current project directory as a string. This is a
less powerful alternative to {{ Path(__file__) }}
.Example:parent_dir()
{{ parent_dir(path) }}
computes the parent path of path as a string. This is a less
powerful alternative to {{ Path(__file__).parent }}
.Example:concat()
{{ concat(str1, str2) }}
concatenates str1 and str2 together and returns the
output as a string.Example:env()
{{ env(var) }}
returns the environment variable var. This is probably the most
useful Jinja function.Example: