Skip to main content
https://travis-ci.org/kisom/pysimpleconfig.svg?branch=master

what?

simpleconfig is a Python module that reads INI files into a dictionary. It is both Python 2 and Python 3 compatible.

why?

I’ve written this code several times for a couple projects; I got sick of copying the file over to new project directories.

how?

Both a parse and parse_string function are provided. The former parses config files, and the latter parses a config file serialised into a string.

return value and example

Both parse() and parse_string return a dictionary (see below) where each section is a key at the top level, and is a dictionary of key=value pairs itself. For example, given the config file:

>>> config = """
# random version information
version = 1.0.5

; last modified 1 April 2001 by John Doe
; example taken from wikipedia
[owner]
name=John Doe
organization=Acme Widgets Inc.

[database]
# use IP address in case network name resolution is not working
server=192.0.2.62
port=143
file="payroll.dat"
"""

Parsing this with simpleconfig yields:

>>> import simpleconfig as sc
>>> cfg = sc.parse_string(config)
>>> cfg['owner']['name']
'John Doe'
>>> cfg.owner.name
'John Doe'

Note that the dictionary type returned by the parse functions is actually a kutils.dicts.AttrDictDict, which is derived from the dict type and can be used wherever a dict can.

license

simpleconfig is released under an ISC license.

author

simpleconfig was written by Kyle Isom <coder@kyleisom.net>.

additional

The module is only tested for compatibility against Python 2.7 and Python 3.3+. There are no guarantees (or attempts) at compatibility with previous version of Python.

The docs are on RTD.

The source for simpleconfig is online:

Release files for simpleconfig 2.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 simpleconfig 2.0
File Size Uploaded
simpleconfig-2.0.tar.gz 2.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for simpleconfig 2.0
File Interpreter ABI Platform
simpleconfig-2.0-py3-none-any.whl Python 3 none any Details
simpleconfig-2.0-py2-none-any.whl Python 2 none any Details

Total release size: 12.3 kB

Release files / simpleconfig-2.0.tar.gz

Download URL simpleconfig-2.0.tar.gz
Size 2.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c237d528a71218a20d9c3f85d4b37e03d628ee9effe501e180a378f903c649e8
BLAKE2b-256 checksum
How to use checksums
1649e7df279b3cae25790f32d495e519a568102cada5a4f0c409219b683e0ee7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / simpleconfig-2.0-py3-none-any.whl

Download URL simpleconfig-2.0-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39ef3997931572c8365fb65fdc31686f1f91554d5ffb1025563a1df695b66f81
BLAKE2b-256 checksum
How to use checksums
6fe21ff596a21a89ffa73c66f01db8a82a200944bbeec4ea4ae1970d0ddddaa7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / simpleconfig-2.0-py2-none-any.whl

Download URL simpleconfig-2.0-py2-none-any.whl
Size 4.9 kB
Tags Python 2
SHA-256 checksum
How to use checksums
29301670b95e3b47d78d123c4f0d89cd0f44b5d46e5ff8d95ba051c9d5d6d404
BLAKE2b-256 checksum
How to use checksums
56a0b9d7200088a421f25007ef15811b4bb26f2339e3d6a6d0e6ff4587a12059
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

2.0 This release

3 release files

1.0

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