Skip to main content

SimpleConfigParser

https://travis-ci.org/helgi/python-simpleconfigparser.png

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

Metadata

Release files for SimpleConfigParser 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for SimpleConfigParser 0.1.0
File Size Uploaded
SimpleConfigParser-0.1.0.tar.gz 4.5 kB Details

Release files / SimpleConfigParser-0.1.0.tar.gz

Download URL SimpleConfigParser-0.1.0.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d9954518cfb4b980c6854b7d90b231e9822e0909008dbad7320e1e48f9b7face
BLAKE2b-256 checksum
How to use checksums
59c913d37446679227e682778b101a7071d5870f2d0207e3ff4344f3cb30956b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page