Skip to main content

Interpolation tool

Project description


Interpolatr is a command line tool and library for interpolating
configuration settings into templatized files. It uses the
`jinja2 <>`_ library for templating.


The ``interpolatr`` command-line tool currently supports two
configuration sources (command line and YAML; see below) and a single
template sink ( file-based jinja2 templates). However, it is easy to
supply your own configuration sources or template sinks if necessary.



interpolatr [OPTIONS] [<config-class> <config-args>]... [<supplier-class> <supplier-args>]...

For example, using builtin config and template suppliers:


interpolatr -D override_setting=value YamlConfigSource --path conf.yaml ExtensionFileSinkSupplier --target_dir root

Configuration Sources

There are currently two built-in configuration sources for

1. *Command line*: You can specify configuration values when calling
``interpolatr`` using the ``-D`` flag: ``interpolator -D foo=bar``.

2. *YAML*: You can specify configuration values in a hierarchical
``yaml`` format.

The format looks like this: \`\`\`yaml settings: setting\_name:
setting\_value setting\_two: other\_value

Optional files to inherit settings from

base: - file/to/inherit-from.yml


# Functionally, this is no different than flattening the list out
- [ some/more.yaml, and-even-more.yml ]

- final-base-file.yml


These settings are populated into a ``ChainedMap``, so any settings
missing in your top-level configuration will be pulled from its

It is simple to define your own configuration sources: see
````. If using the command line, you can use a custom config
source by specifying the fully qualified class path on the command line.

Configuration Sinks

Configuration values can currently be written into templatized
configuration files. The templating is powered by ``jinja2``, so you may
use any valid ``jinja2`` expressions to define your configuration files.

It should be straightfoward to customize this process as well; see the
code in ```` for reference.


- This was developed under Python 2.7, but at least gives the
appearance of working under Python 3.
- This is an early version of this tool, so the interfaces are subject
to change.

Copyright and License

Copyright 2017, Yahoo Inc.

Licensed under the terms of the Apache License, Version 2.0. See the
LICENSE file associated with the project for terms.

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 interpolatr, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size interpolatr-0.0.2-py2.py3-none-any.whl (16.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size interpolatr-0.0.2.tar.gz (13.1 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