Skip to main content
interpolatr
===========

Interpolatr is a command line tool and library for interpolating
configuration settings into templatized files. It uses the
`jinja2 <http://jinja.pocoo.org/docs/2.9/>`_ library for templating.

Usage
-----

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.

Usage:

::

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
``interpolatr``:

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
parent(s).

It is simple to define your own configuration sources: see
``config.py``. 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 ``sink.py`` for reference.

Notes
-----

- 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.

Metadata

Release files for interpolatr 0.0.2

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

Source distribution (sdist)

Source distribution for interpolatr 0.0.2
File Size Uploaded
interpolatr-0.0.2.tar.gz 13.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for interpolatr 0.0.2
File Interpreter ABI Platform
interpolatr-0.0.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 30.0 kB

Release files / interpolatr-0.0.2.tar.gz

Download URL interpolatr-0.0.2.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6c3375c05ac3c22b9e7b24da7942556b053d31415601b2a3e60ca3f5071a3b2d
BLAKE2b-256 checksum
How to use checksums
cf3281228b6756f0b4d94a2704b8957dd5c5499aed010f22134adb64afec2774
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / interpolatr-0.0.2-py2.py3-none-any.whl

Download URL interpolatr-0.0.2-py2.py3-none-any.whl
Size 16.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
8cfb80027f4484f4346046d26943d7ac1179f49a4299c04b96b7fefa024c98b7
BLAKE2b-256 checksum
How to use checksums
676fea8ae3fbac8de5d69ba91c9e39c503ed4665150b83e4f95093fd280e06f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.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