Metadata-Version: 2.1
Name: pymlconf
Version: 0.8.8
Summary: Python high level configuration library
Home-page: http://github.com/pylover/pymlconf
Author: Vahid Mardani
Author-email: vahid.mardani@gmail.com
Maintainer: Vahid Mardani
Maintainer-email: vahid.mardani@gmail.com
License: UNKNOWN
Platform: any
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Software Development :: Libraries
Requires-Dist: pyyaml (>=3.10)

pymlconf
========

.. image:: http://img.shields.io/pypi/v/pymlconf.svg
     :target: https://pypi.python.org/pypi/pymlconf

.. image:: https://requires.io/github/pylover/pymlconf/requirements.svg?branch=master
     :target: https://requires.io/github/pylover/pymlconf/requirements/?branch=master
     :alt: Requirements Status

.. image:: https://travis-ci.org/pylover/pymlconf.svg?branch=master
     :target: https://travis-ci.org/pylover/pymlconf

.. image:: https://coveralls.io/repos/github/pylover/pymlconf/badge.svg?branch=master
     :target: https://coveralls.io/github/pylover/pymlconf?branch=master

.. image:: https://img.shields.io/badge/license-MIT-brightgreen.svg
     :target: https://github.com/pylover/pymlconf/blob/master/LICENSE


Jump To:
^^^^^^^^

 * `Documentation <http://pymlconf.dobisel.com>`_
 * `Python package index <https://pypi.python.org/pypi/pymlconf>`_
 * `Source on github <https://github.com/pylover/pymlconf>`_
 * `Downloads <https://pypi.python.org/pypi/pymlconf#downloads>`_


About
^^^^^

**pymlconf** (Python YAML Configuration Library) helps to easily manage
and access to your application configurations which was already Written
in `YAML <http://pyyaml.org>`__ language.

It can merge two or more configuration files according their names and
automatically treat file-names as namespaces, or simply merge several
parts of configuration(YAML-string or Python-dict) on arbitrary config
node. for more informations see
`documentations <https://github.com/pylover/pymlconf#documentation>`__.

Config file

.. code-block:: yaml

   # filename: config.yaml
   app:
       root_dir: %(here)s


Python code:

.. code-block:: python

   # filename: config.py

   from pymlconf import ConfigManager

   config_str='''
   app:
       name: MyApp
       listen:
           sock1:
               addr: %(hostname)s
               port: %(port)s
       languages:
           - english
           - {language: persian, country: iran}

   logfile: /var/log/myapp.log
   '''

   cfg = ConfigManager(init_value=config_str, context=dict(hostname='192.168.0.1', port=8080))
   cfg.load_files('path/to/config.yaml')

   print cfg.app.name
   print cfg.app.listen.sock1.addr
   print cfg.app.languages[0]
   print cfg.app.languages[1].country
   print cfg.logfile

Will produce
::

   # MyApp
   # 192.168.0.1
   # english
   # iran
   # /var/log/myapp.log

Deferred(Proxied)
~~~~~~~~~~~~~~~~~

.. code-block:: python

   # module configuration.py
   from pymlconf import DeferredConfigManager
   settings = DeferredConfigManager()

   # another_module.py
   from configuration import settings
   def serve_request():
       return settings.message

    # in application startup
   from configuration import settings
   settings.load(
       # the signature is the same as the `ConfigManager.__init__`
   )


Installation
~~~~~~~~~~~~

Latest stable version:

.. code-block:: shell

   $ pip install pymlconf
   # or
   $ easy_install pymlconf

Development version:

.. code-block:: shell

   $ pip install git+git@github.com:pylover/pymlconf.git

From source:

.. code-block:: shell

   $ cd source_dir
   $ python setup.py install

Manually download it from
`pypi <https://pypi.python.org/pypi/pymlconf>`__

Unit-Tests
~~~~~~~~~~

Install nose and change current directory to project's dir:

.. code-block:: shell

   $ pip install nose
   $ cd path/to/pymlconf

Running tests:

.. code-block:: shell

   $ nosetests


Or

.. code-block:: shell

   $ python setup.py test


Syntax Reference
~~~~~~~~~~~~~~~~

You can find the canonical syntax reference on
`PyYAML <http://pyyaml.org/wiki/PyYAMLDocumentation#YAMLsyntax>`__ site

Change Log
~~~~~~~~~~

-  [0.5.9] ci
-  [0.5.1] Encoding option for files
-  [0.4.0] Adding DeferredConfigManager


