Package: yamlsettings
A Settings Configuration Module.A library to help manage project settings, without having to worry about
accidentally checking non-public information, like api keys.  Along with
environment variable support.Example setupPython Code - Base Functionsimportyamlsettingsapp_settings=yamlsettings.load('defaults.yaml')app_settings.update(yamlsettings.load('settings.yaml'))yamlsettings.update_from_env(app_settings)user=app_settings.myproj.databases.primary_sql.userdefaults.yml - Default Settings for Project (tracked)---# Program Defaults, do not edit this file!!!# All values should be overridden in the following ways:# 1. In the 'settings.yaml' file.# 2. With environment variables. Example myproj.databases.primary_sql.user can#    be overridden with MYPROJ_DATABASES_PRIMARY_SQL_USER.myproj:databases:primary_sql:user:my_userpasswd:password_herehost:db-bouncer-01.postgres.com:5432db:postgrescompress:trueengine:postgresqlsplunk:user:splunk_user_herepasswd:password herehost:splunk.comport:8089redis:redis_host:127.0.0.1redis_port:6379flask_config:DEBUG:FalseSECRET_KEY:hard key to guess and keep values secretdebug_sql:falsedebug_profiler:falsecache_routes:truelogging_config:version:1disable_existing_loggers:Falseformatters:light:format:'%(asctime)s[%(levelname).1s]%(name)s:%(message)s'datefmt:'%Y-%m-%d%H:%M:%S'verbose:format:'%(asctime)s%(levelname)8s(%(name)s):%(message)s'datefmt:''handlers:console:class:logging.StreamHandlerlevel:DEBUGformatter:lightstream:ext://sys.stdoutslack:class:api.slackLogHandler.BufferingSlackWebHookHandlerlevel:INFOformatter:lightcapacity:100organization:KyleJamesWalkertoken:need_thischannel:'#services'username:my-proj-loggericon_emoji:':happy_panda:'noid:class:logging.NullHandlerloggers:requests:level:NOTSEThandlers:[noid]propagate:noroot:level:NOTSEThandlers:-consolesettings.yml - Custom Settings (untracked)---myproj:databases:primary_sql:user:rootpasswd:godsplunk:user:real_userpasswd:pa$$wordflask_config:SECRET_KEY:sdfasjksdfASFAS23423f@#$%!$#VR@%UQ%logging_config:handlers:slack:token:123243294832104981209root:handlers:-console-slackExample package resource loading"""Parameters that can be passed are:
 resource: The resource to load from the package (default: settings.yaml)
 env: When set the yamldict will update with env variables (default: true)
 prefix: Prefix for environment loading (default: None)
 persist: When set the yamldict will only be loaded once. (default: true)
"""yamlsettings.load('package://example')yamlsettings.load('package://example?resource=diff.yaml')yamlsettings.load('package://example?prefix=MY_FUN&persist=false')PluginsThis project also supports plugins. The base project has two plugins:file: Loads from the file system.package: Loads settings from a package resource.Example Plugin:setup.pyfromsetuptoolsimportsetupsetup(name='yamlsettings-example',version='1.0.0',author='Kyle Walker',author_email='KyleJamesWalker@gmail.com',description='Quick Example',requirements=['yamlsettings'],py_modules=['yamlsettings_example'],entry_points={'yamlsettings10':['ext = yamlsettings_example:ZxcExtension',],},)yamlsettings_example.pyfromyamlsettings.extensions.baseimportYamlSettingsExtensionclassZxcExtension(YamlSettingsExtension):"""Quick Example Plugin

    Standard file opener, but will merge in values passed to kwargs
    """protocols=['zxc']@classmethoddefload_target(cls,scheme,path,fragment,username,password,hostname,port,query,load_method,**kwargs):full_path=(hostnameor'')+pathobj=load_method(open(full_path,**query))# Load all returns a generator list of configurationsmany=isinstance(obj,types.GeneratorType)obj=list(obj)ifmanyelseobjifmany:forxinobj:x.update(kwargs)else:obj.update(kwargs)returnobjusageimportyamlsettingsyamlsettings.load("zxc://defaults.yaml",foo='bar')# Note: this is automatically detected when the extension is installed# alternatively the extension can be manually registered with:yamlsettings.registry.add(ZxcExtension)