Plugins Package

This module contains the base interface for plugins. Its methods provide the necessary functions for plugin handling.

Authors:

  • Philipp Schuette

class pyzeal.plugins.pyzeal_plugin.PyZEALPlugin[source]

Interface for plugins. Methods for instantiation and plugin information need to be implemented.

abstract static getInstance()[source]

Return the singleton instance of PyZEALPlugin which provides a service of type T_co.

Returns:

PyZEALPlugin[TypeVar(T_co, bound= Union[FinderAlgorithm, ArgumentEstimator, RootContainer, SettingsService, PyZEALParserInterface], covariant=True)]PyZEALPlugin instance.

abstract static initialize()[source]

Returns a factory for the plugin’s implementation of T_co.

Returns:

Callable[..., TypeVar(T_co, bound= Union[FinderAlgorithm, ArgumentEstimator, RootContainer, SettingsService, PyZEALParserInterface], covariant=True)] – Factory for plugin implementation of T_co.

abstract property pluginName: str

Return the name of the plugin.

Returns:

Plugin name.

abstract property pluginType: Type[T_co]

Return the type provided by the plugin.

Returns:

Service type of plugin.

abstract property pluginVersion: Tuple[int, int, int]

Return the version of the plugin as (major, minor, patch).

Returns:

Plugin version.

Module plugin_loader.py from the package PyZEAL. This module handles discovering, loading and registering of plugins.

Authors:

  • Philipp Schuette

class pyzeal.plugins.plugin_loader.PluginLoader(*args, **kwargs)[source]

This class handles plugin discovery, loading and registration.

static discoverAttributes(candidateModule)[source]

Discover attributes of a candidate module. Ignores attributes starting with __.

Parameters:

candidateModule (ModuleType) – Candidate module

Returns:

List[str] – List of attributes.

static discoverModules(path='/home/docs/checkouts/readthedocs.org/user_builds/pyzeal/envs/latest/lib/python3.11/site-packages/pyzeal/plugins/custom_plugins')[source]

Discover all possible plugin files in path. Ignore files starting with __.

Parameters:

path (str) – Path to search, defaults to PLUGIN_INSTALL_DIR (default: '/home/docs/checkouts/readthedocs.org/user_builds/pyzeal/envs/latest/lib/python3.11/site-packages/pyzeal/plugins/custom_plugins')

Returns:

List[str] – List of plugin candidates.

static getInstance()[source]

Return the global PluginLoader instance. If no instance exists, a new one is created and returned.

Returns:

PluginLoaderPluginLoader singleton instance.

static isPyFile(filename)[source]

Returns True if filename corresponds to a python file.

Parameters:

filename (str) – File to evaluate

Returns:

strTrue if filename corresponds to a python file.

loadPlugin(candidateModule)[source]

Try to load a candidate plugin and return it if successful.

Parameters:

candidateModule (ModuleType) – Candidate plugin module

Returns:

Optional[Type[PyZEALPlugin[Union[FinderAlgorithm, ArgumentEstimator, RootContainer, SettingsService, PyZEALParserInterface]]]] – Plugin if an implementation has been found, else None.

static loadPlugins(path='/home/docs/checkouts/readthedocs.org/user_builds/pyzeal/envs/latest/lib/python3.11/site-packages/pyzeal/plugins/custom_plugins')[source]

Load plugins present in path.

Parameters:

path (str) – Path to search for plugins, defaults to PLUGIN_INSTALL_DIR (default: '/home/docs/checkouts/readthedocs.org/user_builds/pyzeal/envs/latest/lib/python3.11/site-packages/pyzeal/plugins/custom_plugins')

Returns:

List[PyZEALPlugin[Union[FinderAlgorithm, ArgumentEstimator, RootContainer, SettingsService, PyZEALParserInterface]]] – List of loaded plugins.

locateAndLoadPlugins(path='/home/docs/checkouts/readthedocs.org/user_builds/pyzeal/envs/latest/lib/python3.11/site-packages/pyzeal/plugins/custom_plugins')[source]

Discover plugins at a given path and load them.

Parameters:

path (str) – Path to search for plugins, defaults to PLUGIN_INSTALL_DIR (default: '/home/docs/checkouts/readthedocs.org/user_builds/pyzeal/envs/latest/lib/python3.11/site-packages/pyzeal/plugins/custom_plugins')

Returns:

List[Type[PyZEALPlugin[Union[FinderAlgorithm, ArgumentEstimator, RootContainer, SettingsService, PyZEALParserInterface]]]] – List of found plugins.

Module installation_helper.py from the package PyZEAL. This module contains various helper functions related to plugin installation.

Authors:

  • Philipp Schuette

class pyzeal.plugins.installation_helper.InstallationHelper[source]

Static helper class that provides plugin installation related functions.

static installPlugin(fullPath)[source]

Copies the plugin located at fullPath to the plugin directory to install it.

Parameters:

fullPath (str) – Current path of the to-be-installed plugin.

Returns:

boolTrue if successful.

static returnDataPath(filename, fullPath='/home/docs/checkouts/readthedocs.org/user_builds/pyzeal/envs/latest/lib/python3.11/site-packages/pyzeal/plugins/custom_plugins')[source]

Helper function to construct the full path to plugin data.

Parameters:
  • filename (str) – Filename of plugin data.

  • fullPath (str) – Full path to the directory in which the data is (default: '/home/docs/checkouts/readthedocs.org/user_builds/pyzeal/envs/latest/lib/python3.11/site-packages/pyzeal/plugins/custom_plugins') located, defaults to PLUGIN_INSTALL_DIR

Returns:

str – Path to plugin data

static uninstallPlugin(filename)[source]

Uninstall the plugin given by filename.

Parameters:

filename (str) – Filename of plugin to remove

Returns:

boolTrue if successful.