Page MenuHomePhabricator

[electrum] Qt6 transition, step 1: wrap PyQt5 with qtpy
ClosedPublic

Authored by PiRK on Jul 1 2025, 08:17.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC2eb505151119: [electrum] Qt6 transition, step 1: wrap PyQt5 with qtpy
Summary

qtpy s a small abstraction layer that lets you write applications using a single API call to either PyQt or PySide. It aims at mimicking the Qt5 API, so this is a good first minimal step to transition to PyQt6 or PySide6 (with the added benefit that we now also support PySide2 for Qt5)

PyQt5 remains the default binding, so this does not change any behavior and is mostly (to the exception of some doc and requirements files) an automated replacement:

  • PyQt5 -> qtpy
  • QtCore.QT_VERSION_STR -> QtCore.version
  • pyqtSignal -> Signal
  • pyqtProperty -> Property
  • pyqtSlot -> Slot
  • pyqtBoundSignal -> SignalInstance

This is a the minimal diff to make the code work with qtpy while still using PyQt5. In a following step we will make the necessary changes to be compatible also with PyQt6 and PySide6

Test Plan

run all tests (but coverage is nonexistent for the GUI/qt package)
Run the application and do some basic transaction spending / receiving tests

Build the AppImage and windows .exe release, check that it runs

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Jul 1 2025, 08:17
electrum/contrib/requirements/requirements-binaries.txt
2 ↗(On Diff #54639)

The version here is the latest. It is compatible with Python 3.7+, so it should work for all versions of python we officially support.
Maybe earlier version would also work fine, but I don't want to test all of them to find the actual limit.

electrum/electrumabc_gui/qt/main_window.py
4791 ↗(On Diff #54639)

This entire function is insane, and I'm tempted to delete it entirely so we wouldn't need to bother with SignalInstance. But there is a real risk that it solves real issues with plugins keeping weird references to signals after these signals are already destructed, so it would need some extensive testing to remove it safely.

PiRK edited the test plan for this revision. (Show Details)
This revision is now accepted and ready to land.Jul 1 2025, 12:01