Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
appconfigpy-0.0.6-py2.py3-none-any.whl (6.9 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Aug 19, 2018
appconfigpy-0.0.6.tar.gz (5.9 kB) Copy SHA256 hash SHA256 Source None Aug 19, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page