Details
-
Epic
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
None
-
Qt for Python Async
-
9fc6f33fd (6.4), 3d036e0aa (dev), 90b3bab77 (dev), 971c59444 (dev), a53379153 (dev), 010592b18 (dev), 5a2f3e141 (dev), e017d9cdd (6.6), c94fc27da (6.6), 1961d9ad7 (dev), a9fec9067 (6.6), c4179d323 (dev), ef4ffcb01 (dev), 9c9781c6c (dev), dce92fee1 (6.6)
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:
- Fundamental infrastructure for event loop and async computing
- 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
- is duplicated by
-
PYSIDE-668 Python's asyncio, and an awaitable signal proposal
- Closed
- relates to
-
PYSIDE-1521 closeEvent() not sent if QApplication isn't in main thread
- Closed
-
PYSIDE-1999 Async examples/tutorials: Trio
- Closed
- mentioned in
-
Page Loading...
Gerrit Reviews
For Gerrit Dashboard: PYSIDE-769 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
492166,108 | QtAsyncio: Implement non-socket transports | dev | pyside/pyside-setup | Status: NEW | 0 | 0 |
493006,106 | QtAsyncio: Implement opening network connections | dev | pyside/pyside-setup | Status: NEW | 0 | 0 |
497120,94 | QtAsyncio: Implement QAsyncioServer | dev | pyside/pyside-setup | Status: NEW | -1 | 0 |
498796,82 | QtAsyncio: Add helper functions | dev | pyside/pyside-setup | Status: NEW | 0 | 0 |
545224,21 | QtAsyncio: Implement socket transports | dev | pyside/pyside-setup | Status: NEW | 0 | 0 |
545892,17 | QtAsyncio: Implement subprocess functions | dev | pyside/pyside-setup | Status: NEW | 0 | 0 |
434740,27 | examples: Add async examples | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
436735,4 | examples: Add async examples | 6.3 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
436893,3 | examples: Fix docstr in async/eratosthenes re:tick | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
436897,7 | examples: Add asyncio versions of async examples | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
436955,6 | examples: Fix docstr in async/eratosthenes re:tick | 6.3 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
442595,2 | async: Fix formatting in rst documentation | 6.4 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
442619,2 | async: Fix formatting in rst documentation | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
447812,2 | examples: Add asyncio versions of async examples | 6.4 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
447813,1 | examples: Add asyncio versions of async examples | 6.3 | pyside/pyside-setup | Status: ABANDONED | 0 | 0 |
489103,23 | Implement custom asyncio event loop based on Qt | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
503189,6 | QtAsyncio: Fix time unit | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
503221,4 | QtAsyncio: Add queues test | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
504855,3 | QtAsyncio: Use asyncio._enter_task and _leave_task | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
504856,3 | QtAsyncio: Fix signature of cancel for future/task | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
504857,25 | QtAsyncio: Add wrapper for calls in executor | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
505222,2 | QtAsyncio: Use asyncio._enter_task and _leave_task | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
505831,2 | QtAsyncio: Fix signature of cancel for future/task | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
508352,2 | QtAsyncio: Miscellaneous improvements to Task | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
508429,2 | QtAsyncio: Miscellaneous improvements to Task | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
508468,2 | QtAsyncio: Do not stop loop at task completion | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
508469,2 | async: Revamp asyncio examples | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
508470,2 | QtAsyncio: Add _cancel_message to future + task | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
508744,2 | QtAsyncio: Do not stop loop at task completion | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
508746,2 | async: Revamp asyncio examples | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
509091,2 | QtAsyncio: Add _cancel_message to future + task | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
509851,2 | async: Remove unneeded signal from example | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
510810,2 | async: Remove unneeded signal from example | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
510843,2 | QtAsyncio: Don't schedule events when quitting app | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
511016,2 | QtAsyncio: Don't schedule events when quitting app | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
511338,2 | PySide build: add QtAsyncio to PySide6-Addons wheel | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
511388,2 | PySide build: add QtAsyncio to PySide6-Addons wheel | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
520580,2 | QtAsyncio: Handle exceptions properly in task step | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
521096,3 | QtAsyncio: Do not raise exception at handle cancel | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
521151,2 | QtAsyncio: Handle exceptions properly in task step | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
521165,2 | QtAsyncio: Do not raise exception at handle cancel | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
521195,2 | QtAsyncio: Add wrapper for calls in executor | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
525098,4 | QtAsyncio: Implement call_soon_threadsafe() | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
525401,2 | QtAsyncio: Implement call_soon_threadsafe() | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
525860,3 | QtAsyncio: Catch keyboard interrupts | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
525922,3 | QtAsyncio: Add QtAsyncio.run() function | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
526729,2 | QtAsyncio: Catch keyboard interrupts | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
526755,2 | QtAsyncio: Add QtAsyncio.run() function | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
527573,2 | QtAsyncio: Fix QtAsyncio.run() | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
527574,2 | QtAsyncio: Implement missing functions for policy | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
527575,7 | QtAsyncio: Fix cancelling waiting tasks | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
527576,7 | QtAsyncio: Make tasks awaitable | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
528123,6 | QtAsyncio: Shorten test durations | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
528181,2 | QtAsyncio: Fix for Python 3.12 | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
528186,3 | QtAsyncio: mypy fixes | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
528356,3 | QtAsyncio: Add documentation page | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
528519,2 | QtAsyncio: mypy fixes | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
528520,2 | QtAsyncio: Add documentation page | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
528535,2 | QtAsyncio: Fix QtAsyncio.run() | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
528584,2 | QtAsyncio: Implement missing functions for policy | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
528674,2 | QtAsyncio: Fix cancelling waiting tasks | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
528677,2 | QtAsyncio: Make tasks awaitable | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
528678,2 | QtAsyncio: Shorten test durations | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
528681,2 | QtAsyncio: Fix for Python 3.12 | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
534005,2 | QtAsyncio: Introduce quit_qapp argument | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
535756,2 | QtAsyncio: Introduce quit_qapp argument | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
539358,2 | QtAsyncio: Fix missing attribute on Windows | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
539385,2 | QtAsyncio: Fix missing attribute on Windows | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
540923,2 | examples: Simplify minimal_asyncio | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
540976,3 | examples: Simplify minimal_asyncio | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
545304,6 | QtAsyncio: Add handle_sigint argument to run() | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
545891,3 | QtAsyncio: Fix missing return value of run() | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
546097,2 | QtAsyncio: Fix missing return value of run() | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
546268,2 | QtAsyncio: Add handle_sigint argument to run() | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
546915,2 | QtAsyncio: Reset loop policy after QtAsyncio.run() | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
546946,2 | QtAsyncio: Reset loop policy after QtAsyncio.run() | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
547970,2 | QtAsyncio: Improve handling of outside termination | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
548289,2 | QtAsyncio: Improve handling of outside termination | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |