-
Notifications
You must be signed in to change notification settings - Fork 74
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
Python 3.10/pyqt has stricter typing rules #951
Comments
I've been poking around other pyqt5 based open source projects, and pretty much everything I've seen so far is just converting to I'll figure out which qt objects are causing problems ( |
If you run into a systematic way to find these, I'd be interested to hear about it- at some point I'll look for it myself. I was thinking about ways to scrape the qt docs for floating point input fields and finding all usages of those in my code... |
In my brief (unrelated) Qt6 adventure I did find a clever way over here for doing a find/replace of unscoped enum usage involving going through all the pyqt I was thinking something similar could be viable for the find part of this task. Haven't stumbled on an existing solution yet, or tried to write my own. Was planning to get back to this later this week. As for what to do with all the found instances I can' think of any good way that doesn't involve manually looking at each one and using |
Type checking became stricter in python 3.10, so pydm doesn't load some widgets properly. slaclab/pydm#951
I ended up using the .pyi files and taking a deep dive into all of the pyqt-related repos that are maintained at SLAC and used by my group, since I'm looking to update my group's Python version in the next few months. In the end, I only found one module that still has this issue in pydm, the analog indicator. I'll document the behavior and submit a PR that fixes it. Since this is the only instance I was able to find, I'll also close this issue once that PR is merged. |
@ZLLentz Thanks for fixing this! |
Describe the bug
There are places in pydm where floating-point values are passed into fields that are nominally
int
in the qt source. This is OK in python 3.9 and earlier, in these cases the values are converted by truncating to the floor.In Python 3.10, this no longer works.
https://docs.python.org/3/whatsnew/3.10.html#other-language-changes
Any point in the pydm code that passes in a floating point value into a qt int field will break upon upgrading to python 3.10. This is pretty annoying to track down all instances of and isn't a problem unique to pydm, it affects most pyqt-based applications.
Expected behavior
It's not urgent in any sense of the word, but we should work toward python 3.10 compatibility in pydm in a systematic way that makes sure we aren't missing anything.
Steps to Reproduce
Install pydm into a python 3.10 environment and try to use the PyDM drawing widgets, for example. I'm not sure the full scope of which things are affected.
Possible Solution
We should figure out a systemic way to track down instances of this and make sure we pass integer values when they are required by qt. Simplest is copious calls to
int
but this might not be the best way.My Platform
rhel7
python 3.10
pydm v1.18.1
The text was updated successfully, but these errors were encountered: