Skip to content

1.2.5

Compare
Choose a tag to compare
@mottosso mottosso released this 19 Mar 06:23
· 181 commits to master since this release
7df798b

New environment variable QT_PREFERRED_BINDING_JSON added by @MHendricks to dynamically pick binding based on parent package.

Usage Author

  1. As a library author, self-host Qt by storing it along with your package, e.g. mypackage.vendor.Qt
  2. Inform the user that most but not all bindings are supported such as PySide and PyQt4 only (e.g. in your README)
  3. Pray they see it

Usage User

  1. As a user, read a library's README
  2. If you see mention of which bindings are supported
  3. 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.