带数据验证的服务器配置信息库
Project description
viConfig
一个可以进行数据验证的服务器配置信息库
目录
安装
pip install viconfig
使用
定义配置信息
import pathlib
from Config import Config, Field, f_string, f_int, f_folder
def init_config():
config = Config()
config.add_fields([
Field('app', 'name', f_string, 'DATA-API'),
Field('app', 'version', f_string, '1.0.0'),
Field('app', 'description', f_string, '数据表信息管理系统(服务器)'),
Field('app', 'port', f_int, 8005),
])
config_obj = pathlib.Path('config.json')
if config_obj.exists():
config.load_from_json('config.json')
else:
config.save_to_json("config.json")
return config
配置信息获取
config.get('app', 'description')
依赖库
jsonpathlibdecimal
版权说明
该项目签署了MIT 授权许可。详细请查看LICENSE
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
viconfig-0.0.2.tar.gz
(5.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file viconfig-0.0.2.tar.gz.
File metadata
- Download URL: viconfig-0.0.2.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17c91fc0235bf80a664dec4078e0a904cd5d3e24dacaa585c219220d5b20cb11
|
|
| MD5 |
716df32c702de422dc63c2eaf02c3550
|
|
| BLAKE2b-256 |
54a3907af4c2a6d719b0c6aa2e545ba235e9b15fd6d7ea8aeccb678eeacc64a2
|
File details
Details for the file viconfig-0.0.2-py3-none-any.whl.
File metadata
- Download URL: viconfig-0.0.2-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
254db0cbb31453cb4e6607415a9388b72966bbbfe4cd67c36735c471c192db1b
|
|
| MD5 |
47485d5e3509878fc97cfd02bbc36da4
|
|
| BLAKE2b-256 |
e92f967241864adf7326bf2c1db85ca698ebc538dc5dabc757efae74225c89dc
|