Skip to main content

Python command-line tool to generates text files based on Jinja2 template and YAML data file.

Project description

Python

JINJACRAFT

JinjaCraft is a simple Python command-line tool which can generate text file based on a Jinja2 template and a YAML data file.

Requirements

Python 3.9 or higher

Installation

pip install jinjacraft

Usage

usage: jinjacraft [-h] [-o OUTPUT_FILE] data_file template_file

positional arguments:
  data_file             Yaml data file path
  template_file         Jinja2 template file path

options:
  -h, --help            show this help message and exit
  -o OUTPUT_FILE, --output_file OUTPUT_FILE
                        Output file path

Example

YAML file

title: Hello World
tasks:
  - name: First task
    completed: True
  - name: Second task
    completed: False

Template file

Document: {{ title }}
Tasks:
{% for task in tasks %}- {{ task.name }} ({% if task.completed %}completed{% else %}not completed{% endif %})
{%  endfor %}

Command line

jinjacraft data.yaml template.jinja2 -o outputfile.txt

Output file content

Document: Hello World
Tasks:
- First task (completed)
- Second task (not completed)

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

jinjacraft-1.3.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

jinjacraft-1.3.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file jinjacraft-1.3.0.tar.gz.

File metadata

  • Download URL: jinjacraft-1.3.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jinjacraft-1.3.0.tar.gz
Algorithm Hash digest
SHA256 52aab84e47e7fa49fb1d25eee76654058df7d07ec66197e8260fb3c39910e4ba
MD5 e9edbf921310b3ffefd9ae2658fef0f6
BLAKE2b-256 835424ee7dbf9e792289d5b8557d00783b2bd634379dee254d61a4dd3dabac59

See more details on using hashes here.

Provenance

The following attestation bundles were made for jinjacraft-1.3.0.tar.gz:

Publisher: release.yml on sdejongh/jinjacraft

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jinjacraft-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: jinjacraft-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jinjacraft-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d4593cc8fdd6a4fa744ec4cf04a17094e2939db53d85cb6edede151b918a5910
MD5 30ae159ea58a73e2dbf823bbf5a2bf98
BLAKE2b-256 cca96cc8e1fb5d83caf4c8489cc6166311528af0d571b676d22df7d3b90ad366

See more details on using hashes here.

Provenance

The following attestation bundles were made for jinjacraft-1.3.0-py3-none-any.whl:

Publisher: release.yml on sdejongh/jinjacraft

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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