A Python library to create/load an application configuration file.
Project description
Summary
A Python library to create/load an application configuration file.
Installation
pip install appconfigpy
Usage
Create a configuration file from user inputs
# configure.py
from appconfigpy import ConfigItem, ConfigManager, DefaultDisplayStyle
app_config_mgr = ConfigManager(
config_name="example",
config_item_list=[
ConfigItem(
name="token",
initial_value=None,
prompt_text="API Token",
default_display_style=DefaultDisplayStyle.PART_VISIBLE,
),
ConfigItem(name="path", prompt_text="ABC Path", initial_value="."),
],
)
app_config_mgr.configure()
$ ./configure.py
API Token: abcdefghijklmn
ABC Path [.]:
$ cat ~/.example
{
"path": ".",
"token": "abcdefghijklmn"
}
Load a configuration file
# load.py
from appconfigpy import ConfigItem, ConfigManager, DefaultDisplayStyle
app_config_mgr = ConfigManager(
config_name="example",
config_item_list=[
ConfigItem(
name="token",
initial_value=None,
prompt_text="API Token",
default_display_style=DefaultDisplayStyle.PART_VISIBLE,
),
ConfigItem(name="path", prompt_text="ABC Path", initial_value="."),
],
)
print(app_config_mgr.load())
$ ./load.py
{'token': 'abcdefghijklmn', 'path': '.'}
Dependencies
Python 2.7+ or 3.5+
Optional Dependencies
- logbook
Logging using logbook if the package installed
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.4.0.tar.gz
(7.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file appconfigpy-0.4.0.tar.gz.
File metadata
- Download URL: appconfigpy-0.4.0.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7945370b6e95a9a0bf71724359da1726d6043582db5bb3bd78b1e1cd52c99f7b
|
|
| MD5 |
ce600cd5652b8a2091b55f6edc5dc07f
|
|
| BLAKE2b-256 |
f87448a6eef7b245e5b84eec2326ca4d92af36fb63499602aa8694999466f7e4
|
File details
Details for the file appconfigpy-0.4.0-py2.py3-none-any.whl.
File metadata
- Download URL: appconfigpy-0.4.0-py2.py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18bdd9c24f899f0ab7a7c9da60367ca391a17eedafb5ac8b55e4ebe3a5a61943
|
|
| MD5 |
b427e417c8ad5d2b25d406548643554e
|
|
| BLAKE2b-256 |
ae27dee966ed5cf14bbddf57e1ee7af0ad095e2c62cf02c8bde73e932a65409d
|