A convenient utility for managing configurations.
Installation
python3 -m pip install config-kit
Usage
Use in Python
from config_kit.core import ConfigKit
# Intialize a ConfigKit instance
config = ConfigKit(config_file='config.ini', section='common')
# Set configuration items
config.username = 'admin'
config.password = '123456'
# Remove configuration items
del config.username
# Save configuration items
config.save()
# Retrieve configuration items
print(config.username)
print(config.password)
# Use a context manager to automatically save changes
with ConfigKit(config_file='config.ini') as config:
config.host = 'localhost'
config.port = 8080
Use in Shell
config-kit --help
config-kit -c config.ini -s common sub-command [arguments]
# Set configuration items
config-kit set username admin
config-kit set password 123456
# Remove configuration items
config-kit remove username
# Retrieve configuration items
config-kit get username
config-kit get password
Configuration File Format
The configuration file is in the INI format, with sections and key-value pairs. For example:
[common]
username = admin
password = 123456
[database]
host = localhost
port = 3306
Metadata
Release files for config-kit 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| config_kit-1.0.0.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| config_kit-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.8 kB
Release files / config_kit-1.0.0.tar.gz
| Download URL | config_kit-1.0.0.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
421f1d46fa2b969b8ca6684ba3bbc1af331086f02b3f3d3116eaffbe1fe3c3c8
|
|
BLAKE2b-256 checksum How to use checksums |
496f29eeaf9893301c7a48baa133f48658eee5a975a1121ad3bb936149bc4cfe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.8
|
Release files / config_kit-1.0.0-py3-none-any.whl
| Download URL | config_kit-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dc27d1cea39373bafcd2e2c108a564f75e37ca4963045c9bf2e0803d285dbbdd
|
|
BLAKE2b-256 checksum How to use checksums |
10f95b50d1d0a555f2182e09c2f8564426d516051f2ca748bc3bc9d0bcde6938
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.8
|