Skip to main content

Simple file template renderer

Project description

stemplates

Render files with embedded python code. Executes exec and substitutes expression with the result.

Usage

from stemplates import render_template
# Simple substitution
text = "Hello, {% username %}"
rendered = render_template(text, username="John")
# Conditionals
text = "Hello, {% f'{name} {lastname}' if full_name else name %}"
rendered = render_template(text, name="John", lastname="Green", full_name=False)
# Render files
render_file_to("some.template", "out.txt", param1="Param", param2="...")

Install

pip install stemplates

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

stemplates-1.0.1.tar.gz (4.0 kB view hashes)

Uploaded Source

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