Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Provides template substitution for other recipe configurations in the same buildout.cfg file.

Project description


This is a zc.buildout recipe that provides support for template
substitution within the buildout.cfg file. When this recipe is loaded
in a buildout.cfg file, it will search the buildout configuration for
any instances of the the template syntax, i.e. any text enclosed by
{{double-curly-braces}}. If substitutions are found, the
configuration will be altered directly in memory, and any subsequent
recipes will be run with the substituted values.

The template substitution values come from a separate config file,
specified in the configuration, defaulting to
"cfgsubs.cfg". If the substitution file does not exist, or if it is
missing any values required by the buildout.cfg file, then the user
will be interactively prompted to enter the requested information, and
the substitution file will be created or amended with the provided

The idea is that you'll create a templatized buildout.cfg file and
store it in a revision control system (RCS). The templatized values
would represent information that is not suitable for storage in the
RCS, such as port numbers, passwords, database connection strings, or
anything else that is either sensitive or likely to vary from
deployment to deployment. The first time this buildout.cfg file is
used in a new location, the user will interactively provide these
values, which would then be stored in the substitution file, which is
left out of the RCS, or (if desired) is stored in a more secure
repository elsewhere.

Change history

${0.1.0 or "0.0.0"} (xxxx-xx-xx)

- Created recipe with ZopeSkel [${Rob Miller or ""}].

Detailed Documentation

Supported options

The recipe supports the following options:

.. Note to recipe author!
For each option the recipe uses you shoud include a description
about the purpose of the option, the format and semantics of the
values it accepts, whether it is mandatory or optional and what the
default value is if it is omitted.

Description for ``option1``...

Description for ``option2``...

Example usage

.. Note to recipe author!
zc.buildout provides a nice testing environment which makes it
relatively easy to write doctests that both demonstrate the use of
the recipe and test it.
You can find examples of recipe doctests from the PyPI, e.g.

The PyPI page for zc.buildout contains documentation about the test

Below is a skeleton doctest that you can start with when building
your own tests.

We'll start by creating a buildout that uses the recipe::

>>> write('buildout.cfg',
... """
... [buildout]
... parts = test1
... [test1]
... recipe =
... option1 = %(foo)s
... option2 = %(bar)s
... """ % { 'foo' : 'value1', 'bar' : 'value2'})

Running the buildout gives us::

>>> print system(buildout)
Installing test1.
Unused options for test1: 'option2' 'option1'.


${Rob Miller or ""}, Author


Project details

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page