ConfigFilesManager-0.1b1
توضیحات
A python module to a easy manage configs files for applications
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | ConfigFilesManager-0.1b1 |
| نام | ConfigFilesManager |
| نسخه کتابخانه | 0.1b1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | eamanu |
| ایمیل نویسنده | eamanu@eamanu.com |
| آدرس صفحه اصلی | https://github.com/orgs/PyModuleManage |
| آدرس اینترنتی | https://pypi.org/project/ConfigFilesManager/ |
| مجوز | GPL-v3+ |
# ConfigFilesManager
A python module to a easy manage configs files for applications
# Why?
This module help you to manage configurations files of python applications.
So, you can check the value or type of a variable in configuration file, without to
have write more code. You can check if a required variables is present or not. And then
raise (or not) Exceptions.
# Sample
For example if we have a config file like this:
```ini
[CONFIG]
# Configuration file
IP = 127.0.0.1
PORT = 27017
DB_NAME = CoreDatabase
INSTALL_PATH = /home/eamanu/dev/test_coremanagement
; timeout on milliseconds. 5000 ms = 5 seconds
TIMEOUT_DB_MS = 5000
```
If we want all the variables to be obligatory, we have to mark the variable
like 'required'. Then, we have to say what is the type is the variable.
Our code is the next:
```python
from configFilesManager import configFilesManager
schema = {'CONFIG': {'IP': {'type': 'str', 'required': True},
'TIMEOUT_DB_MS': {'type': 'int', 'required': True},
'PORT': {'type': 'int', 'required': True},
'DB_NAME': {'type': 'str', 'required': True},
'INSTALL_PATH': {'type': 'str', 'required': True}}}
config = 'path/to/config.ini'
cfm = configFilesManager(config, schema)
cfm.run_check()
```
If whole it's ok, you don't have catch any exception, but if some is bad you
will have a Exception raised. You could access to the values of the configs
parsed on `cfm.parser_config_dict` dict
# Contribution
Please see [CONTRIBUTE.md](CONTRIBUTE.md)
نحوه نصب
نصب پکیج whl ConfigFilesManager-0.1b1:
pip install ConfigFilesManager-0.1b1.whl
نصب پکیج tar.gz ConfigFilesManager-0.1b1:
pip install ConfigFilesManager-0.1b1.tar.gz