Skip to main content

Render Jinja2 templates from the command line with JSON/YAML/env data

Project description

tmpl-cli

Render Jinja2 templates from the command line with JSON, YAML, environment variables, or inline values.

Install

pip install tmpl-cli

# With YAML support:
pip install tmpl-cli[yaml]

Usage

# Render a template file with a data file
tmpl render template.conf -d config.json

# Inline template with --set
tmpl render "Hello {{name}}!" --set name=World

# Multiple data sources (later overrides earlier)
tmpl render app.conf -d defaults.json -d overrides.json --set debug=true

# Use environment variables
tmpl render deploy.yaml --env
tmpl render deploy.yaml --env-prefix APP_

# List variables in a template
tmpl vars template.conf

# Validate syntax
tmpl validate template.conf

# Check template + data completeness
tmpl check template.conf -d data.json --strict

Commands

Command Description
render Render a template (file, inline string, or stdin with -)
vars List undeclared variables in a template
validate Check template syntax
check Validate template and verify all variables are provided

Data Sources (priority low→high)

  1. -d / --data files (JSON or YAML, repeatable)
  2. --env (all env vars) or --env-prefix PREFIX (filtered, prefix stripped)
  3. -s / --set key=value (highest priority, repeatable)

Values in --set are auto-parsed as JSON when possible (--set count=5 → int, --set items='["a","b"]' → list).

For AI Agents

See SKILL.md for agent-optimized documentation.

License

MIT

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

tmpl_cli-0.1.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

tmpl_cli-0.1.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file tmpl_cli-0.1.0.tar.gz.

File metadata

  • Download URL: tmpl_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for tmpl_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6b07f146a3fb9d8b1b199c6ebea2d4ceac3a0ee09be4ff84a3d5b8a95be44898
MD5 556c8df53bd436846a3ae9f533f10fbc
BLAKE2b-256 ae3b0ec65b78eb27d35e48bdcaa3c628082b3e72bb477d074fc58fd249a4ed7b

See more details on using hashes here.

File details

Details for the file tmpl_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tmpl_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for tmpl_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cbe58a90ccc6f511d6f65c9edb9a56dbececcabfe043102a607b0999c797c0ba
MD5 f55c77032541a446d7886b686f0ed7bb
BLAKE2b-256 379b5b8d71b687260b1d18de35757a22935bb557aacf97f21489cb54cf633111

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