This is a feature proposal to help solve the current issue of hard-coded hostnames for use in plug-ins.
Goal
Facilitate the inclusion of any host, without needing to alter surrounding libraries.
Motivation
Currently, a few hosts are supported by the core Pyblish library. They are currently hard-coded to look at an executables filename, and only a few are supported. This means that whenever a new host comes along, such as Softimage or Clarisse, the core library must be updated to include them.
Implementation
Integrations will register supported hosts at run-time, and Pyblish will be capable of supporting multiple concurrent hosts; such as maya
and python
.
This is the full API.
# From the Maya integration
import pyblish.api
pyblish.api.register_host("maya")
As you can see, there is no longer any need for evaluating the executable of the currently running software, instead the host is determined by it’s integration. An integration can then register multiple hosts, if needed, where it makes sense to do so, and then have plug-ins operate on individual parts of a software package.
import pyblish.api
pyblish.api.register_host("maya")
pyblish.api.register_host("mayapy")
pyblish.api.register_host("mayabatch")
For which plug-ins could support one or more of these.
class MyPlugin(...):
hosts = ["maya", "mayapy"] # Supported when publishing from mayapy and the Maya GUI
The executable environment of Pyblish itself will be registered automatically, e.g. python
.
This also means that we need an additional member to the API.
import pyblish.api
pyblish.api.current_hosts()
Which returns a list of hosts as string. current_host()
will remain as-is, and will return the last-registered host.
Discussion
This addition will have no effect on current plug-ins, but instead open up doors for added functionality, along with support for an arbitrary amount of integrations of both major and minor software packages, including your own home-brewed ones.