pyfileconf.plugin package

Submodules

pyfileconf.plugin.default_hooks module

Default behavior to be run on hooks

pyfileconf.plugin.default_hooks.pyfileconf_iter_get_cases(config_updates, runner)[source]

Collect user passed casses by section path str then call itertools.product to produce the cases

Parameters

config_updates (Sequence[Dict[str, Any]]) – list of kwarg dictionaries which would normally be provided to .update

Return type

List[Tuple[Dict[str, Any], …]]

Returns

config cases to be run

pyfileconf.plugin.default_hooks.pyfileconf_iter_update_for_case(case, runner)[source]

Called in PipelineManager.run_iter and IterativeRunner to take the case containing all the updates and actually run the updates, before running this case.

Parameters
  • case (Tuple[Dict[str, Any], …]) – tuple of kwarg dictionaries which would normally be provided to .update

  • runner (IterativeRunner) – IterativeRunner which has been constructed to call iteration

Returns

None

pyfileconf.plugin.default_hooks.pyfileconf_post_config_changed(manager, new_config, updates, section_path_str)[source]

Refresh dependent configs after config change

Parameters
  • manager (ConfigManager) – the config manager in which the changing config resides

  • new_config (ConfigBase) – the config after any changes

  • updates (Dict[str, Any]) – the updates which were made to the config

  • section_path_str (str) – the section path string which can be used to look up the config

Return type

None

Returns

None

Notes

Only called if the action actually modified the config

pyfileconf.plugin.default_hooks.pyfileconf_pre_update_batch(pm, updates)[source]
Return type

Iterable[dict]

pyfileconf.plugin.hookspecs module

Contains the hooks which may be attached to in creating plugins

pyfileconf.plugin.hookspecs.pyfileconf_iter_get_cases(config_updates, runner)[source]

Called in PipelineManager.run_iter and IterativeRunner to take the user passed config updates and return the config cases to be run

Parameters
  • config_updates (Sequence[Dict[str, Any]]) – list of kwarg dictionaries which would normally be provided to .update

  • runner (IterativeRunner) – IterativeRunner which has been constructed to call iteration

Return type

List[Tuple[Dict[str, Any], …]]

Returns

config cases to be run

pyfileconf.plugin.hookspecs.pyfileconf_iter_modify_cases(cases, runner)[source]

Called in PipelineManager.run_iter and IterativeRunner to take the collected config cases to be run and modify them in place.

Parameters
  • cases (List[Tuple[Dict[str, Any], …]]) – list of tuples of kwarg dictionaries which would normally be provided to .update

  • runner (IterativeRunner) – IterativeRunner which has been constructed to call iteration

Returns

None

pyfileconf.plugin.hookspecs.pyfileconf_iter_update_for_case(case, runner)[source]

Called in PipelineManager.run_iter and IterativeRunner to take the case containing all the updates and actually run the updates, before running this case.

Parameters
  • case (Tuple[Dict[str, Any], …]) – tuple of kwarg dictionaries which would normally be provided to .update

  • runner (IterativeRunner) – IterativeRunner which has been constructed to call iteration

Returns

None

pyfileconf.plugin.hookspecs.pyfileconf_post_config_changed(manager, new_config, updates, section_path_str)[source]

Called just after a config changes, regardless of whether the change is due to update, reset, or refresh.

Parameters
  • manager (ConfigManager) – the config manager in which the changing config resides

  • new_config (ConfigBase) – the config after any changes

  • updates (Dict[str, Any]) – the updates which were made to the config

  • section_path_str (str) – the section path string which can be used to look up the config

Return type

None

Returns

None

Notes

Only called if the action actually modified the config

pyfileconf.plugin.hookspecs.pyfileconf_post_run(results, runner)[source]

Called at the end of PipelineManager.run. Can optionally return additional results which will be appended to the results list. If results is mutable then it can also be modified in place.

Parameters
  • results (Union[Any, List[Any]]) – results from running section/function

  • runner (Runner) – Runner which has been called to run function/section

Return type

Union[Any, List[Any], None]

Returns

additional results, if any

pyfileconf.plugin.hookspecs.pyfileconf_post_update(pm, d_, section_path_str, kwargs)[source]

Called at the end of PipelineManager.update.

Parameters
  • pm (PipelineManager) – The manager responsible for the run

  • d_ – dictionary of config updates

  • section_path_str (str) – section path of config which was updated

  • kwargs (Dict[str, Any]) – dictionary of config updates

Returns

None

Notes

This is not called at the end of PipelineManager.update_batch, for that use pyfileconf_post_update_batch()

pyfileconf.plugin.hookspecs.pyfileconf_post_update_batch(pm, updates)[source]

Called at the end of PipelineManager.update_batch.

Parameters
Returns

None

pyfileconf.plugin.hookspecs.pyfileconf_pre_config_changed(manager, orig_config, updates, section_path_str)[source]

Called just before a config changes, regardless of whether the change is due to update, reset, or refresh.

Parameters
  • manager (ConfigManager) – the config manager in which the changing config resides

  • orig_config (ConfigBase) – the original config, before any changes

  • updates (Dict[str, Any]) – the updates which will be made to the config

  • section_path_str (str) – the section path string which can be used to look up the config

Return type

None

Returns

None

Notes

Only called if the action would actually modify the config

pyfileconf.plugin.hookspecs.pyfileconf_pre_run(section_path_str_or_list, pm)[source]

Called at the beginning of PipelineManager.run. Can optionally return additional section paths to run. If section_path_str_or_list is a list then it can also be modified in place.

Parameters
Return type

Union[str, List[str], ForwardRef, List[ForwardRef], None]

Returns

additional sections/functions to run, if any

pyfileconf.plugin.hookspecs.pyfileconf_pre_update(pm, d_, section_path_str, kwargs)[source]

Called at the beginning of PipelineManager.update. Can optionally return a dictionary of updates which will be used to update the passed dictionary. Can also modify the passed dictionaries in place.

Parameters
  • pm (PipelineManager) – The manager responsible for the run

  • d_ – dictionary of config updates

  • section_path_str (str) – section path of config to be updated

  • kwargs (Dict[str, Any]) – dictionary of config updates

Return type

Optional[Dict[str, Any]]

Returns

optional updates to config updates

Notes

This is not called at the beginning of PipelineManager.update_batch, for that use pyfileconf_pre_update_batch()

pyfileconf.plugin.hookspecs.pyfileconf_pre_update_batch(pm, updates)[source]

Called at the beginning of PipelineManager.update_batch. Should return an iterable of updates, which will be included in the updates to be run

Parameters
Return type

Iterable[dict]

Returns

optional updates to config updates

pyfileconf.plugin.impl module

pyfileconf.plugin.manager module

pyfileconf.plugin.manager_utils module

pyfileconf.plugin.manager_utils.get_plugin_manager()[source]
Return type

PluginManager

pyfileconf.plugin.manager_utils.remove_default_plugins()[source]
pyfileconf.plugin.manager_utils.reset_plugins()[source]