$ jinja2
The CLI for Jinja2.
$ jinja2 template.j2 data.json
$ curl -s http://api.example.com | jinja2 template.j2
Install
$ uv tool install jinja2-cli
$ pip install jinja2-cli
Formats
Built-in: JSON, INI, ENV, querystring, TOML (Python 3.11+)
Optional formats via extras:
$ pip install jinja2-cli[yaml]
$ pip install jinja2-cli[xml]
$ pip install jinja2-cli[hjson]
$ pip install jinja2-cli[json5]
Features
- Read data from files or stdin
- Define variables inline with
-D key=value - Custom Jinja2 extensions
- Import custom filters - see Custom Filters below
- Full control over Jinja2 environment options
Run jinja2 --help for all options, or see docs/ for full documentation.
Custom Filters
Extend Jinja2 with your own filters or use Ansible's extensive filter library:
# Use custom filters
$ jinja2 template.j2 data.json -F myfilters
# Use Ansible filters
$ jinja2 template.j2 data.json -F ansible.plugins.filter.core
Example filter module:
# myfilters.py
def reverse(s):
return s[::-1]
def shout(s):
return s.upper() + "!"
See docs/filters.md for complete documentation and examples.
Used by
- Dangerzone by Freedom of the Press Foundation
- Elastic Docker images (Logstash, Kibana, Beats)
- ScyllaDB CloudFormation templates
- 800+ more on GitHub
Available in
Learn more
Release files for jinja2-cli 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jinja2_cli-1.0.1.tar.gz | 10.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jinja2_cli-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.2 kB
Release files / jinja2_cli-1.0.1.tar.gz
| Download URL | jinja2_cli-1.0.1.tar.gz |
|---|---|
| Size | 10.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cca3e59494558640af52add7b8636cfa82eba72871a21cbbdc0a6f2000a4e5b7
|
|
BLAKE2b-256 checksum How to use checksums |
91b319afd8cfe9b6664fcc200befbc71a393cbbe343bb76a6acbeff1709d0c83
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / jinja2_cli-1.0.1-py3-none-any.whl
| Download URL | jinja2_cli-1.0.1-py3-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b9ee0875adb8c78490ceb04486ec3a6af1d0ba83ac7e5a7af7f645eb6aa7d655
|
|
BLAKE2b-256 checksum How to use checksums |
3b2f851e062aae3d2cd4d726813f336d55760e193dc28e80b2268f9b952df8bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|