--- id: envtpl version: "0.8.0" license: GPL v3 license_treatment: copyleft maintenance: active --- # envtpl — Render jinja2 templates on the command line using shell environment variables License: copyleft · Maintenance: active · Downloads: 124.9K/mo ## What it is and what it does envtpl is a command-line tool that processes Jinja2 templates by injecting shell environment variables into them. It reads a template file (typically with a .tpl extension), substitutes variables using Jinja2 syntax, and writes the rendered output to a file or stdout. The tool supports default values, conditional blocks, and a special environment() function to match variables by prefix—all standard Jinja2 features accessible from the shell. The primary use case is Docker container initialization, where configuration files need to be generated at runtime with values from the container environment. By default, envtpl deletes the input template after rendering (though this can be disabled with --keep-template). It handles missing variables by throwing an error unless --allow-missing is passed, which substitutes empty strings instead. Use it for: - Generate Docker container configuration files at startup by substituting environment variables into template files. - Create deployment-specific config files (nginx, Redis, etc.) from a single template with environment-driven values. - Build shell scripts or application configs that vary by environment (dev, staging, prod) without duplicating files. - Conditionally include or exclude configuration sections based on whether specific environment variables are defined. - Batch-process multiple template files in a CI/CD pipeline to inject build metadata or secrets. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Renders Jinja2 templates on the command line, substituting shell environment variables into template files with optional defaults and conditional logic. Yes, if you need lightweight, shell-native template rendering for configuration files in Docker or deployment contexts. The single dependency, active maintenance, and lack of known vulnerabilities make it low-risk. The GPL v3 license requires review if you plan to redistribute or embed it in proprietary software; for internal use it is unproblematic. Not necessary if your deployment tool (Helm, Terraform, etc.) already handles templating. ## Install pip install envtpl uv add envtpl poetry add envtpl ## Installing envtpl Before you install: Installs cleanly with a single runtime dependency (Jinja2) and no compiled components. Active maintenance with recent commits; last release 148 days ago. License in practice: Licensed under GPL v3 (copyleft). Any derivative work or bundled distribution must also be GPL v3; suitable for internal tools and open-source projects but requires careful review in proprietary contexts. Quickstart: pip install envtpl # Create template file (config.conf.tpl): # foo = {{ FOO }} # bar = "{{ BAR | default("default_value") }}" # Render from command line: # FOO=123 BAR=abc envtpl config.conf.tpl # Output: config.conf with variables substituted Requires Python 3.10 or later; environment variables must be set in the shell before invocation. Verify before relying: - Whether the package handles special characters or escaping in environment variable values reliably. - Performance characteristics when processing very large template files or many environment variables. ## Package facts - License: GPL v3 (copyleft) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 124.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags jinja2 template rendering cli, environment variable template substitution, docker config file templating, shell variable template engine, command line template processor, jinja2 environment variables, config file templating tool, docker-config, cli-tool, template-engine [View on SkillFed](https://skillfed.io/packages/envtpl) · [View on PyPI](https://pypi.org/project/envtpl/)