Skip to main content

template-file-parser

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

Metadata

Release files for template-file-parser 0.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for template-file-parser 0.14
File Size Uploaded
template-file-parser-0.14.tar.gz 2.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for template-file-parser 0.14
File Interpreter ABI Platform
template_file_parser-0.14-py3-none-any.whl Python 3 none any Details

Total release size: 6.9 kB

Release files / template-file-parser-0.14.tar.gz

Download URL template-file-parser-0.14.tar.gz
Size 2.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0ccf9c48506ebcb1c764edff12030bb849476c2b500a478dd528fd82db7e6624
BLAKE2b-256 checksum
How to use checksums
72278e643cbea0b1250d4d9cb8e95bd466f1b029e9ad58282a97346e29bf6759
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / template_file_parser-0.14-py3-none-any.whl

Download URL template_file_parser-0.14-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
43a7aa3d00b9cc098bb87d856bcac5dfaa7f3faf483183f42cf106cc5b731ef3
BLAKE2b-256 checksum
How to use checksums
b27b5759531bb7c22f282562b0835c7da8631e658cef27663166432d88543cc7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.14 This release

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page