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
Release history Release notifications | RSS feed
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 details)
File details
Details for the file stemplates-1.0.1.tar.gz
.
File metadata
- Download URL: stemplates-1.0.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ecc32de1ea6b4eeaea3e40eca49dc398545c606e0fa2003a8adadf319f099dd8 |
|
MD5 | d2c6477105951f271809cfe8ea8dcc18 |
|
BLAKE2b-256 | 5f29b10b2f02c888efe222bacdc61fc2494e89228181094507d0f684f96ceb98 |