1.2.5
New environment variable QT_PREFERRED_BINDING_JSON
added by @MHendricks to dynamically pick binding based on parent package.
Usage Author
- As a library author, self-host Qt by storing it along with your package, e.g.
mypackage.vendor.Qt
- Inform the user that most but not all bindings are supported such as PySide and PyQt4 only (e.g. in your README)
- Pray they see it
Usage User
- As a user, read a library's README
- If you see mention of which bindings are supported
- Add those bindings to your
QT_PREFERRED_BINDING_JSON
environment variable.
Python
import os
import json
os.environ["QT_PREFERRED_BINDING_JSON"] = json.dumps({
"pyblish.vendor.Qt": ["PyQt5", "PySide"],
"studiotool.vendor.Qt": ["PyQt4", "PyQt5"]
})
Cmd
set QT_PREFERRED_BINDING_JSON={"pyblish.vendor.Qt": ["PyQt5", "PySide"], "studiotool.vendor.Qt": ["PyQt4", "PyQt5"]}
Powershell
$env:QT_PREFERRED_BINDING_JSON='{"pyblish.vendor.Qt": ["PyQt5", "PySide"], "studiotool.vendor.Qt": ["PyQt4", "PyQt5"]}'
Bash
export QT_PREFERRED_BINDING_JSON={"pyblish.vendor.Qt": ["PyQt5", "PySide"], "studiotool.vendor.Qt": ["PyQt4", "PyQt5"]}
Now whenever Pyblish from .vendor import Qt
, it'll try and use PyQt5
whereas Studio Tool would try PyQt4
. This can help narrow the supported bindings of your library to some but not all of the 4 supported bindings, if your library doesn't support e.g. PySide2. Ideally of course, as a library author, you shouldn't need this and should always strive for support by all bindings where possible.
See #335 for details.