Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
qasync
allows coroutines to be used in PyQt/PySide applications by providing an implementation of the PEP 3156
event loop.
With qasync
, you can use asyncio
functionalities directly inside Qt app's event loop, in the main thread. Using async functions for Python tasks can be much easier and cleaner than using threading.Thread
or QThread
.
If you need some CPU-intensive tasks to be executed in parallel, qasync
also got that covered, providing QEventLoop.run_in_executor
which is functionally identical to that of asyncio
.
import sys
import asyncio
from qasync import QEventLoop, QApplication
from PySide6.QtWidgets import QWidget, QVBoxLayout
class MainWindow(QWidget):
def __init__(self):
super().__init__()
self.setLayout(QVBoxLayout())
self.lbl_status = QLabel("Idle", self)
self.layout().addWidget(self.lbl_status)
@asyncClose
async def closeEvent(self, event):
pass
@asyncSlot()
async def onMyEvent(self):
pass
if __name__ == "__main__":
app = QApplication(sys.argv)
event_loop = QEventLoop(app)
asyncio.set_event_loop(event_loop)
app_close_event = asyncio.Event()
app.aboutToQuit.connect(app_close_event.set)
main_window = MainWindow()
main_window.show()
with event_loop:
event_loop.run_until_complete(app_close_event.wait())
More detailed examples can be found here.
qasync
qasync
is a fork of asyncqt, which is a fork of quamash. qasync
was created because those are no longer maintained. May it live longer than its predecessors.
qasync
will continue to be maintained, and will still be accepting pull requests.
qasync
is tested on Ubuntu, Windows and MacOS.
If you need Python 3.6 or 3.7 support, use the v0.25.0 tag/release.
To install qasync
, use pip
:
pip install qasync
You may use, modify and redistribute this software under the terms of the BSD License. See LICENSE.
FAQs
Python library for using asyncio in Qt-based applications
We found that qasync demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.