Skip to main content

Summary

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

PyPI package version Supported Python versions Supported Python implementations CI status of Linux/macOS/Windows

Installation

Install from PyPI

pip install appconfigpy

Install from PPA (for Ubuntu)

sudo add-apt-repository ppa:thombashi/ppa
sudo apt update
sudo apt install python3-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_items=[
        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_items=[
        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 3.7+

Optional Dependencies

Metadata

Release files for appconfigpy 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for appconfigpy 2.0.1
File Size Uploaded Provenance Actions
appconfigpy-2.0.1.tar.gz 8.6 kB Without provenance Details for appconfigpy-2.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for appconfigpy 2.0.1
File Interpreter ABI Platform Actions
appconfigpy-2.0.1-py3-none-any.whl Python 3 none any Details for appconfigpy-2.0.1-py3-none-any.whl

Total release size: 16.7 kB

Release files / appconfigpy-2.0.1.tar.gz

Download URL appconfigpy-2.0.1.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
82e459d20e0f89fad8330395960ba2b16e4ebb9d7cfb42f26a077d4a88b8d4a2
BLAKE2b-256 checksum
How to use checksums
51a05dbaf3c8b45b67350635d0e298913ea020efbd0474cdb13cbeb7aebfadb6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / appconfigpy-2.0.1-py3-none-any.whl

Download URL appconfigpy-2.0.1-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ba7ce752f76622d0bde01ea501892858da27e8be1a5d9936f163452522038b8
BLAKE2b-256 checksum
How to use checksums
795818541de6b0a912b5cdeee21c88fb4c5a5013fa62568411a4b28e500d20ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Security for appconfigpy 2.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page