A common pattern I use on my nontrivial programs is to have a class that parses out a config file (usually YAML), and makes the items in the values in the config available as properties on the class.I then import this class elsewhere in my program anytime I need to refer to the user-provided configuration#config.ymlapp_name: 'Awesome Program'base_url: 'http://example.com/awesome'#appconfig.pyimport yaml   class AppConfig(object):    '''Imports the contents of config.yml as property values'''    def __init__(self):        with open('config.yml') as cfgfile:            y = yaml.load(cfgfile)            for key in y:                setattr(self, key, y[key])CONF = AppConfig()#app.pyfrom appconfig import CONFappname = CONF.app_namebase_url = CONF.base_url# and so forthHowever, I've noticed that this tends to make certain IDEs unhappy. PyCharm in particular tends to think this kind of global state (even if it's read only) is strange, yellow-flagging any usage of the CONF variable as a low grade implicit required file notice. A conversation on PyCharm's bug tracker, and a couple other conversations on Hacker News imply that this is something I shouldn't be doing. It's definitely convenient, and hasn't gotten me in trouble yet, but is there a better/more idiomatic/saner way I should be handling this? Note that the configuration is entirely read-only, and so synchronization, locking, and so on are concerns that I'm not worried about.
Best practices for configuration files in global (or globally required) variables
design patterns;configuration;globals