Details
Description
If the user call pyside6-designer living in a virtual environment directly without activating the environment via scripts (e.g. activate.ps1), no custom widgets (& plugins) is loaded.
However, if I manually set the VIRTUAL_ENV environment variable and then invoke pyside6-designer directly, it correctly loads the plugins.
Though it is unusual to invoke Qt tools living in a virtual environment directly without activating the environment first, this defeats the possibilities to integrate the tool scripts into editor extension or other services. Also, checking if the current Python is in a virtual environment by checking the VIRTUAL_ENV environment variable is unreliable, which is mentioned in the official documentation: https://docs.python.org/3/library/venv.html#how-venvs-work. Namely, we should not use VIRTUAL_ENV at all in pyside-tools/pyside_tool.py and pyside-tools/deploy_lib/python_helper.py (https://github.com/search?q=repo%3Aqtproject%2Fpyside-pyside-setup%20VIRTUAL_ENV&type=code). Checking sys.prefix == sys.base_prefix might be an alternative here (https://stackoverflow.com/questions/1871549/determine-if-python-is-running-inside-virtualenv).
Attachments
For Gerrit Dashboard: PYSIDE-2251 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
465733,2 | pyside6-designer: Fix Python plugins to work with non-activated virtual environment | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
465932,2 | pyside6-designer: Fix Python plugins to work with non-activated virtual environment | 6.4 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
465949,2 | pyside6-designer: Prepend virtual env path on Windows | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
466504,2 | pyside6-designer: Prepend virtual env path on Windows | 6.4 | pyside/pyside-setup | Status: MERGED | +2 | 0 |