Skip to main content

A configuration system using YAML and entry points

Project description

repoze.configuration README

repoze.configuration is a package that software developers can use as a configuration system. It allows the use of YAML as a configuration language. Application-defined “directives” can be plugged in to repoze.configuration using one or more Python setuptools entry points. For example, you could make sense out of the following YAML using repoze.configuration and a custom “appsettings” directive:

--- !appsettings
port_number = 8080
reload_templates = true

--- !include
filename = anotherfile.yml

Please see docs/index.rst or http://docs.repoze.org/configuration for more documentation.

repoze.configuration Changelog

0.8 (2012-03-29)

  • This release is the last which will maintain support for Python 2.4 / Python 2.5.

  • Added support for continuous integration using tox and jenkins.

  • Added ‘setup.py dev’ alias (runs setup.py develop plus installs nose and coverage).

  • Instances of repoze.configuration.context.Context now inherit from dict. Previously, the context object was guaranteed to have a subattr named registry which was presumed to be dictlike; interpolation used this dictionary to resolve names. This “registry”, for interpolation purposes, is now assumed to be the context itself. A property alias named registry has been added to the context for bw compat.

  • The declaration object’s registry property is now deprecated; instead declaration.context should be used directly.

  • Added a class, repoze.configuration.imperative.ImperativeConfig, which allows a configuration object to offer an imperative API that is based on directives that are discoverable as entry points.

0.7 (2010-02-24)

  • Allow repoze.configuration.context.Context constructor to take arbitrary keyword arguments. These kw arguments are added to the instance __dict__ of the result context object.

  • The return value of repoze.configuration.context.Context.execute is no longer the registry attribute of the context object; it is instead None. The registry object is no longer “special”.

0.6 (2009-12-30)

  • When context.action was called with a None discriminator (the default), it would conflict with other actions that did not supply a discriminator either.

  • If a repoze.configuration.directive entry point name begins with the characters ‘tag:’, treat the name as a YAML tag URI. YAML tag URIs can be aliased at the top of YAML files to shorter !bang! names via a YAML %TAG directive (see YAML global tag prefix documentation.

    The intent is to encourage directive writers to register both a “short name” (a word) and a tag URI for the same entry point function. Doing so means that a config file writer can optionally use a tag URI (!<tag:repoze.org,2009:pypes/server>) in place of a “short name” (!server) when the short version can’t be used due to a conflict between two directives in separate packages that share the same short name.

    For example, an application might register both server = pypes.deploy.directives:server and tag:repoze.org,2009:pypes/server = pypes.deploy.directives:server in a repoze.configuration.directive section within setup.py. A config file that used the above entry points might equivalently use any of the three below forms as necessary within a given YAML file:

    # tag alias
    %TAG !pypes! tag:repoze.org,2009:pypes/
    
    # short name
    --- !server
    name: main
    port: 8082
    host: 0.0.0.0
    
    # rely on tag expansion from %TAG directive
    --- !pypes!server
    name: main
    port: 8082
    host: 0.0.0.0
    
    # use literal tag URI
    --- !<tag:repoze.org,2009:pypes/server>
    name: main
    port: 8082
    host: 0.0.0.0

0.5 (2009-07-26)

  • Add documentation about interpolation.

  • Show only line numbers in error reports on console (previously both line numbers and column numbers were reported, but the column numbers seem to be meaningless in most debugging scenarios).

  • Fix an off by one error in line number reporting in errors.

  • Interpolation variables now try to use the registry first, but fall back to “stack” values; the most important of which is %(here)s; this interpolation variable can be used in any config file. It will be the absolute path to the parent directory of the configuration file in which it was declared. Any stack variable will be overridden permanently (for interpolation purposes) by a registry variable.

0.4 (2009-07-25)

  • Totally backwards incompatible.

  • Instead of accepting “context”, “structure” and “node”, directives now accept “declaration” objects. A declaration object has most of the methods that used to be supplied by the “context”, and some new ones. The docs have been updated.

0.3 (2009-07-24)

  • Backwards incompatibility: directives must now accept three arguments: context, structure, and node (previously they had only accepted context and structure).

  • error method added to context.

  • Make discriminator conflict detection actually work.

  • Show actual lines from conflicting files when possible during a discriminator conflict.

  • Ignore import errors when trying to resolve entry point loads.

  • Add a popvalue method to the context; it works like getvalue except it pops the value out of the structure supplied instead of just getting it.

  • It was not possible to resolve the single dot . using repoze.configuration.context.Context.resolve to the current package.

  • Using a Python %(interpolation)s marker in any string value allows you to replace values in strings. For example, using “%(here)s” in a string value would attempt to resolve the name “here” from the registry as a key.

  • Use pyyaml’s SafeLoader rather than Loader: we don’t really need to be able to construct arbitrary Python objects.

0.2 (2009-07-13)

  • Trying to read any directive section that wasn’t a YAML mapping caused a TypeError (e.g. construct_scalar takes no argument 'deep').

0.1 (2009-06-22)

  • Initial release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

repoze.configuration-0.8.tar.gz (33.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page