You want to fill data into a template file?
tpl --yaml data.yaml template.file > rendered.file
You have everything already set up in your environment and now you just want to POST it somewhere?
tpl structure.json \
| curl \
-X POST \
-H "Content-Type: application/json" \
-d@- \
httpbin.org/anything
You want to fill in a template in your CD pipeline and have access to docker?
echo "My go-to editor is {{VISUAL}} on {{OS}}" \
| docker run --rm -i -e "VISUAL" -e "OS=$(uname)" m3t0r/tpl -
Installation
pip install tpl, docker pull M3t0r/tpl or make install
Input sources
- tpl supports multiple sources:
YAML files (--yaml <file>)
JSON files (--json <file>)
environment variables (--environment)
You can specify multiple sources at once, but if a key is present in more than one then it’s value will be taken from the latter source. This can be useful if you have default values that you want to always be present:
tpl \
--yaml defaults.yaml \
--json <(curl -H "Content-Type: application/json" now.httpbin.org) \
template.jinja2 > results.html
Usage
Usage:
tpl [options] <template_file>
tpl --help
tpl --version
tpl uses the Jinja2 templating engine to render it's output. You can find the
documentation for template designers at:
http://jinja.pocoo.org/docs/latest/templates/
If you provide multiple data sources they will be merged together. If a key is
present in more than one source the value of the source that was specified
last will be used. Nested objects will be merged with the same algorithm.
Options:
-e, --environment Use all environment variables as data
--json=<file> Load JSON data from a file or STDIN
--yaml=<file> Load YAML data from a file or STDIN
Metadata
Release files for tpl 0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tpl-0.10.tar.gz | 23.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tpl-0.10-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.8 kB
Release files / tpl-0.10.tar.gz
| Download URL | tpl-0.10.tar.gz |
|---|---|
| Size | 23.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c5d056377fbd19c5776cf1dd34c876eb34fba39d0443657252c0582b7fbc8f0
|
|
BLAKE2b-256 checksum How to use checksums |
68d20f23e102352b3a15949e74c3a32de7b1ed64053b6bb357114ed826b79352
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|
Release files / tpl-0.10-py3-none-any.whl
| Download URL | tpl-0.10-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c428af6ef28ea86e8a9b6d856531cfffc4520a1a4beabec20ecb566cb0d3823
|
|
BLAKE2b-256 checksum How to use checksums |
a6e7347a8227671d1bc04ccf8ce941cdce57dd8b416cad89214305a086d73b5e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|