CLI renderer for Jinja2
Project description
jinplate
A command line Jinja2 renderer inspired by gomplate
jinplate can read from local and remote variable files in a number of formats and use them to render a local Jinja2 template file.
jinplate uses URIs to identify how to fetch and parse Jinja2 variable files.
Installation
pip install jinplate
Usage
jinplate --help
Usage: jinplate [OPTIONS] TEMPLATE_FILE DATASOURCE
A command line renderer for jinja templates
TEMPLATE_FILE is the path to a jinja template file to render
DATASOURCE is the URI of a datasource supported by jinplate that contains
the template variables
Options:
--help Show this message and exit.
Local Vars Example
test.j2
---
key: {{ test1.key }}
arr: {{ test2.arr }}
vars.json
{
"test1": {
"key": "val"
},
"test2": {
"arr": [1, 2, 3]
}
}
jinplate test.j2 "file:///$(pwd)/vars.json"
---
key: val
arr: [1, 2, 3]
Remote Vars example
python -m http.server
jinplate test.j2 "http://127.0.0.1:8000/vars.json"
---
key: val
arr: [1, 2, 3]
Supported Vars File Schemes
| URI Scheme | Plugin | Example |
|---|---|---|
| file | jinplate.plugins.scheme.file |
file:////path/to/vars.yaml |
| http | jinplate.plugins.scheme.http |
http://127.0.0.1:8000/vars.json |
Supported Vars File Types
| File type | Plugin | Example |
|---|---|---|
| json | jinplate.plugins.filetype.json |
http://127.0.0.1:8000/vars.json |
| yaml | jinplate.plugins.filetype.yaml |
http://127.0.0.1:8000/vars.ymlfile:////path/to/vars.yaml |
| dotenv | jinplate.plugins.filetype.dotenv |
file:////path/to/vars.env |
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jinplate-0.0.3.tar.gz.
File metadata
- Download URL: jinplate-0.0.3.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0147c4e536c8a1faf3e6f0a3176285b64c70218a597a4aac7e560db5e66e882b
|
|
| MD5 |
8bb44586438b40c8dd7f69d74ba62c4e
|
|
| BLAKE2b-256 |
d640b75a5171e057db101a678ec7858e6f01606a9a7be733f66acb3af1a102f9
|
File details
Details for the file jinplate-0.0.3-py3-none-any.whl.
File metadata
- Download URL: jinplate-0.0.3-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
835bc80f43251dd1997ff0ad21df08a622f21b2a67aff0e404ac237a2f86eac3
|
|
| MD5 |
cf642fff85be030377f1ef186b381309
|
|
| BLAKE2b-256 |
f35fdd1cadcfe166d266e4b4c7a4633a22beee7a5f079cba32bb9b5a88bd3c66
|