pyblish / pyblish-base

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

Collector plug-ins #144

Closed mottosso closed 9 years ago

mottosso commented 9 years ago

Should Selector instead be called Collector?

Reasoning

The reason being that what a Selector does is collecting information about an asset.

Origin

The name originally came from database-land in which "select" refers to picking out a particular piece of data from a set of data. Not unlike Selection in Pyblish.

tokejepsen commented 9 years ago

+1 for this. Gets me slightly confused every time I start a new selector.

mottosso commented 9 years ago

I'm all for it.

You're welcome to use the alias under pyblish.api.Collector, but for now, I'd consider this accepted and will start phasing off the Selector alias.

Just as a note, I'll be keeping both available and won't remove anything until there has been a few versions in which using Selector will trigger DeprecationWarnings that we can all see and be aware of, so don't worry if you are still using it.

Here's how the alias works.

import pyblish.api

class MyCollector(pyblish.api.Collector):
    ...

Which technically is just this.

api.py

import pyblish.plugin

Collector = pyblish.plugin.Selector

And so will still work if you do any isinstance() or other comparisons.

tokejepsen commented 9 years ago

Does this work with the naming of the plugins as well? so select_data.py is collect_data.py?

mottosso commented 9 years ago

No, that's a good point, it won't work with that..

At the risk of putting you on thin ice, this is where that is configured. https://github.com/pyblish/pyblish/blob/master/pyblish/config.yaml#L46

tokejepsen commented 9 years ago

ok, I might have a look at that when I get the time:)

mottosso commented 9 years ago

Had a thought about this, and this is completely experimental, but seems to work fine.

>>> import pyblish.api
>>> pyblish.api.config["selectors_regex"] = r'^collect_.*\\.py$'
>>> pyblish.api.discover()
[<class 'collect_something.CollectSomething'>]

Which means, that in your userSetup.py, you can add the first two lines and that would be it.

Note that you would have to do this for each host; e.g. both Maya and Nuke, if you wanted them both to refer to collectors this way.

mottosso commented 9 years ago

Also note that this change would be completely forwards compatible; as in, when we actually do add "collectors_regex" to the configuration, this will simply do nothing and the behaviour will stay in place.

mkolar commented 9 years ago

+1 for me (even though it seem to have been accepted already). It makes much more sense this way.

mottosso commented 9 years ago

Implemented in 1.1

mkolar commented 9 years ago

Does this concern only the Class, or the plugin file names as well (as Toke was asking)? Just want to make how it is at the end

mottosso commented 9 years ago

It's purely cosmetic. You can choose to use Collector wherever you are currently using Selector and you will get the same behaviour, including in the naming of files.

mkolar commented 9 years ago

Perfect. thanks