Skip to main content

Tiny wrapper over string templates which works with files

Project description

Codacy Badge Codacy Coverage

Build Status

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for template-file-parser, version 0.14
Filename, size File type Python version Upload date Hashes
Filename, size template_file_parser-0.14-py3-none-any.whl (4.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size template-file-parser-0.14.tar.gz (2.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page