Package: user-config
user_configManage user configuration for python projects.For easy and well-documented user-defined configuration.Linkshome:https://github.com/nihlaeth/user_configpypi:https://pypi.python.org/pypi/user-configdocumentation:http://user-config.readthedocs.io/en/latest/BadgesFallback ordercommand line argumentsuser config files in~/.config/<app>/config.<extension>global config files in/etc/xdg/<app>/config.<extension>default valuesFor directories on operating systems than linux, see:https://github.com/ActiveState/appdirsConfig formatSupported out of the box: iniOther config formats can be supported via plug-ins.RequirementsLinux, or Os X, or Windows (but not Windows Vista)python 2.7 or newer (python 3.6 supported)relatively new versions of setuptools and pip (version requirement to follow)ExamplesSimple configuration example"""Usage example for user_config."""fromuser_configimportConfig,Section,StringOption,IntegerOptionclassMyConfig(Config):"""This will be displayed in the configuration documentation."""application="my_application"author="me"classGeneralSection(Section):"""General information."""name=StringOption(doc="your name",default="unknown person")age=IntegerOption(doc="your age",required=True)general=GeneralSection()classAddressSection(Section):"""shipping address"""street=StringOption(doc="street including house number",required=True)city=StringOption(required=True)address=AddressSection(required=False)if__name__=="__main__":CONFIG=MyConfig()print("hello there,{}!".format(CONFIG.general.name))Command line help text:$pythonexamples/simple_example.py-husage:my_application[-h][--generate-config][--cityCITY][--streetSTREET][--ageAGE][--nameNAME]Thiswillbedisplayedintheconfigurationdocumentation.Commandlineargumentsoverwriteconfigurationfoundin:/root/.config/my_application/config.cfg/etc/xdg/my_application/config.cfgoptionalarguments:-h,--helpshowthishelpmessageandexit--generate-configprintacompleteconfigurationfilewithcurrentsettings--cityCITY--streetSTREETstreetincludinghousenumber--ageAGEyourage--nameNAMEyournameCommand line use with default value:$pythonexamples/simple_example.py--age211hellothere,unknownperson!Command line use without required value:$pythonexamples/simple_example.pyTraceback(mostrecentcalllast):File"examples/simple_example.py",line29,in<module>CONFIG=MyConfig()File"/git/user_config/user_config/user_config/__init__.py",line622,in__init__self._elements[element].validate_data(self._data)File"/git/user_config/user_config/user_config/__init__.py",line464,invalidate_dataself._elements[element].validate_data(self._data)File"/git/user_config/user_config/user_config/__init__.py",line380,invalidate_dataself.element_name))user_config.MissingData:novaluewasprovidedforrequiredoptionageCommand line use:$pythonexamples/simple_example.py--age211--namemystery_userhellothere,mystery_user!Generate configuration file:$pythonexamples/simple_example.py--generate-config## This will be displayed in the configuration documentation.[general]## General information.## your name
# name = unknown personname=tamara## your age
## REQUIRED
# age =age=[address]## shipping address
## OPTIONAL_SECTION## street including house number
## REQUIRED
# street =street=## REQUIRED
# city =city=Documentation$pipinstall-e".[doc]"$pythonsetup.pybuild_sphinxTestingpytestpytest-covcoveragecodacy-coverage$python-mpytest--cov=user_config--cov-reportxmlPlanned featuresmulti matching sections / wildcard sectionsyaml config formatjson config formathook for overwriting config from database or other storage function