pyblish / pyblish-qml

Pyblish QML frontend for Maya 2013+, Houdini 11+, Nuke 8+ and more
GNU Lesser General Public License v3.0
114 stars 44 forks source link

No Qt #320

Closed mottosso closed 5 years ago

mottosso commented 5 years ago

This PR removes the Qt dependency from a host, such that only the external Python process requires it.

Before, Qt was imported regardless of host, to try and show a splash screen, install an event filter and listen on the application quit signal. Now that only happens if Qt is available.

The Qt import mechanism itself was moved into a closed scope, such that it leaves mock-functions available for hosts that lack access to Qt. The result is no loss in functionality, and no need for PyQt5 to exist from a given host. Now all you need is love. And Python.

mottosso commented 5 years ago

Oh, and it also removes the need for PyQt5 to exist on PYTHONPATH, which can complicate this scenario:

  1. Pyblish QML uses Python 3, from a Python 2 host, e.g. Maya 2018
  2. PyQt5 is installed to the target Python 3's site-packages

In the above case, one would need to append Python 3's site-packages to the PYTHONPATH of the given host, which would give Python 2 access to its modules. The "proper" was of handling this is to not install PyQt5 in site-packages, but elsewhere, e.g. /special/pyqt5/path such that only that path could be added to PYTHONPATH.

Now you don't need to do that either.

Edit: No, sorry, it's more specific than that. For the above to be a problem, the host cannot have access to any Qt binding. In the above case, Maya would be able to import pyblish_qml because it's got PySide2 available. It'd be a problem only in hosts that don't have that, like Blender.

tokejepsen commented 5 years ago

Very cool stuff! Can't review it properly atm.

Would make it much easier to package and have consistent behaviour through all apps.

mottosso commented 5 years ago

Taking this for a spin in production.