|
From: <fuz...@vo...> - 2009-04-16 21:50:16
|
{ran_emo} Finally a fresh release `ConfigObj </python/configobj.html>`_ and `Validate </python/validate.html>`_.
* `ConfigObj 4.6.0 on PyPI <http://pypi.python.org/pypi/ConfigObj/>`_
* `Validate 1.0.0 on PyPI <http://pypi.python.org/pypi/validate/>`_
**ConfigObj** is a simple to use but powerful Python library for the reading and writing of configuration (ini) files. Through **Validate** it integrates a config file validation and type conversion system.
Features of ConfigObj include:
* Nested sections (subsections), to any level
* List values
* Multiple line values
* Full Unicode support
* String interpolation (substitution)
* Integrated with a powerful validation system
- including automatic type checking/conversion
- and allowing default values
- repeated sections
* All comments in the file are preserved
* The order of keys/sections is preserved
* Powerful ``unrepr`` mode for storing/retrieving Python data-types
Release 4.6.0 fixes bugs and adds new features, particularly making configspec handling more flexible.
The full changelog for ConfigObj 4.6.0 is:
* Pickling of ConfigObj instances now supported (thanks to Christian Heimes)
* Hashes in confgspecs are now allowed (see note below)
* Replaced use of hasattr (which can swallow exceptions) with getattr
* ``__many__`` in configspecs can refer to scalars (ordinary values) as well as sections
* You can use ``___many___`` (three underscores!) where you want to use ``__many__`` as well
* You can now have normal sections inside configspec sections that use ``__many__``
* You can now create an empty ConfigObj with a configspec, programmatically set values and then validate
* A section that was supplied as a value (or vice-versa) in the actual config file would cause an exception during validation (the config file is still broken of course, but it is now handled gracefully)
* Added ``as_list`` method
* Removed the deprecated ``istrue``, ``encode`` and ``decode`` methods
* Running test_configobj.py now also runs the doctests in the configobj module
* Through the use of validate 1.0.0 ConfigObj can now validate multi-line values
As a consequence of the changes to configspec handling, when you create a ConfigObj instance and provide
a configspec, the configspec attribute is only set on the ConfigObj instance - it isn't set on the
sections until you validate. You also can't set the configspec attribute to be a dictionary. This wasn't
documented but did work previously.
In order to fix the problem with hashes in configspecs I had to turn off the parsing of inline comments
in configspecs. This will only affect you if you are using ``copy=True`` when validating and expecting
inline comments to be copied from the configspec into the ConfigObj instance (all other comments will be
copied as usual).
If you *create* the configspec by passing in a ConfigObj instance (usual way is to pass in a filename or
list of lines) then you should pass in ``_inspec=True`` to the constructor to allow hashes in values.
This is the magic that switches off inline comment parsing.
As the public API for Validate is stable, and there are no outstanding issues or feature requests, I've bumped the version number to 1.0.0. The full change log is:
* BUGFIX: can now handle multiline strings
* Addition of 'force_list' validation option
You should be able to install ConfigObj (which includes Validate in the source distribution on PyPI) using ``pip`` or ``easy_install``. |