Welcome to pymlconf’s documentation!

http://img.shields.io/pypi/v/pymlconf.svg https://github.com/pylover/pymlconf/workflows/Build/badge.svg?branch=master https://coveralls.io/repos/github/pylover/pymlconf/badge.svg?branch=master https://img.shields.io/badge/license-MIT-brightgreen.svg

Jump To:

API Reference

class pymlconf.Meld(data=None, file=None, root=None)

Replacement for default yaml mapping.

This class has the ability to merge with other mappings such as py:class:dict and it’s subclasses. so any configuration node can be merged with other.

Parameters:
  • datayaml string, list of 2-tuples or dict.

  • file – file object or filename to load.

  • root – enclose the data argument in another key specified by this argument.

Added in version 4.1: root parameter.

The API is so simple:

Create configuration instance with default value and load a file to overwrite:

m = Meld('''
  foo:
    bar: BAR
    baz: BAZ
''', file='qux.yml')

Merge/meld other mappings in:

m |= dict(thud='THUD', corge=10)

Load a file by name:

m.load('foo.yml')

Load a file-like object :

with open('foo.yml') as f:
    m.load(f)

Dump a Meld object:

print(m.dump())
load(file)
dump(**kw)

Indices and tables