pyconfigurationmanager


Namepyconfigurationmanager JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/coldsofttech/pyconfigurationmanager
SummaryThe pyconfigurationmanager package provides a set of utilities for managing configuration settings in
upload_time2024-04-11 20:25:16
maintainerNone
docs_urlNone
authorcoldsofttech
requires_pythonNone
licenseMIT
keywords configuration configuration-management config-manager
VCS
bugtrack_url
requirements pyloggermanager pytest setuptools
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # `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:
```bash
pip install pyconfigurationmanager
```

## Usage

````python
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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/coldsofttech/pyconfigurationmanager",
    "name": "pyconfigurationmanager",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "configuration, configuration-management, config-manager",
    "author": "coldsofttech",
    "author_email": null,
    "download_url": null,
    "platform": null,
    "description": "# `pyconfigurationmanager`\nThe 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.\n\n## Installation\nConfiguration Manager can be installed using pip:\n```bash\npip install pyconfigurationmanager\n```\n\n## Usage\n\n````python\nfrom pyconfigurationmanager import ConfigurationManager\n\n# Load the configuration file\nConfigurationManager.load_config(file_path='config.json')\n\n# Retrieve a string value\nstring_value = ConfigurationManager.get_config_value('sample_string')\nprint(string_value)  # Output: 'string_of_sample'\n\n# Retrieve an integer value\ninteger_value = ConfigurationManager.get_config_value('sample_integer')\nprint(integer_value)  # Output: 100\n\n# Retrieve a dictionary value\ndict_value = ConfigurationManager.get_config_value('sample_others')\nprint(dict_value)\n# Output:\n# {'sample_boolean': True, 'sample_list': ['list_1', 'list_2']}\n\n# Retrieve a boolean value\nboolean_value = ConfigurationManager.get_config_value('sample_others.sample_boolean')\nprint(boolean_value)  # Output: True\n\n# Retrieve a list value\nlist_value = ConfigurationManager.get_config_value('sample_others.sample_list')\nprint(list_value)  # Output: ['list_1', 'list_2']\n````\n\n# Documentation\n## `pyconfigurationmanager`\n### `ConfigurationManager`\nThe ConfigurationManager class is the heart of the package, offering a suite of functionalities for managing configuration settings.\n\n#### Methods\n- `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.\n- `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 '.'.\n\n### `ConfigurationManagerError`\nThis error class is employed to signal any issues or errors encountered during the execution of ConfigurationManager methods.\n\n#### Methods\n- `__init__(message: Optional[str])` - Initialize a ConfigurationManagerError\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "The pyconfigurationmanager package provides a set of utilities for managing configuration settings in",
    "version": "0.1.2",
    "project_urls": {
        "Homepage": "https://github.com/coldsofttech/pyconfigurationmanager"
    },
    "split_keywords": [
        "configuration",
        " configuration-management",
        " config-manager"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6f8daaa426b9a4130951fe29545fa8de1e9d6074c7f5a11fb77fc90158662e6f",
                "md5": "a3d00beeb190e11785803cca0d7a51ba",
                "sha256": "a3a435db27b1d90a0b24da7ee06aeeffaea282109b8a764fd1565a5a3d1e1c0d"
            },
            "downloads": -1,
            "filename": "pyconfigurationmanager-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a3d00beeb190e11785803cca0d7a51ba",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5915,
            "upload_time": "2024-04-11T20:25:16",
            "upload_time_iso_8601": "2024-04-11T20:25:16.897995Z",
            "url": "https://files.pythonhosted.org/packages/6f/8d/aaa426b9a4130951fe29545fa8de1e9d6074c7f5a11fb77fc90158662e6f/pyconfigurationmanager-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-11 20:25:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "coldsofttech",
    "github_project": "pyconfigurationmanager",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "pyloggermanager",
            "specs": []
        },
        {
            "name": "pytest",
            "specs": [
                [
                    "~=",
                    "7.4.0"
                ]
            ]
        },
        {
            "name": "setuptools",
            "specs": [
                [
                    "~=",
                    "69.2.0"
                ]
            ]
        }
    ],
    "lcname": "pyconfigurationmanager"
}
        
Elapsed time: 0.25377s