Document that applications relying on glue should execute load_plugins to have access to plugins - perhaps we can add a new page in this section: http://docs.glueviz.org/en/stable/index.html#advanced-customization called 'Writing glue applications' that would just have one section for now called 'Loading glue plugins' that would then state that applications using glue-core should call load_plugins to make sure any installed plugins become active.
Modify load_plugins to allow a list of plugin names to be passed to limit which plugins are loaded. We could also have a boolean toggle for whether to require the plugins or whether to load them but only if available. Once this is done we could remove the require_qt_plugins flag and instead in glue-qt we can adjust the load_plugins call to use the new API to require the Qt plugins. We can then do:
load_plugins([<the required Qt plugins>], allow_missing=False) # will make sure we require the Qt plugins
load_plugins() # will load all available plugins (won't reload already loaded Qt plugins)
Add a new list_plugins function that can print out the list of available plugins that can be selected in load_plugins
Make it so that load_plugins can be used as a context manager, e.g.:
with load_plugins(['ccddata_translator']):
...
when the context manager exits, the plugins should be unloaded if they were not loaded beforehand. If it's difficult to make load_plugins into a context manager and preserve backward-compatibility, it might be easier to define a new name e.g. ensure_plugins_loaded() for the context manager.
We should add a keyword argument to also say whether to temporarily disable any other loaded plugins, so that e.g.:
with ensure_plugins_loaded(['ccddata_translator'], ignore_already_loaded=True):
...
would make sure that only that one plugin is loaded inside the block (this will be useful especially for testing).
Have a way of loading plugins by package/module name instead of entry point name. For instance, I could load all glue-astronomy plugins with:
As described in https://github.com/glue-viz/glue-astronomy/pull/76 we should:
Document that applications relying on glue should execute
load_plugins
to have access to plugins - perhaps we can add a new page in this section: http://docs.glueviz.org/en/stable/index.html#advanced-customization called 'Writing glue applications' that would just have one section for now called 'Loading glue plugins' that would then state that applications using glue-core should callload_plugins
to make sure any installed plugins become active.Modify
load_plugins
to allow a list of plugin names to be passed to limit which plugins are loaded. We could also have a boolean toggle for whether to require the plugins or whether to load them but only if available. Once this is done we could remove therequire_qt_plugins
flag and instead in glue-qt we can adjust theload_plugins
call to use the new API to require the Qt plugins. We can then do:Add a new
list_plugins
function that can print out the list of available plugins that can be selected inload_plugins
Make it so that
load_plugins
can be used as a context manager, e.g.:when the context manager exits, the plugins should be unloaded if they were not loaded beforehand. If it's difficult to make
load_plugins
into a context manager and preserve backward-compatibility, it might be easier to define a new name e.g.ensure_plugins_loaded()
for the context manager.We should add a keyword argument to also say whether to temporarily disable any other loaded plugins, so that e.g.:
would make sure that only that one plugin is loaded inside the block (this will be useful especially for testing).