Skip to main content

Python high level configuration library

Project description

pymlconf (Python YAML Configuration Library) helps to easily manage and access to your application configurations which was already Written in YAML 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.

Config file

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

Python code:

# 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

# --------- Prints:
# MyApp
# 192.168.0.1
# english
# iran
# /var/log/myapp.log

Installation

Latest stable version:

$ pip install pymlconf
# or
$ easy_install pymlconf

Development version:

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

From source:

$ cd source_dir
$ python setup.py install

Manually download it from pypi

Unit-Tests

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

$ pip install nose
$ cd path/to/pymlconf

Running tests:

$ nosetests

Or

$ python setup.py test

Syntax Reference

You can find the canonical syntax reference on PyYAML site

Documentation

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

pymlconf-0.3.21.tar.gz (10.4 kB view details)

Uploaded Source

File details

Details for the file pymlconf-0.3.21.tar.gz.

File metadata

  • Download URL: pymlconf-0.3.21.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pymlconf-0.3.21.tar.gz
Algorithm Hash digest
SHA256 ef011b6c2687c2e29b7d3f1793d5c0c9534a1ded9cd0bf976740cf380f48e4e8
MD5 a27407bf1ceeb40f7798dab617f8949f
BLAKE2b-256 7e650af6da8e6a95c17ff3df35ae2e3b5b12d64c25c07ff064a1567ad6014fe5

See more details on using hashes here.

Supported by

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