Generate entire directory structures using Jinja templates with support for external data and custom plugins.
Project description
makejinja
PyPI | Docker | Docs | Example | Jinja reference
Generate entire directory structures using Jinja templates with support for external data and custom plugins.
makejinja
makejinja can be used to automatically generate files from Jinja templates. It is conceptually similar to Ansible templates since both are built on top of Jinja. However, makejinja is a standalone tool that can be used without Ansible and offers some advanced features like custom plugins. A use case for this tool is generating config files for Home Assistant: Using the same language that the built-in templates use, you can greatly simplify your configuration. An example for Home Assistant can be found in the tests directory.
Highlights
- Recursively render nested directories containing template files to a common output directory.
- Load data files containing variables to use in your Jinja templates from YAML, TOML, and Python files.
- Write custom plugins to extend the functionality of makejinja.
- Adjust all Jinja options (e.g., whitespace behavior and delimiters) to your needs via CLI flags or a config file.
Installation
The tool is written in Python and can be installed via pip, nix, and docker. It can be used as a CLI tool or as a Python library.
PIP
makejinja is available on PyPI and can be installed via pip
:
pip install makejinja
makejinja -i ./input -o ./output
Nix
If you use the nix
package manager, you can add this repository as an input to your flake and use makejinja.packages.${system}.default
or apply the overlay makejinja.overlays.default
.
You can also run it directly as follows:
nix run github:mirkolenz/makejinja -- -i ./input -o ./output
Docker
We automatically publish an image to the GitHub Container Registry. To use it, mount a directory to the container and pass the options as the command:
docker run --rm -v $(pwd)/data:/data ghcr.io/mirkolenz/makejinja:latest -i /data/input -o /data/output
Usage in Terminal / Command Line
In its default configuration, makejinja searches the input directory recursively for files ending in .jinja
.
It then renders these files and writes them to the output directory, preserving the directory structure.
Our documentation contains a detailed description of all options and can also be accessed via makejinja --help
.
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file makejinja-2.7.0.tar.gz
.
File metadata
- Download URL: makejinja-2.7.0.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ec6648605df64f724f1f0fc464355b3fb05c81e5209b97e0872180ed6ff8917 |
|
MD5 | decae6e90a99ea500252d3499f50c44d |
|
BLAKE2b-256 | 370021f3a26cee4fee35d4220b80f77e60f9ca2a738864bf3294abc13f7b50fa |
Provenance
The following attestation bundles were made for makejinja-2.7.0.tar.gz
:
Publisher:
release.yml
on mirkolenz/makejinja
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
makejinja-2.7.0.tar.gz
- Subject digest:
4ec6648605df64f724f1f0fc464355b3fb05c81e5209b97e0872180ed6ff8917
- Sigstore transparency entry: 148840582
- Sigstore integration time:
- Predicate type:
File details
Details for the file makejinja-2.7.0-py3-none-any.whl
.
File metadata
- Download URL: makejinja-2.7.0-py3-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba0d0da20e90824643fe550f9078c391c469d2013f6755f6347d83d969912265 |
|
MD5 | 4e0750efb80bc345815dc0e44f2d7ff7 |
|
BLAKE2b-256 | b0a6120880d2b35a5b84d69a36ee8d44b6a2a2917ec6a537d3948e0f1e7cbfa5 |
Provenance
The following attestation bundles were made for makejinja-2.7.0-py3-none-any.whl
:
Publisher:
release.yml
on mirkolenz/makejinja
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
makejinja-2.7.0-py3-none-any.whl
- Subject digest:
ba0d0da20e90824643fe550f9078c391c469d2013f6755f6347d83d969912265
- Sigstore transparency entry: 148840588
- Sigstore integration time:
- Predicate type: