Added tag 0.2.0 for changeset 413d4f600190
pkg: prepare 0.2
retire the `sortdict`, now useless since py3 (from 3.6) dicts are insert order sorted
Inireader provides a simple API to handle ini
style files.
Example file myapp.cfg
:
hello = World
[db]
uri = postgresql://babar:celeste@1.2.3.4:5432/mydatabase
[flask]
port = 6666
secret = Azerty#Uiop
[logs]
level=INFO
handler=stdout
You can do the following:
from inireader import reader
cfg = reader('myapp.cfg')
assert cfg.sections() == ['', 'db', 'flask', 'logs']
assert cfg['']['hello'] == 'World'
assert cfg['flask'] == {'port': '6666', 'secret': 'Azerty#Uiop'}
The python stdlib module does not support values out of sections.
The third party ConfigObj
package does not handle '#' caracters within lines
(they are interpreted as comment markers).
It is possible to include a configuration file using the %include
directive:
%include credentials.ini