Skip to main content
CI/CD Pipeline Documentation Status Code Coverage

dkconfig – command line access to ConfigParser

Installing from PyPI

pip install dkconfig

Basic usage

Most of the methods of ConfigParser (https://docs.python.org/2/library/configparser.html#ConfigParser.RawConfigParser) should be usable in a relatively obvious way, however, dkconfig tries to give you some sane defaults to make your life easier, e.g. it will create files/headers/keys that don’t exist:

/tst> ll
/tst> dkconfig foo.ini set header key value
/tst> cat foo.ini
[header]
key = value

Sections can be added:

/tst> dkconfig foo.ini add_section header2
/tst> cat foo.ini
[header]
key = value

[header2]

re-adding them is a no-op (and doesn’t throw an exception):

/tst> dkconfig foo.ini add_section header2
/tst> cat foo.ini
[header]
key = value

[header2]

the values command pretty prints the keys and values:

/tst> dkconfig foo.ini values
key => value

the dos command will output the key/values as dos set commands:

/tst> dkconfig foo.ini dos
set "KEY=value"

from a batch file you would use it like this:

dkconfig foo.ini dos > tmp.bat && call tmp.bat && del tmp.bat

the bash command does the same for bash, and you’ll use it together with eval:

eval $(dkconfig foo.ini bash)

You can read values directly into dos variables in the regular way:

> for /f "delims=" %a in ('dkconfig foo.ini get header key') do @set KEY=%a
> echo %KEY%
value

Bash has a more sane syntax for this:

bash$ export KEY=$(dkconfig foo.ini get header key)
bash$ echo $KEY
value

The appropriate error returns are set if a key is missing:

/tst> dkconfig foo.ini get header missing
/tst> echo %ERRORLEVEL%
1

/tst> dkconfig foo.ini get header key
value
/tst> echo %ERRORLEVEL%
0

Metadata

Release files for dkconfig 0.2.2

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

Source distribution (sdist)

Source distribution for dkconfig 0.2.2
File Size Uploaded
dkconfig-0.2.2.tar.gz 6.6 kB Details

Built distribution (wheel)

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

Total release size: 14.1 kB

Release files / dkconfig-0.2.2.tar.gz

Download URL dkconfig-0.2.2.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b11e3d374be0028150d7d3a959b505cc3fcfb250d945bef105c701fde1916f5e
BLAKE2b-256 checksum
How to use checksums
b75d197741f1dd499020550e6c57a85b0de725e2110fa5974c23c599dbf871f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / dkconfig-0.2.2-py2.py3-none-any.whl

Download URL dkconfig-0.2.2-py2.py3-none-any.whl
Size 7.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
bd960675b6f82de60136b2aec583762957ec478a1da079593021d666a4fb2d02
BLAKE2b-256 checksum
How to use checksums
7063888844ae051a591db50f4faa8a6c337cde3a2785385b8ce1842155512e2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.4

3 release files

0.1.2

3 release files

0.1.0

3 release files

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