Skip to content
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

Plugin communication / dependencies #110

Open
johnmaguire opened this issue Feb 17, 2016 · 0 comments
Open

Plugin communication / dependencies #110

johnmaguire opened this issue Feb 17, 2016 · 0 comments

Comments

@johnmaguire
Copy link
Owner

Plugins need to be able to communicate with each other (i.e. calling one plugin's command from within another plugin). To be able to do this safely, we also need a concept of dependencies.

I propose supporting dependencies in the following manner:

  1. @depends can be applied to a class, or method to indicate that it is only valid if the dependency has been satisfied (and otherwise cannot be loaded, called, or otherwise accessed.)
  2. cardinal.plugin('users') can resolve optional dependencies (e.g. the "users" plugin). It will raise an exception if the plugin is not loaded. Maybe support for load=True kwarg that can attempt to load the plugin if it isn't loaded -- this must still adhere to blacklist/whitelist settings.

When a plugin is being loaded, we would first check if there are any required dependencies -- if there are, we'll attempt to resolve them recursively. If we fail at any point, the state should be reverted (any plugins in the process of being loaded as a result of a dependency tree will not be loaded). If we succeed, the original plugin will be loaded.

When a plugin command is called which is decorated by @depends, we first check if there any required dependencies, and repeat the same process above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant