j2y - A Jinja2 CLI
Render Jinja2 templates on the command line using a YAML, JSON or HCL file as input for the render context.
Installation
j2y is installed using pip:
$ pip install j2y
Alternatively you can install directly from Github master branch:
$ pip install git+https://github.com/chaudum/j2y.git@master
Usage
By default, the j2cli command takes a YAML file as input:
$ j2cli template.j2 < values.yaml
Alternatively you can use JSON or HCL as input format:
$ j2cli template.j2 -f json < values.json $ j2cli template.j2 -f hcl < values.hcl
It’s also possible to provide multiple input files:
$ j2cli template.j2 --context v1.yaml --context v2.yaml
Run j2cli -h to see all available options.
Template Variables
Additionally to the variables provided by the input file, j2cli also provides built-in default variables. These variables are:
- meta.date:
Type: datetime
Value: Current UTC datetime object
- meta.platform:
Type: dict
Value: Output of platform.uname()
- env:
Type: dict
Value: All environment variables (output of os.environ).
Local Development
Bootstrapping
Create a virtualenv and install the package as develop egg:
$ python -m venv env $ source env/bin/activate (env) $ pip install -e .
Tests
At the moment there are very simple test cases only. Test are written as Python doctests and run using pytest:
(env) $ pip install -e ".[test]" (env) $ pytest
Pytest additionally runs the black linter and mypy static type checker.
Documentation
The tests located in the docs/ folder can also be built into HTML using Sphinx:
(env) $ sphinx-build -E -W docs/ _build/
Metadata
Release files for j2y 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| j2y-0.3.0.tar.gz | 15.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| j2y-0.3.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 24.8 kB
Release files / j2y-0.3.0.tar.gz
| Download URL | j2y-0.3.0.tar.gz |
|---|---|
| Size | 15.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
62ddf571e107d04f9b2eef77c08a5413d5fd283e255c84b7a15ae604e375872b
|
|
BLAKE2b-256 checksum How to use checksums |
4734bfc50588fa31592151e30b1081e6e0288afa4e7ebbbb19c79479d3d408f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2
|
Release files / j2y-0.3.0-py2.py3-none-any.whl
| Download URL | j2y-0.3.0-py2.py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
c4bce9c384e3e5ea665e8fb13b52d5a504d9dbdb43d62c9d26a44cc37a9e43c6
|
|
BLAKE2b-256 checksum How to use checksums |
d3e6e5d005f70dfc2c1d7f79a7d642717537c9f2afac4f31f3555d3742c698e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2
|
Security for j2y 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.