pyplugin.settings

pyplugin.settings.DYNAMIC_REQUIREMENTS = ('dynamic_requirements', <class 'bool'>, 'PYPLUGIN_DYNAMIC_REQUIREMENTS', (True, False), True)

Loading Plugin 1 within Plugin 2 will dynamically set Plugin 1 as a requirement for Plugin 2 as if it was explicitly defined in requires.

pyplugin.settings.ENFORCE_TYPE = ('enforce_type', <class 'bool'>, 'PYPLUGIN_ENFORCE_TYPE', (True, False), False)

Throw an error if a plugin is loaded that returns an object that does not match its defined type.

pyplugin.settings.IMPORT_LOOKUP = ('import_lookup', <class 'bool'>, 'PYPLUGIN_IMPORT_LOOKUP', (True, False), True)

When using the lookup_plugin() function, (e.g. in dependency lookups), default to using importlib as a fallback to find and register the plugin.

pyplugin.settings.INFER_TYPE = ('infer_type', <class 'bool'>, 'PYPLUGIN_INFER_TYPE', (True, False), True)

Attempt to infer the type of defined plugins upon initialization and upon loading.

pyplugin.settings.REGISTER_MODE = ('register_mode', <class 'str'>, 'PYPLUGIN_REGISTER_MODE', ('eager', 'replace', 'transient', 'replace+transient'), 'eager')

replace the already registered plugin, transient: registering a plugin with same name will replace the current plugin, replace+transient is a combination of the two.

Type:

Handles registering plugins on initialization. eager

Type:

register as normal, replace

class pyplugin.settings.Settings(**kwargs)[source]

Bases: object

dynamic_requirements
enforce_type
import_lookup
infer_type
merge(data)[source]
register_mode
to_dict()[source]
pyplugin.settings.set_flag(setting, value)[source]
Parameters:
  • setting (str) – The setting name to set

  • value (Any) – The value to set

pyplugin.settings.unset_flag(setting)[source]
Parameters:

setting (str) – The setting name to unset

Returns:

The previously set value or None

Return type:

Any | None

pyplugin.settings.with_flag(setting, value)[source]