Skip to main content

Generate entire directory structures using Jinja templates with support for external data and custom plugins

Project description

makejinja

makejinja logo

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

makejinja-2.7.2.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

makejinja-2.7.2-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file makejinja-2.7.2.tar.gz.

File metadata

  • Download URL: makejinja-2.7.2.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for makejinja-2.7.2.tar.gz
Algorithm Hash digest
SHA256 64f2c1042329657443abe7610750fc0da20dfd62d3b50f1f8286008df26ab334
MD5 ff2a4ef21d2f5b4df82e0d2033ce0b93
BLAKE2b-256 716856e155a7e38b8aa69446ee749832dda13fd4e29d2bfd5b3ad5de1e766565

See more details on using hashes here.

Provenance

The following attestation bundles were made for makejinja-2.7.2.tar.gz:

Publisher: release.yml on mirkolenz/makejinja

Attestations:

File details

Details for the file makejinja-2.7.2-py3-none-any.whl.

File metadata

  • Download URL: makejinja-2.7.2-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for makejinja-2.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2e54a5814416cdb1ff1032287d1a95c338e0deafc6ceaed26ea3587de98bd1d9
MD5 4872834c1fcd87ebf2c92960061b8871
BLAKE2b-256 a6a188d41dcbfac628a48d9b7a9c253542fb09b6f43c65e54bb23da8c3f735a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for makejinja-2.7.2-py3-none-any.whl:

Publisher: release.yml on mirkolenz/makejinja

Attestations:

Supported by

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