Tiny wrapper over string templates which works with files
Project description
template-file-parser is an convenient module for parsing files with the python template syntax.
This module was inspired by the following Stack overview post.
The need of this module was for me to have an easy templating system manipulating configuration files, without learning a more complete but complicated templating system. This is especially with configuration files of solr of kubernetes where just a small list of variables needs to be interpolated and written into a file.
Installation
pip install template-file-parser
Usage
from template_file_parser import parse_file parse_file(in_file, out_file, variables, safe=False)
These are the parameters:
in_file: The input file
out_file: The output file
variables : a dictionary where the keys are the variables in the template and the values are the values needed to substitute
safe: if True then then not all variables in the template file needs to be declared. If False, all parameters needs to be declared. For more information read here
Disclaimer
This library is only supported for python >= 3.4 as it fits my needs, and i don’t want to mees up with the encoding differences between python 2 and 3. This software is beta and breaking changes can occur between versions
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
Built Distribution
Hashes for template-file-parser-0.14.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ccf9c48506ebcb1c764edff12030bb849476c2b500a478dd528fd82db7e6624 |
|
MD5 | 2b497d2bea18b796ee4bbaa376bcfa9e |
|
BLAKE2b-256 | 72278e643cbea0b1250d4d9cb8e95bd466f1b029e9ad58282a97346e29bf6759 |
Hashes for template_file_parser-0.14-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43a7aa3d00b9cc098bb87d856bcac5dfaa7f3faf483183f42cf106cc5b731ef3 |
|
MD5 | 0835681112f02f418c986ed4821883b7 |
|
BLAKE2b-256 | b27b5759531bb7c22f282562b0835c7da8631e658cef27663166432d88543cc7 |