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.

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.2.0.tar.gz (3.5 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.2.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jinjacraft-1.2.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.14.2 Linux/6.17.12-300.fc43.x86_64

File hashes

Hashes for jinjacraft-1.2.0.tar.gz
Algorithm Hash digest
SHA256 fcbdb107934cbf52374aa16514dbd8aabe1e42041ffe058aeb8965e32c1a8475
MD5 9312b0579fa30e660087703044e8f250
BLAKE2b-256 e8bb358faec6c47f32422af32dabb70f3a80ffc8f79fd2d759fa005c0c00cd20

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jinjacraft-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.14.2 Linux/6.17.12-300.fc43.x86_64

File hashes

Hashes for jinjacraft-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c350fcf20334526f56925dc12a004a5794a2802522f00d0d64f8d2f96c1f4073
MD5 3dd0b13017a2abb44711710d97ac1f42
BLAKE2b-256 55c4305d63aba2bc87b54e4cd73820d9e14a00a666c992d96bd63090e807176d

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