spines.config

Spines configuration subpackage

class spines.config.Config(*args, **kwargs)[source]

Bases: spines.config.base.BaseConfig

Primary configuration class for spines.

add_plugin(plugin: Union[str, spines.config.core.PluginConfig], update: bool = False) → None[source]

Adds a plugin configuration to this config object

Parameters
  • plugin (str or PluginConfig) – Plugin to add to this configuration.

  • update (bool, optional) – Whether or not to update the existing plugin configuration with the new one or to replace it (default is False, replace).

plugins

Plugin configurations in this configuration.

Type

dict

remove_plugin(plugin: str) → Optional[spines.config.core.PluginConfig][source]

Removes a plugin configuration from this config object

Parameters

plugin (str) – Name of the plugin to remove.

Returns

The plugin configuration removed from this configuration.

Return type

PluginConfig

spines.config.get_config(setting: str = _MISSING, default: Any = _MISSING) → spines.config.core.Config[source]

Get the global spines configuration

Parameters
  • setting (str, optional) – Setting(s) to get from the global configuration.

  • default (optional) – Value to return if setting is not set (if not given an error will occur if accessing a non-existant setting).

Returns

The global configuration settings for the current spines project or the values for the settings given.

Return type

Config or dict

Raises

ValueError – If the given setting(s) doesn’t exist and no default value is provided.

spines.config.load_config(*path, update: bool = False) → None[source]

Loads the global spines configuration

Parameters
  • path (str (or multiple), optional) – File(s) to load the configuration from (defaults to the correct spines hierarchy for configuration files).

  • update (bool, optional) – Update the current configuration as opposed to replacing it with the newly loaded on (default is False, replace it).

class spines.config.PluginConfig(name: str, *args, **kwargs)[source]

Bases: spines.config.base.BaseConfig

Plugin configuration class for spines.

name

Name of the plugin this configuration is for.

Type

str

spines.config.set_config(section: Optional[str] = None, **settings) → None[source]

Sets global configuration setting(s)

Parameters
  • section (str, optional) – Configuration section to set settings in.

  • settings – The setting(s) in the global configuration to update.