-
Notifications
You must be signed in to change notification settings - Fork 174
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
Adds PySide 6 Support For Windows and MacOS #296
Conversation
f7c1876
to
0ef3938
Compare
Some minor comments:
Other than that, the PR looks good. |
8021f80
to
7cb35e0
Compare
Even on linux it shows multiple errors. How come CI didn't run on this branch? I came across mypy and pyside2 issues before. And apparently this is still an upstream issue. I wonder if we'll need a PySide6-stubs or similar to fix it...
Thanks! I'll fix this when I rebase.
Done. I checked on windows and there is no |
With the new fix it runs on Linux and macOS. |
Tested now on windows and it only has an unrelated error which we should fix in another PR. |
adb05a8
to
035df51
Compare
(rebased on main) |
I took a look at your suggestion (7c6eab4) for handling Problematic codeThe problematic part is this import chain and removing try:
from PySide2 import QtCore, QtGui, QtWidgets
except ImportError:
from PySide6 import QtCore, QtGui, QtWidgets # type: ignore [no-redef] Here's what actually happens under the hood, as far as Mypy is concerned: Under the hood
Why is this bad?What we end up with if we do the above is:
So, we are in a worse situation than before. |
ProposalThe best way forward would be to use The next best thing is this: if typing.TYPE_CHECKING:
from PySide2 import QtCore, QtGui, QtWidgets
else:
try:
from PySide6 import QtCore, QtGui, QtWidgets
except ImportError:
from PySide2 import QtCore, QtGui, QtWidgets and install PySide2 stubs in all platforms. The rationale is the following:
Check this out in the |
Wow. Thanks for digging deeper into this. Something did in fact feel old about my "hack" but since it was just a linter, it didn't seem much consequential. I totally agree with your assessment. I will attempt to implement it now. |
This may work on windows but I it leads to the initial problem on macOS (#177). And on a fresh virtualenv on fedora-36, it's getting stuck on installing
It just hangs there... |
Current state of this PR: I had made some recent comments and research regarding Mypy, so we decided to take over this part, and implement the fixes myself. Here's what I've done in general on this PR:
My suggestion is to:
|
Replace PySide2-stubs with types-PySide2, both of which are projects that provide PySide2 typing hints, for the following reasons: 1. types-PySide2 is more complete and allows us to ditch some 'type: ignore' comments for Mypy. 2. PySide2-stubs also brings PySide2 as a dependency, which cannot be installed in MacOS M1 machines. Refs freedomofpress#177
We're not yet adding them to Linux, since PySide6 is not yet available in Linux distros' packages, whereas with Linux and macOS our packaging process includes the shipped binaries. Fixes freedomofpress#211
035df51
to
bbbf822
Compare
I like how the classify the PySide original stubs as abysmal 🤣 on the types-PySide2 project page: |
The changes LGTM. And I tested on Mac and Windows and it checks out.
I have done so now and I've rebased it on top of main. |
I guess |
I tested:
.app
.exe
Fixes #177