Log in

No account? Create an account

python-jinja2-cli and python-anyconfig

« previous entry | next entry »
May. 6th, 2013 | 05:37 pm

I wrote and keep maintain a jinja2-based template compiler called python-jinja2-cli and use to generate various files such like ks.cfg, KVM guest build scripts, libvirt network XML definitions, doc (rst) sources.

Jinja2 is very powerful template engine and maybe this tool help and be useful for others also.

ssato@localhost% jinja2-cli
Usage: /usr/bin/jinja2-cli COMMAND_OR_COMMAND_ABBREV [Options] [Arg ...]

Commands: render, dumpvars
Command abbreviations: r, d

ssato@localhost% jinja2-cli r -h
Usage: jinja2-cli render [OPTION ...] TEMPLATE_FILE

  -h, --help            show this help message and exit
                        Colon ':' separated template search paths. Please note
                        that dir in which given template exists is always
                        included in the search paths (at the end of the path
                        list) regardless of this option. [., dir in which
                        given template file exists]
  -C CONTEXTS, --contexts=CONTEXTS
                        Specify file path and optionally its filetype, to
                        provides context data to instantiate templates.  The
                        option argument's format is
                        [type:] ex. -C
                        json:common.json -C ./specific.yaml -C yaml:test.dat,
                        -C yaml:/etc/foo.d/*.conf
  -o OUTPUT, --output=OUTPUT
                        Output filename [stdout]
  -E ENCODING, --encoding=ENCODING
                        I/O encoding [UTF-8]
  -D, --debug           Debug mode
  -W, --werror          Exit on warnings if True such like -Werror optoin for

Also I wrote and keep maintain a python library called 'anycnfig' to load multiple cascading configuration files. As python-jinja2-cli depends on it, this is needed to install along with python-jinja2-cli.

python-anyconfig is available from: https://github.com/ssato/python-anyconfig or https://pypi.python.org/pypi/anyconfig

Link | Leave a comment | | Flag

Comments {0}