Config files renderer based on Jinja2
Project description
It renders template files with context loaded from simple INI-style config files. Config files support inheritance and interpolation.
Getting started
Install this package with pip:
$ pip install jingle
Check usage:
$ jingle --help
Run some examples:
$ jingle examples/hello.conf < examples/hello.j2
Config files
Jingle supports single-group INI config files. For example:
one = 1
two = dos
three = trzy
Interpolation
Basic interpolation is supported thanks to SafeConfigParser used under the hood:
name = Jon
surname = Snow
fullname = %(name)s %(surname)s
Inheritance
Config files can be inherited, or saying precisely included one into another with #inherit directive.
In defaults.conf:
host = 0.0.0.0
port = 3000
In production.conf:
#inherit defaults.conf
port = 80
Compiled config will use host: 0.0.0.0 and port: 80.
Of course interpolation works across inherited files.
Programatic usage
You can as well use the library programatically in your application. Here’s simple example:
from jingle import Template, Context
tpl = Template("Hello {{who}}!")
print tpl.render(Context("path/to/params.conf"))
License
Copyright (c) 2014 by Kris Kovalik.
Released under MIT license, check LICENSE file for details.
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
File details
Details for the file jingle-0.2.1.tar.gz.
File metadata
- Download URL: jingle-0.2.1.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
181c6bea203e8d7a57a2cbdad2866e45b32583fd778fe3ddcdc74381ff7b34be
|
|
| MD5 |
d68dbc1c66c789abdef0c69377586029
|
|
| BLAKE2b-256 |
8edc2aa04e09c66080634a309f0d9759985aea7ee475897e520b2b1dccf0eda7
|