pyblish / pyblish-base

Pyblish base library - see https://github.com/pyblish/pyblish for details.
Other
127 stars 59 forks source link

Iterator now sorting the plugins before iteration #358

Closed PaulSchweizer closed 4 years ago

PaulSchweizer commented 4 years ago

Also updated the respective test and added venv to gitignore

tokejepsen commented 4 years ago

Cool!

What does this solve? Is there an issue to reference to this?

PaulSchweizer commented 4 years ago

I came across this when using the pyblish.util.integrate function (as well as the functions for the other steps) and thought this should be fixed as it does not yield the same behaviour as the "regular" pyblish method where the plugins are pre-sorted. Should I open a ticket? Or use things in a different way?

tokejepsen commented 4 years ago

The best way to would be make a test, so we can ensure functionality in the future as well.

PaulSchweizer commented 4 years ago

The test is are already in place, as mentioned above

mottosso commented 4 years ago

This affects a core mechanic of Pyblish, and thus makes me nervous. :S

Plug-ins are sorted during discovery, I can't figure out why they'd need to be sorted again afterwards?

Maybe if you could post a reprodible?

PaulSchweizer commented 4 years ago

Maybe I'm using it wrong, but I am providing a list of plugins to the collect, validate etc. functions https://github.com/pyblish/pyblish-base/blob/master/pyblish/util.py#L199

That list might not be in order, in which case it is exectuted out of order (meaning in it's given order).

I am using these functions separately for two reasons:

I can of course sort the list of plugins beforehand myself, but thought it safer if the sorting is performed inside of pyblish to avoid this inconsistency.

Of yourse there is also the possibility that the mentioned functions are not meant to be used like I am using them.

In the tests I added the above mentioned case, providing a list of plugins in the wrong order: https://github.com/pyblish/pyblish-base/pull/358/files#diff-08aca4e83f1cbb3f29db48aa9abcae9eR65

If that is not sufficient I can draft up a lengthier example, just let me know

mottosso commented 4 years ago

but I am providing a list of plugins to the collect, validate etc.

Ah, yes. You should be able to pass a list of your order. If you wanted it sorted, then you can sort it before handing it in. This is expected, as you may want to actually control that order.

PaulSchweizer commented 4 years ago

Ok I see, then this PR is void, thanks for clarifying!