-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Declaring FOQUS Optional Dependencies #1013
Comments
PSUADE Example Test Code
|
Wrapper Plugin Moduleclass Plugin:
plugin_modules_available = []
plugin_modules_unavailable = []
@classmethod
def available(cls):
return tuple(plugin_modules_available)
@classmethod
def unavailable(cls):
return tuple(plugin_modules_unavailable)
@classmethod
def load(cls):
try:
exec('import %s' %(cls.python_module_name))
except ModuleNotFoundError:
cls.plugin_modules_unavailable.append(cls.python_module_name)
return False
cls.plugin_modules_available.append(cls.python_module_name)
return True
class PsuadePlugin(Plugin):
python_module_name='psuade'
class TensorFlowPlugin(Plugin):
python_module_name='tensorflow'
if __name__ == '__main__':
loaded = TensorFlowPlugin.load()
print("%s %s" %(TensorFlowPlugin, loaded)) |
#1015 This PR removes a few lines of code because PSUADE/NOMAD is not available. Think this would make a good start for the plugin architecture that wraps these lines with a "is_available" |
@sotorrio1 and @lbianchi-lbl I added a "Plugin" module and show how to use it in the OUU UI class and wrapped the button code you removed. I think this is a reasonable way to handle this, and it also demonstrates the frailty of having UI specific modules with underlying dependencies that are not enforced or checked in any meaningful way. There is nothing in the OUU UI that says "hey we need PSUADE". |
A sample implementation is in #1032 |
Description
Discuss and explore a means of marking up methods that require certain plugins/extensions.
Possiblities:
Set of decorators:
Class Hierarchies
Class Mixins
Metaclass
The text was updated successfully, but these errors were encountered: