config#

globalconfig#

from toolbox.config import globalconfig
make_config(dictionary, **kwargs)[source]#

Creates a global configuration that can be accessed anywhere during runtime.

This function is a useful replacement to passing configuration classes between classes. Instead of creating a Config object, one may use make_config() to create a global runtime configuration that can be accessed by any module, function, or object.

Parameters:
  • dictionary (Optional[dict]) – Dictionary to create global configuration with.

  • kwargs – Arguments to make global configuration with.

Example

from toolbox.config.globalconfig import make_config

make_config(hello="world")
Return type:

None

config()[source]#

Access global configuration as a dict.

Example

from toolbox.config.globalconfig import config

print(config()['hello']) # >>> 'world'
Return type:

dict

conf()[source]#

Access global configuration as a toolbox.collections.namedtuple.nestednamedtuple.

Example

from toolbox.config.globalconfig import conf

print(conf().hello) # >>> 'world'
Return type:

namedtuple