配置python库的简单方法
figcon的Python项目详细描述
figcon
使用纯python文件配置应用程序的简单方法。
快速启动
# contents of default config (base_config.py)
bob = 1
harry = {0: 1, 1: 3}
# contents of secondary config (~/config.py)
bob = 2
harry = {1: 2, 3: 4}
# contents of primary config (config.py)
bill = 4
harry = {1: 6}
# now use the configuration:
from figcon import Figcon
# give figcon a path to the default config file
config = Figcon(default_path='base_config', primary_path='config.py',
secondary_path='~')
# objects are updated based on lowest priority (default) to highest (primary)
assert config.bob == 2
assert config.harry == {0:1, 1: 6, 3:4}
功能
- 使用默认配置文件、主配置文件和辅助配置文件的三步分层配置。
- 配置文件是纯Python,允许大量的灵活性。
- 如果你不信任你的用户,就不要用这个。