From adrian.herrmann at qt.io Tue Jul 23 17:12:36 2024 From: adrian.herrmann at qt.io (Adrian Herrmann) Date: Tue, 23 Jul 2024 15:12:36 +0000 Subject: [PySide] Active development for QtAsyncio In-Reply-To: References: Message-ID: Hello Loan, I have indeed been the creator and maintainer of QtAsyncio, so you were right to contact me. Unfortunately, I also have to share that I am leaving Qt Group, and I will therefore no longer work on QtAsyncio. Tomorrow will be my last day at the company. QtAsyncio will be in good hands with my colleagues, I have CC'ed my team's mailing list so you can contact them. And seeing your interest and your eagerness to help, I'm sure the project will be in good hands through you as well. :) It would indeed be of great help if you could share a minimal code example to reproduce your problem, and I would like to encourage you to also open a bug report: https://bugreports.qt.io/projects/PYSIDE/issues (select QtAsyncio as the component). You will find some documentation for QtAsyncio in our docs: https://doc.qt.io/qtforpython-6/PySide6/QtAsyncio/index.html I would also like to encourage you to check out this presentation I did about QtAsyncio at a conference: https://www.youtube.com/watch?v=XuqdTvisqkQ In a nutshell, these are the main concepts: - QAsyncioEventLoop implements asyncio's event loop API and wraps around Qt's event loop. E.g., asyncio's methods to start or stop the event loop map to corresponding methods from Qt. If you want to implement more methods from the asyncio API, such as its networking API, you have to do it in here. - QAsyncioHandle is where callbacks are enqueued in Qt's event loop. We do this with the QTimer.singleShot() method. It is unlikely you will have to touch this. - QAsyncioTask and QAsyncioFuture are pure Python code and implement the future and task classes without requiring any Qt code. It is also unlikely you will have to touch these, although you will encounter QAsyncioTask's _step method often while debugging - this is where coroutines are executed. There are a few unmerged patches that lay the groundwork for implementing additional parts of asyncio's API. The networking part of the API is one that I grappled with in particular. One challenge that I encountered was converting between Python data types and Qt data types. I elaborate a bit on this challenge inside one of these patches. You may refer to the documentation, comments, code etc.: https://codereview.qt-project.org/c/pyside/pyside-setup/+/492166 https://codereview.qt-project.org/c/pyside/pyside-setup/+/545892 https://codereview.qt-project.org/c/pyside/pyside-setup/+/498796 https://codereview.qt-project.org/c/pyside/pyside-setup/+/497120 https://codereview.qt-project.org/c/pyside/pyside-setup/+/545224 https://codereview.qt-project.org/c/pyside/pyside-setup/+/493006 Feel free to CC my private email address for future enquiries regarding QtAsyncio if you send them to the PySide mailing list: adrian.ghc at outlook.com Best regards and thank you for your enthusiasm, Adrian Herrmann Specialist Software Engineer, Qt for Python Qt Group Erich-Thilo-Str. 10 12489 Berlin, Germany adrian.herrmann at qt.io +49 1578 0598682 www.qt.io Gesch?ftsf?hrer: Mika P?lsi, Juha Varelius, Jouni Lintunen Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B ________________________________________ Von: guilbaudl Gesendet: Montag, 22. Juli 2024 00:36 An: Adrian Herrmann Betreff: Active development for QtAsyncio Hello Adrian, I saw that you are actively working on the QtAsyncio library for Python. I myself try to fix what is missing in the lib in order to make it work for a small use case I have, where it uses aiohttp. I was wondering if you wanted to have a small piece of code to reproduce the problem I am facing. Also, despite my poor understanding of how QtAsyncio works on top of asyncio, I am willing to help in any way I can. So far, I mostly copied and adapted parts from asyncio to QtAsyncio to get farther in the resolution of the issue with using aiohttp. But do you have some documentation to understand better the functioning of QtAsyncio and why it has been implemented as it is so far? Best regards, Loan Guilbaud