<commit_before>========
confspec
========

.. image:: https://pypip.in/py_versions/confspec/badge.png
   :target: https://pypi.python.org/pypi/confspec/
   :alt: Supported Python versions

.. image:: https://pypip.in/version/confspec/badge.png?text=version
   :target: https://pypi.python.org/pypi/confspec/
   :alt: Latest Version

.. image:: https://pypip.in/download/confspec/badge.png
   :target: https://pypi.python.org/pypi/confspec/
   :alt: Downloads

.. image:: https://pypip.in/license/confspec/badge.png
   :target: https://pypi.python.org/pypi/confspec/
   :alt: License

.. image:: https://pypip.in/status/confspec/badge.png
   :target: https://pypi.python.org/pypi/confspec/
   :alt: Status


About
=====

``confspec`` is a Python library / framework that allows an application to
handle all it's configuration options easily and with safety.

With ``confspec`` you don't need to worry about parsing files, casting or
trying to parse / convert / interpret datatypes, try to identify if the option
is semantically valid and how to react when your options change.

``confspec`` could be understood as a ``ConfigParser`` with steroids, because
it provides:

- Type safety for each configuration option.

  - "That option is an int".
  - "That option is a boolean".
  - "That option is a Date".

- Semantic safety for each configuration option.

  - "That option is a odd int".
  - "That option is a positive int".
  - "That option is a int, but it can only be 1, 4 or 7."
  - "That option is a Data, but needs to be between 1920 and 1940."

- Stackable configuration layers:

  - System (default layer, or predefined, with safe values).
  - as many user layers as required (enviroment, user, etc). Options in the top
    layer overrides the one in the bottom.
  - Import multiple configuration files.

- Application wide configuration. You will always have at hand your
  configuration.

- Publisher / listener pattern (callbacks):

  - Know and react when an option is changed.

- Automatic writeback:

  - Always write to the top configuration file the current state of the
    configuration when it changes.

- Safe state:

  - Configuration is always in a safe state. It cannot get corrupted. Options
    will change state only if the new value is validated.

- Multiple Import / Export formats. ``confspec`` can import and export current
  configuration from JSON, INI and Python dicionaries.
  XML, YAML and other could be easily added.

You just need to write the configuration specification for you application and
``confspec`` will handle everything.


Installation
============

::

    sudo pip install confspec


Documentation
=============

User guide and API Reference can be found in:

    http://confspec.readthedocs.org/

To build it from source execute:

::

    sudo pip install sphinx
    cd doc/
    make html


Development
===========

    https://github.com/carlos-jenkins/confspec

Run code QA:

::

    python setup.py test

<commit_msg>Forgot to change instructions to run 'tox' as 'python setup.py test' doesn't work.<commit_after>========
confspec
========

.. image:: https://pypip.in/py_versions/confspec/badge.png
   :target: https://pypi.python.org/pypi/confspec/
   :alt: Supported Python versions

.. image:: https://pypip.in/version/confspec/badge.png?text=version
   :target: https://pypi.python.org/pypi/confspec/
   :alt: Latest Version

.. image:: https://pypip.in/download/confspec/badge.png
   :target: https://pypi.python.org/pypi/confspec/
   :alt: Downloads

.. image:: https://pypip.in/license/confspec/badge.png
   :target: https://pypi.python.org/pypi/confspec/
   :alt: License

.. image:: https://pypip.in/status/confspec/badge.png
   :target: https://pypi.python.org/pypi/confspec/
   :alt: Status


About
=====

``confspec`` is a Python library / framework that allows an application to
handle all it's configuration options easily and with safety.

With ``confspec`` you don't need to worry about parsing files, casting or
trying to parse / convert / interpret datatypes, try to identify if the option
is semantically valid and how to react when your options change.

``confspec`` could be understood as a ``ConfigParser`` with steroids, because
it provides:

- Type safety for each configuration option.

  - "That option is an int".
  - "That option is a boolean".
  - "That option is a Date".

- Semantic safety for each configuration option.

  - "That option is a odd int".
  - "That option is a positive int".
  - "That option is a int, but it can only be 1, 4 or 7."
  - "That option is a Data, but needs to be between 1920 and 1940."

- Stackable configuration layers:

  - System (default layer, or predefined, with safe values).
  - as many user layers as required (enviroment, user, etc). Options in the top
    layer overrides the one in the bottom.
  - Import multiple configuration files.

- Application wide configuration. You will always have at hand your
  configuration.

- Publisher / listener pattern (callbacks):

  - Know and react when an option is changed.

- Automatic writeback:

  - Always write to the top configuration file the current state of the
    configuration when it changes.

- Safe state:

  - Configuration is always in a safe state. It cannot get corrupted. Options
    will change state only if the new value is validated.

- Multiple Import / Export formats. ``confspec`` can import and export current
  configuration from JSON, INI and Python dicionaries.
  XML, YAML and other could be easily added.

You just need to write the configuration specification for you application and
``confspec`` will handle everything.


Installation
============

::

    sudo pip install confspec


Documentation
=============

User guide and API Reference can be found in:

    http://confspec.readthedocs.org/

To build it from source execute:

::

    sudo pip install sphinx
    cd doc/
    make html


Development
===========

    https://github.com/carlos-jenkins/confspec

Run code QA:

::

    pip install tox
    tox


{'fraction_non_alphanumeric': 0.10767696909272183, 'fraction_numerical': 0.0036556995679627785, 'mean_word_length': 3.3838310269482883, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 22, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6042995', 'n_tokens_mistral': 1869, 'n_tokens_neox': 1746, 'n_words': 711}