Skip to main content
Help us improve Python packaging – donate today!

COnfig File MANipluation library

Project Description

“manipulations and lies”

🚯 About

Manipulate simple configuration files in a, relatively, intelligent fashion.

Given a simple configuration file, cofman.lib provides a means to edit the file using a dictionary-like interface:

import cofman.lib

config = cofman.lib.File("/etc/sysctl.conf")
>>> config['kern.sysv.shmmin']
"1"
# given permission =)
>>> config['kern.sysv.shmmin'] = "100"
"100"

Every dictionary operation reads from the file, so using this as a cache is not appropriate. Usually, only the cofman.lib.File.update and cofman.lib.File.getset methods should be used to interact with the configuration. The other operations are provided for convenience.

By default, the configuration file is assumed to use the following delimiters:

config = {
        'quote': "'",
        'quote_escape': "''",
        'comment': "#",
        'assignment': '=',
        'record': '\n',
}

Warning

The value side of the settings are unconditionally quoted when modified.

Considerations

cofman was not written with performance in mind. It is designed for common case editing that does not occur often enough to warrant heavy optimizations.

Release history Release notifications

This version
History Node

0.1.0

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
cofman-0.1.0.tar.gz (9.5 kB) Copy SHA256 hash SHA256 Source None Aug 28, 2012

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page