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

PR: Add minimum version check for Qt6 >=6.2.0 #294

Merged
merged 2 commits into from
Dec 7, 2021

Conversation

CAM-Gerlach
Copy link
Member

@CAM-Gerlach CAM-Gerlach commented Dec 3, 2021

Per the discussion in #233 , adds a minimum version check for Qt6 and each binding to ensure they are at least version 6.2.0 or higher, since we don't officially support anything under that. Also, refactors the constants a bit accordingly.

Closes #233 (again)

@CAM-Gerlach CAM-Gerlach added this to the v2.0.0 milestone Dec 3, 2021
@CAM-Gerlach CAM-Gerlach self-assigned this Dec 3, 2021
@CAM-Gerlach CAM-Gerlach mentioned this pull request Dec 3, 2021
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks @CAM-Gerlach!

@kumattau
Copy link
Contributor

kumattau commented Dec 3, 2021

@CAM-Gerlach, @ccordoba12,

How about introducing PYQT5_VERSION, PYSIDE2_VERSION, PYQT6_VERSION and PYSIDE6_VERSION ?

l think,

parse(PYQT5_VERSION) < parse(PYQT5_VERSION_MIN)

is better than

parse(PYQT_VERSION) < parse(PYQT5_VERSION_MIN)

and others are the same.

@CAM-Gerlach
Copy link
Member Author

Hmm, thanks for the suggestion @kumattau . My take is that it might look a little better in a few parts of the warning check code, but I'm not sure that a bit of internal-only aesthetics is worth introducing even more new package-top-level public constants (that would have to be changed with QtPy versions that added/removed binding support) which are rather redundant to each other (since only one is going to be defined at a time) and the need to define and check them would add further code complexity to a (difficult to reliably unit test) warnings check. Additionally, on the aesthetics front, adding that one addition character would push several of the lines over the 79 char limit, making it even longer, less consistent and harder to read at a glance.

@dalthviz , what do you think?

@kumattau
Copy link
Contributor

kumattau commented Dec 4, 2021

Let me explain the background of my proposal in a little more detail.
First, PYQT_VERSION and PYSIDE_VERSION are expected to be public APIs for users because these don't start with an underscore.

In the current API, the following simply comparison

parse(PYQT_VERSION) < parse(PYQT6_VERSION_MIN)

is incorrect usage (parse('6') <= parse(PYQT_VERSION) is required before comparison ), but it is difficult for users to understand this.

The related public APIs is as follows.

  • QT_API environment variable
    pyqt5, pyside2, pyqt6 or pyside6 is set

  • PYQT5, PYSIDE2, PYSIDE2, PYSIDE6
    corresponding the above QT_API, the only one of these constants is set to True, others are set to False

By introducing PYQT5_VERSION, PYSIDE2_VERSION, PYQT6_VERSION and PYSIDE6_VERSION, XXX_VERSIONs become the same behavior as PYQT5, PYSIDE2, PYSIDE2, PYSIDE6 and users can use XXX_VERSIONs without mistake.

Additionaly, I think introducing QT5_VERSION and QT6_VERSION is better from the API consistency perspective.

The above is my personal opinion, and of course, I respect the judgment of the spyder team.

Copy link
Member

@dalthviz dalthviz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @CAM-Gerlach for working on this! I left some comments/suggestions/questions to:

  • Simplify the warning message
  • Add more carity to the validation on Qt6 taking into account the comments of @kumattau (thanks for taking the time to check this and raising your concerns by the way 👍)

qtpy/__init__.py Outdated Show resolved Hide resolved
qtpy/__init__.py Outdated Show resolved Hide resolved
@CAM-Gerlach CAM-Gerlach linked an issue Dec 6, 2021 that may be closed by this pull request
@CAM-Gerlach CAM-Gerlach force-pushed the add-qt6-version-check branch 2 times, most recently from a505afe to 7fac941 Compare December 6, 2021 22:45
Co-authored-by: Daniel Althviz Moré <d.althviz10@uniandes.edu.co>
Copy link
Member

@dalthviz dalthviz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @CAM-Gerlach for working on this! LGTM 👍

Also, thanks @kumattau for the feedback! 👍

@dalthviz dalthviz merged commit 4bdb5d3 into spyder-ide:master Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PyQt6 support
4 participants