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.1.3.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

jinjacraft-1.1.3-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jinjacraft-1.1.3.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.11.6 Linux/6.2.0-37-generic

File hashes

Hashes for jinjacraft-1.1.3.tar.gz
Algorithm Hash digest
SHA256 90baefe115cdb3ec73d68430950f2bf2451911a077b48e964b8304c0ab3f7472
MD5 10f944638beee52aac8e248f908381c3
BLAKE2b-256 5c690257187360d35c145c48d22fd2e20cc0e51763926537f2764e28da4dc4da

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jinjacraft-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.11.6 Linux/6.2.0-37-generic

File hashes

Hashes for jinjacraft-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 81fcfc615e4bc1bf9a8a18b723a9d443d1501063793fbb04160704aec72142e0
MD5 326a700518cc68091c4263ec7cac1b8e
BLAKE2b-256 c93940f6442d49c98065deeb508768b495618c045915bae1183ea6d75772b83d

See more details on using hashes here.

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