A Python library to create/load an application configuration file.
Project description
appconfigpy
Summary
A Python library to create/load an application configuration file.
Installation
pip install appconfigpy
Usage
Create A Configuration File
# configure.py
import appconfigpy
app_config_manager = appconfigpy.ConfigManager(
config_name="example",
config_item_list=[
appconfigpy.ConfigItem(
name="token",
initial_value=None,
prompt_text="API Token",
default_display_style=appconfigpy.DefaultDisplayStyle.PART_VISIBLE
),
appconfigpy.ConfigItem(
name="path",
prompt_text="Path",
initial_value=".",
),
])
try:
app_config_manager.configure()
except KeyboardInterrupt:
print()
$ ./configure.py
API Token: abcdefghijklmn
Path [.]:
$ cat ~/.example
{
"path": ".",
"token": "abcdefghijklmn"
}
Load A Configuration File
# load.py
import appconfigpy
app_config_manager = appconfigpy.ConfigManager(
config_name="example",
config_item_list=[
appconfigpy.ConfigItem(
name="token",
initial_value=None,
prompt_text="API Token",
default_display_style=appconfigpy.DefaultDisplayStyle.PART_VISIBLE
),
appconfigpy.ConfigItem(
name="path",
prompt_text="Path",
initial_value=".",
),
])
print(app_config_manager.load())
$ ./load.py
{'token': 'abcdefghijklmn', 'path': '.'}
Dependencies
Python 2.7+ or 3.4+
Optional Dependencies
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
appconfigpy-0.0.8.tar.gz
(5.9 kB
view hashes)
Built Distribution
Close
Hashes for appconfigpy-0.0.8-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 306a89ca34f63d41e6913791f78b3ccc8a1bc73feac91699f0a16ed85f5a2813 |
|
MD5 | 9a5a072a60476496d3e28a30def925da |
|
BLAKE2b-256 | 8b7b102dac704df8d62dd475f7028e275fb0ddb8f34f5ffb5aa33d304dd1fc07 |