[PySide] QtConcurrent, run method alternative

Israel Brewster ijbrewster at alaska.edu
Wed May 25 18:04:28 CEST 2022


I have run into this “issue” myself several times, and so far have been able to fill the need using python side tools, but I’ve always wondered: is there a difference in how QtConcurrent works that might make it preferable to the built-in python alternatives? For example, for some of the python multiprocessing functions, the arguments you pass to the function have to be pickleable. If it was possible to make QtConcurrent work, would it work around this limitation? Or if it does threading rather than multiprocessing, would using the Qt API (which is presumably C) get around the GIL limitations of python threading?

If so, that would be a huge use case for QtConcurrent. If not, then perhaps it is of more limited usefulness, although there is still the argument that using Qt APIs everywhere could make it easier to move between Python and C, if needed for some reason.
---
Israel Brewster
Software Engineer
Alaska Volcano Observatory 
Geophysical Institute - UAF 
2156 Koyukuk Drive 
Fairbanks AK 99775-7320
Work: 907-474-5172
cell:  907-328-9145

> On May 25, 2022, at 6:39 AM, Cristián Maureira-Fredes <Cristian.Maureira-Fredes at qt.io> wrote:
> 
> 
> On 5/25/22 15:58, Rute Mendes wrote:
>> Anyway, now I know why there're no examples for PySide, for future reference
>> https://stackoverflow.com/questions/32378719/qtconcurrent-in-pyside-pyqt <https://stackoverflow.com/questions/32378719/qtconcurrent-in-pyside-pyqt>
>> Thanks.
>> Rute
>> A segunda, 23/05/2022, 13:20, Rute Mendes <rutepfmendes at gmail.com <mailto:rutepfmendes at gmail.com>> escreveu:
>>    Hi!
>>    I've installed PySide6 but looking at docs there's no run method
>>    implementation for QtConcurrent. What are the alternatives according
>>    PySide availability, QtConcurrent, QFutureBaseInterface? ( and I
>>    can't find examples only for PySide ).
>>    Regards,
>>    Rute
> 
> Hello Rute,
> 
> Due to the same reason you see there, that it's a namespace
> we have been exploring how we could still expose at least a version
> of the many overloads of functions like mappedReduced.
> 
> Another challenge, is that most of the QtConcurrent is heavily templated
> what makes it a bit more tricky to expose to Python.
> 
> Out of curiosity,
> have you tried to use Python-only options to achieve your goal?
> not that I'm challenging the existence of QtConcurrent,
> but I would like to understand the usage of the module over
> some other options like:
> 
> threading, multiprocessing, concurrent.futures, etc
> https://docs.python.org/3/library/concurrency.html
> 
> If having a Qt-API to handle concurrency is your motivation,
> is a valid motivation IMHO :) or if QtConcurrent
> is solving a problem that Python haven't solve yet
> could be nice to know as well.
> 
> Cheers
> 
> -- 
> Dr. Cristian Maureira-Fredes
> R&D Manager
> 
> The Qt Company GmbH
> Erich-Thilo-Str. 10
> D-12489 Berlin
> 
> Geschäftsführer: Mika Pälsi,
> Juha Varelius, Mika Harjuaho
> Sitz der Gesellschaft: Berlin,
> Registergericht: Amtsgericht
> Charlottenburg, HRB 144331 B
> --
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> https://lists.qt-project.org/listinfo/pyside

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20220525/047058f6/attachment-0001.htm>


More information about the PySide mailing list