Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

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+

Release History

This version
History Node

0.0.3

History Node

0.0.2

History Node

0.0.1

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.3-py2.py3-none-any.whl
(8.0 kB) Copy SHA256 Hash SHA256
Wheel 2.7 Nov 3, 2017
appconfigpy-0.0.3.tar.gz
(5.3 kB) Copy SHA256 Hash SHA256
Source None Nov 3, 2017

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting