Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove PySide2 from APIs on Python 3.11+ #400

Closed
wants to merge 2 commits into from
Closed

Remove PySide2 from APIs on Python 3.11+ #400

wants to merge 2 commits into from

Conversation

StSav012
Copy link
Contributor

@StSav012 StSav012 commented Feb 1, 2023

As far as I can judge from the PySide* chat message by Florian Bruhin, PySide2 is not going to run on Python 3.11+. Currently, it crashes Python. To avoid further issues, I suggest removing it from the APIs for Python 3.11 and up.

@dalthviz
Copy link
Member

dalthviz commented Feb 1, 2023

Hi @StSav012 thank you checking this! Although I'm a little bit confused, it is possible to install PySide2 with pip on Python 3.11? I think you can't since there are no compatible wheels available, right?

image

Also, seems like you can install PySide2 5.15.8 with conda (conda-forge) and after testing locally seems like it works with Python 3.11 🤔

image

Also, just in case, what do you think about this @CAM-Gerlach @ccordoba12 ?

@StSav012
Copy link
Contributor Author

StSav012 commented Feb 1, 2023

I'm actually surprised. First, in the tests, there is Python 3.10.8 (see conda info) despite the tests are titled Python 3.11. Then, by the fact that the developers are unaware of PySide2 coming with conda. I'd check sys.version_info in the conda environment.

As a side note, how old Python, PySide2, and PyQt5 do you support? In the code, I see some lines about PyQt5 5.9 and 5.12, and I can PR patches for PyQt5 5.6 if someone needs them.

Edit. I can use PySide2 on Python 3.11 almost right, except for a crash when an app quits. So, for the end user, there is a mere difference.

@dalthviz
Copy link
Member

dalthviz commented Feb 1, 2023

I'm actually surprised. First, in the tests, there is Python 3.10.8 (see conda info) despite the tests are titled Python 3.11.

Checking the CI, we install the respective Python version for the test at the Test <binding> step so when running pytest you can see the Python 3.11 version. I think the Python 3.10.8 info you see on the CI is from the initial conda installation that is created when setting up conda with the setup-miniconda action (which runs before the test.sh script)

As a side note, how old Python, PySide2, and PyQt5 do you support?

PySide2 5.12+ and PyQt5 5.9+. For the validations we have defined those minimum version here:

qtpy/qtpy/__init__.py

Lines 146 to 149 in aa3fe4b

# Minimum supported versions of Qt and the bindings
QT5_VERSION_MIN = PYQT5_VERSION_MIN = '5.9.0'
PYSIDE2_VERSION_MIN = '5.12.0'
QT6_VERSION_MIN = PYQT6_VERSION_MIN = PYSIDE6_VERSION_MIN = '6.2.0'

I can use PySide2 on Python 3.11 almost right, except for a crash when an app quits. So, for the end user, there is a mere difference.

Oh then I think we should create an issue in the PySide2 feedstock repo: https://github.com/conda-forge/pyside2-feedstock or maybe the issue is related with something we are doing over the QtPy side?

@ccordoba12
Copy link
Member

Also, just in case, what do you think about this @CAM-Gerlach @ccordoba12 ?

If PySide2 is working fine with Python 3.11 with Conda-forge packages, then we certainly don't need to do this.

Then, by the fact that the developers are unaware of PySide2 coming with conda

That's no surprise for us because there's an important disconnect between developers outside of the Scientific Python ecosystem and those inside it.

@CAM-Gerlach
Copy link
Member

Right now, we actually aren't testing PySide2 on Python 3.11 on Conda, as I hadn't gotten it to work in PR #392 , but I tested it just now and it works just fine, so I suspect that was a result of #397 . I've opened PR #401 to unskip it.

In addition, if we did want to do it, this wouldn't be the way to go about it. This PR removes it from the lookup table of API names, which ensures that a somewhat ambiguous error message will be immediately presented if the user manually specifies it with the QT_API environment variable, and the MyPy CLI output will not include it (as it should, given the global variable is still defined and used), but otherwise it will still be searched for and attempted to be used regardless, potentially triggering the hard crash, rather than falling back to another usable API, which would be the most potentially useful part of this.

Although I'm a little bit confused, it is possible to install PySide2 with pip on Python 3.11? I think you can't since there are no compatible wheels available, right?

Yeah, there are no wheels past 3.10, and no sidsts at all, so the only way a user would install it would be either through conda (which works) or through manually building their own source checkout (which they could patch to fix). Therefore, it's not clear to me there's any user benefit to restricting it.

I think the Python 3.10.8 info you see on the CI is from the initial conda installation that is created when setting up conda with the setup-miniconda action (which runs before the test.sh script)

Yup, that's right.

@StSav012
Copy link
Contributor Author

StSav012 commented Feb 2, 2023

Your replies make perfect sense. Thank you. I drop the PR.

@StSav012 StSav012 closed this Feb 2, 2023
@dalthviz
Copy link
Member

dalthviz commented Feb 2, 2023

Thank you @StSav012 for raising up this possible source of issues and thinking about a possible solution! If you have further concerns in the future about possible things rasing issues let us know!

@CAM-Gerlach
Copy link
Member

And it was also thanks to this PR that we opened #401 to unskip PySide2 Py3.11 testing in CI on Conda, as it is now working but was previously skipped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants