Skip to main content

A Python library to create/load an application configuration file.

Project description

Summary

A Python library to create/load an application configuration file.

PyPI package version Supported Python versions

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

Project details


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

appconfigpy-0.4.0-py2.py3-none-any.whl (8.2 kB view details)

Uploaded Python 2Python 3

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

Hashes for appconfigpy-0.4.0.tar.gz
Algorithm Hash digest
SHA256 7945370b6e95a9a0bf71724359da1726d6043582db5bb3bd78b1e1cd52c99f7b
MD5 ce600cd5652b8a2091b55f6edc5dc07f
BLAKE2b-256 f87448a6eef7b245e5b84eec2326ca4d92af36fb63499602aa8694999466f7e4

See more details on using hashes here.

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

Hashes for appconfigpy-0.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 18bdd9c24f899f0ab7a7c9da60367ca391a17eedafb5ac8b55e4ebe3a5a61943
MD5 b427e417c8ad5d2b25d406548643554e
BLAKE2b-256 ae27dee966ed5cf14bbddf57e1ee7af0ad095e2c62cf02c8bde73e932a65409d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page