Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Simplifies and enchances functionalities in Python's ConfigParser

Project Description

SimpleConfigParser

Builds on top of the builtin SafeConfigParser but adds various convenience functionalities.

  • Access to all the usual ConfigParser functionality
  • Access sections and items via convience objects and dicts instead of get()
  • Makes accessing items and section via dicts possible on Python 2.7+, ConfigParser has that from Python 3.2 onwards as a default
  • Ability to set values via the objects config.section.item = 'demmmmm' and dicts config['section']['item'] all while write() still work as normal
  • Make a few functions work directly from the section object config.section.items(), config.section.getboolean('item')
  • Strips any quotes on the edgeds of items used in the INI file instead of returning it as part of the values
  • Improve the defaults handling on the object to be more sensible
defaults = {
    'section': {
        'item1': 'boo',
        'item2': 'bar'
    }
}

config = simpleconfigparser(defaults=defaults)

Examples

contents of read.ini:

[app]
debug = yes

test.py:

from simpleconfigparser import simpleconfigparser

config = simpleconfigparser()
config.read('read.ini')

print(config.app.debug)
print(config.app.getboolean('debug'))
print(config['app']['debug'])
print(config['app'].getboolean('debug'))
config.app.debug = no
with open('new.ini', 'wb') as handle:
    config.write(handle)

License

MIT - See LICENSE file

Release History

Release History

This version
History Node

0.1.0

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
SimpleConfigParser-0.1.0.tar.gz (4.5 kB) Copy SHA256 Checksum SHA256 Source Apr 4, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting