Skip to main content

pyconfigurationmanager

The pyconfigurationmanager package provides a set of utilities for managing configuration settings in Python applications. It includes classes and functions for loading configuration data from files, auditing configuration changes, and ensuring secure access to configuration files.

Installation

Configuration Manager can be installed using pip:

pip install pyconfigurationmanager

Usage

from pyconfigurationmanager import ConfigurationManager

# Load the configuration file
ConfigurationManager.load_config(file_path='config.json')

# Retrieve a string value
string_value = ConfigurationManager.get_config_value('sample_string')
print(string_value)  # Output: 'string_of_sample'

# Retrieve an integer value
integer_value = ConfigurationManager.get_config_value('sample_integer')
print(integer_value)  # Output: 100

# Retrieve a dictionary value
dict_value = ConfigurationManager.get_config_value('sample_others')
print(dict_value)
# Output:
# {'sample_boolean': True, 'sample_list': ['list_1', 'list_2']}

# Retrieve a boolean value
boolean_value = ConfigurationManager.get_config_value('sample_others.sample_boolean')
print(boolean_value)  # Output: True

# Retrieve a list value
list_value = ConfigurationManager.get_config_value('sample_others.sample_list')
print(list_value)  # Output: ['list_1', 'list_2']

Documentation

pyconfigurationmanager

ConfigurationManager

The ConfigurationManager class is the heart of the package, offering a suite of functionalities for managing configuration settings.

Methods

  • load_config(file_path: Optional[str] = 'config.json', secure: Optional[bool] = True, audit: Optional[bool] = False, audit_file_path: Optional[str] = 'audit.log'): Loads configuration settings from a file into memory, with options to enable secure mode and auditing. By default, secure mode is enabled, ensuring that the configuration file has only readable permissions for the user. If auditing is enabled, all configuration accesses are logged for future audit purposes.
  • get_config_value(key: Optional[str] = None): Retrieves the value of a specific configuration setting or the entire configuration if no key is provided. Hierarchical keys can be accessed by separating them with '.'.

ConfigurationManagerError

This error class is employed to signal any issues or errors encountered during the execution of ConfigurationManager methods.

Methods

  • __init__(message: Optional[str]) - Initialize a ConfigurationManagerError

Release files for pyconfigurationmanager 0.1.2

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

Built distribution (wheel)

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

Release files / pyconfigurationmanager-0.1.2-py3-none-any.whl

Download URL pyconfigurationmanager-0.1.2-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3a435db27b1d90a0b24da7ee06aeeffaea282109b8a764fd1565a5a3d1e1c0d
BLAKE2b-256 checksum
How to use checksums
6f8daaa426b9a4130951fe29545fa8de1e9d6074c7f5a11fb77fc90158662e6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.14

Release history Release notifications | RSS feed

This release

0.1.2 This release

1 release file

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