Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-769

Qt for Python asynchronous support

    XMLWordPrintable

Details

    • Epic
    • Resolution: Unresolved
    • P3: Somewhat important
    • Some future version
    • None
    • QtAsyncio
    • None

    Description

      The PySide module should be compatible with most of the Python features and integrate as widely as possible with the wider Python ecosystem, including asyncio for asynchronous programming, coroutines and the async/await syntax. asyncio offers an API to replace their event loop with a custom implementation. An implementation of their API that wraps around QEventLoop and related classes would allow for mixed usage of asyncio and Qt. This implementation is called QtAsyncio, Qt for Python's first Python-only module.

      While the API is vast, not everything needs to be implemented for a custom implementation to be useful. Broadly, the API has two levels:

      1. Fundamental infrastructure for event loop and async computing
      2. User-facing API for use in applications

      Implementing the entirety of 1 is essential, while a subset can be chosen for 2 depending on users' needs.

      Currently, the work on 1. is broadly finished (some changes to PySide were necessary), including:

      • Futures, Tasks, Handles
      • Event loop policy, event loop management methods: run_until_complete(), run_forever(), stop(), is_running(), is_closed(), shutdown_asyncgens(), shutdown_default_executor(), close(), call_soon(), call_soon_threadsafe(), call_later(), call_at()time(), create_future(), create_task(), set_task_factory(), get_task_factory()
      • Running synchronous code in executors (ThreadPoolExecutor)

      The entirety of 2. would cover methods for:

      • Transports and protocols, network connections, servers
      • Sockets, signals, subprocesses

      The work on 2. is ongoing, with a current focus on the networking API. Which subset to prioritize could be determined based on user requirements. E.g., PYSIDE-2547 mentions file watchers and socket connections. Socket connections are in active development right now, with a particular challenge being converting from Python sockets to Qt sockets, especially when SSL is involved (Python sockets do not carry information regarding SSL, in contrast to QSslSocket.)

      Attachments

        Issue Links

          For Gerrit Dashboard: PYSIDE-769
          # Subject Branch Project Status CR V

          Activity

            People

              adherrma Adrian Herrmann
              crmaurei Cristian Maureira-Fredes
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              Votes:
              13 Vote for this issue
              Watchers:
              20 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are 6 open Gerrit changes