You are right in that
pyblish.util.validate() includes Collection, so running
pyblish.util.collect() and then
pyblish.util.validate() would effectively run Collection twice.
But I think you're right that it should behave as you expect it to.
validate() should only validate,
extract() should only extract and so on. I'd go ahead and implement it as such right now, if it wasn't for the fact that the way they act currently has been in action for quite some time. I'm honestly surprised this problem hasn't come up sooner, actually.
I know these convenience functions aren't seeing much use, as
publish() is the most used function and the GUI usually handles more complex cases, so that could be one reason.
What do others think about making the CVEI convenience functions behave as @Philip_Scadding expects them to? That is, to be able to run this:
from pyblish import util, api
context = api.Context()
plugins = api.discover()
# Optionally, manually check for errors here..
It would enable the development of simple GUIs such as this one, and I can't see it taking away what is currently made possible by their current behavior.
Thanks for bringing this up @Philip_Scadding. To quickly test this out on your end, with your GUI, to see whether it makes sense, try replacing the
util._convenience function with this.
def _convenience(order, context=None, plugins=None):
plugins = list(
Plugin for Plugin in (api.discover() if plugins is None else plugins)
if lib.inrange(number=Plugin.order, base=order)
return publish(context, plugins)
If you find that this makes sense, then I think we should have a look at making it the default.
So just to clarify, that no, you should not need to do this.