Skip to main content

jinja2 template renderer

Project description


jiren is an application that generates text from a template. The format of the template is based on jinja2.

PyPI PyPI - Python Version Python Tests codecov

Read this in Japanese: 日本語


pip install jiren


Generate text

Generate text from a template using the jiren command. This command can read a template from stdin or files.

An example of reading a template from stdin:


echo "hello, {{ name }}" | jiren -- --name=world


hello, world

An example of reading a template from a file:


cat <<EOF >template.j2
hello, {{ name }}

jiren -i template.j2 -- --name=world


hello, world

In this example, the template contains a variable called name. You can set values for variables in a template using program arguments passed to the jiren command. Note that the arguments for the variables must be located after --.

If you want to know more about template format, please refer to jinja2 document ( ).

Variables in a template

You can use the help to check the variables defined in a template.


echo "{{ greeting }}, {{ name }}" | jiren -- --help


... (omitted)

  --name NAME
  --greeting GREETING

Default values

You can set default values for variables for which no values was specified. This is based on the jinja2 specification.


echo "{{ greeting }}, {{ name | default('world') }}" | jiren -- --greeting=hello


hello, world

Option: required

When using the --required option, you must specify values for all variables.


echo "{{ greeting }}, {{ name }}" | jiren --required -- --greeting=hello


... (omitted)

jiren: error: the following arguments are required: --name

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

jiren-0.3.1.tar.gz (4.0 kB view hashes)

Uploaded source

Built Distribution

jiren-0.3.1-py3-none-any.whl (4.4 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page