Skip to main content

CLI renderer for Jinja2

Project description

jinplate

Code style: black linting: pylint

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.yml
file:////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

jinplate-0.0.2.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jinplate-0.0.2-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file jinplate-0.0.2.tar.gz.

File metadata

  • Download URL: jinplate-0.0.2.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for jinplate-0.0.2.tar.gz
Algorithm Hash digest
SHA256 199400b14d97a353ff7cf975982cdda136796fe4c45583b751fdc1e37abf7d9e
MD5 1140b230afceaa9d4bc61b78c5a0a03b
BLAKE2b-256 d08019f942723e86c176f4bedeab41fef1bc765694f33e5f1ce0f914efd3916b

See more details on using hashes here.

File details

Details for the file jinplate-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: jinplate-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for jinplate-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 822208baeadcfb4728fa0aae770104b6df5c17c41f3ca7b21ca2db98e25d3270
MD5 4eaaa19f587a44fec68a22d7ae08e1a3
BLAKE2b-256 19139d2bc971705f71985720a4618af80f5b0818799477e1817a338b98024a14

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page