Awesome Open Source
Awesome Open Source

$ jinja2

A CLI interface to Jinja2

$ jinja2 helloworld.tmpl data.json --format=json
$ cat data.json | jinja2 helloworld.tmpl
$ curl -s | jinja2 helloip.tmpl
$ curl -s | jinja2 helloip.tmpl > helloip.html


$ pip install jinja2-cli


Usage: jinja2 [options] <input template> <input data>

  --version             show program's version number and exit
  -h, --help            show this help message and exit
  --format=FORMAT       format of input variables: auto, ini, json,
                        querystring, yaml, yml
                        extra jinja2 extensions to load
  -D key=value          Define template variable in the form of key=value
  -s SECTION, --section=SECTION
                        Use only this section from the configuration
  --strict              Disallow undefined variables to be used within the

Optional YAML support

If PyYAML is present, you can use YAML as an input data source.

$ pip install jinja2-cli[yaml]

Optional TOML support

If toml is present, you can use TOML as an input data source.

$ pip install jinja2-cli[toml]

Optional XML support

If xmltodict is present, you can use XML as an input data source.

$ pip install jinja2-cli[xml]


  • Variable inheritance and overrides
  • Tests!

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Python (1,127,193
Cli (15,169
Xml (3,727
Yaml (2,008
Jinja2 (543
Toml (301
Related Projects