Module reahl.component.config

Classes in this module manage system configuration.

Each Reahl component can have its own config file. The config files of all components used by an application are stored in a common directory. If the config file for a component is missing, defaults are assumed.

Config files are Python code. Inside a config file, an instance of the component’s Configuration is bound to a variable name.

Configuration

class reahl.component.config.Configuration

A collection of ConfigSettings for a component. To supply configuration for your component, subclass from this class and assign each wanted ConfigSetting as a class attribute. Assign the required filename and config_key class attributes in your subclass as well. The resultant class should also be listed in the .reahlproject file of your component in a <configuration> element.

filename = None

The name of the config file from which this Configuration will be read.

config_key = None

The variable name to which an instance of this Configuration will be bound when reading filename

ConfigSetting

class reahl.component.config.ConfigSetting(default=<class 'reahl.component.config.ExplicitSettingRequired'>, description='No description supplied', dangerous=False, automatic=False)

Used to define one configuration setting on a Configuration.

Parameters:
  • default – The default value to be used if not specified in a config file.
  • description – A user readable description explaining what this ConfigSetting is for.
  • dangerous – Set this to True, if a warning should be emitted when used with the supplied default value.
  • automatic – Set this to True for a ConfigSetting which is meant to be used for dependency injection.

EntryPointClassList

class reahl.component.config.EntryPointClassList(name, description='Description not supplied')

A ConfigSetting which is not set by a user at all – rather, its value (a list of classes or other importable Python objects) is read from the entry point named name.

Parameters:
  • name – The name of the entry point to read.
  • description – (See ConfigSetting)