Originally posted by Marcus in Google Groups.
Currently, when we make a change to the backend, all plugins could potentially stop working, because they no longer match the interface provided by their superclass.
This should be okay, but at the moment there isn’t any way for such events to fail gracefully. I’d like to propose adding a requires attribute, next to families and version in the superclass for plugins for them to specify with which version of Pyblish they are compatible with.
That way, a plugin could start by looking up the version of Pyblish:
import pyblish
def discover(type, regex, ...):
if pyblish.version > plugin.requires:
log.warning("Please update plugin {0} to the latest version of Pyblish".format(
plugin.__name__)
That way, we can safely have plugins lying around and not have to worry about updating all of them at the same time whenever we make a change to their interface. They would however still work with older versions of Pyblish, should users choose not to update.
Specificity
Requirements is a tricky subject and can become quite complex. For example, a plugin might start our supporting only a specific version of Pyblish.
requires = "pyblish-1.0.1"
It may end up requiring only a few features and thus support a greater range of versions.
# Support all dot-releases
requires = "pyblish-1"
It may support versions above a certain point.
requires = "pyblish-1+"
It may support between two releases.
requires = "pyblish-1.1+<pyblish-1.3.4"
It may be dependent on more than just pyblish.
requires = ["pyblish-1+", "pyblish-maya-1+"]
And so forth. See here for an example implementation in Rez.
We might not have to take it this far, but versioning is a very important concept we have to think very carefully about, due to the fact that we make such large use of plugins. Maybe we could even use Rez’s implementation.
Thoughts?