简单的python配置文件管理。

confirm的Python项目详细描述


https://api.travis-ci.org/louib/confirm.svghttps://img.shields.io/pypi/v/confirm.svg

简单的Python配置文件管理

确认根据yaml验证配置文件(.ini或yaml格式) 配置架构

安装

$ pip install confirm

示例架构文件

"system":"name":"required":true"description":"Nameofthesystemassociatedwiththeserver.""type":"str""http_server":"listen":"required":true"type":"str""description":"ListeningaddressoftheHTTPserver.""default":"localhost""port":"required":true"type":"int""default":8088"description":"PortoftheHTTPserver.""threading":"initial_pool_size":"description":"Initialnumberofthreadsinthethreadpool.""type":"int""default":10"maximum_pool_size":"description":"Maximumnumberofthreadsinthethreadpool.""type":"int""default":100"deprecated":true

用法

$ confirm validate examples/confirm.yaml project.conf
Error   : Missing required section system.
Error   : Missing required section http_server.
Warning : Deprecated option maximum_pool_size is present in section threading!

confirm也可以作为python库用于验证:

fromconfirm.validatorimportvalidator_from_config_file...result=validator_from_config_file(config_file_path,schema_file_path)result.validate()print(result.is_valid())

许可证

麻省理工学院执照。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java使图像以正确的速度在屏幕上移动,以适应所有显示   内存Java分配:从预先存在/分配的池中分配对象   java这种书写方式?   Java正则表达式查找字符串的开头   java是否可以创建一个类来处理安卓中的所有日志代码(例如log.d(TAG,message))   如何使用Selenium和java单击WebTable任意页面上的WebElement   java解析字符串中的文件名   java刷新JTree内容   java如何覆盖RequestMappingHandler   爪哇数石头、布、剪刀赢了多少   struts中的java无效令牌   swing JTree,优化算法,Java   java Tomcat和SSL:密钥库格式无效