hb-config is utility for easy to configure your python package.
Do not use any boilerplate code.
- Supports files in three formats: .json and .yaml
- Access property using __getattr__ function
Config.TOKEN
- Edit property using __setattr__ function
Config.TOKEN = "{token}"
- every config data's type is dict
- Config instance is Singleton.
using pip
$ pip install hb-config
or clone repository
python setup.py install
- config3.yml example
project: hb-config
example: true
bot:
in_bot:
test: haha
simple: wow
- Handle example
>>> from hbconfig import Config
>>> Config("config3")
>>> Config
Read config file name: config3.yml
{
"project": "hb-config",
"example": true,
"bot": {
"in_bot": {
"test": "haha",
"simple": "wow"
}
}
}
>>> Config.bot.in_bot
{
"test": "haha"
"simple": "wow"
}
>>> Config.project
'hb-config'
>>> Config.bot.in_bot.simple
'wow'