view README.txt @ 68:1025d283a570

start in on the README
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 28 Mar 2012 10:27:17 -0700
parents b7e7f450ad1a
children 451aeb35ec04
line wrap: on
line source

configuration
===========

multi-level unified configuration for python consumption

- you have a (python) program that wants to read configuration from
  configuration files (I currently support JSON and YAML) and also
  from the command line
- you want to be able to serialize and deserialize configuration

API
---

The ``configuration.Configuration`` class implements an abstract base
class that extends ``optparse.OptionParser``.  The form of the
configuration is dictated by setting the ``options`` attribute on your
subclass.  ``options`` is a dictionary of the form::

  {'name': {<value>}}

``name`` is the name of the configuration option, and ``value`` is a
``dict`` that gives the form of the option.


For an example, see
http://k0s.org/mozilla/hg/configuration/file/c831eb58fb52/tests/example.py#l7


Configuration Files
-------------------

Config files are useful for (IMHO) A. complicated setup;
B. reproducibility; C. being able to share run time configurations
The latter is only useful if the configuration contains nothing
machine-specific (e.g. the path to an executable might vary from
machine to machine) or if the configuration is overridable from the
command line.

----

Jeff Hammel

http://k0s.org/mozilla/hg/configuration