microsoft / debugpy

An implementation of the Debug Adapter Protocol for Python
https://pypi.org/project/debugpy/
Other
1.85k stars 137 forks source link

Add PyQt6 and PySide6 support for python debugger to avoid import errors and fix breakpoint issue #1488

Open ruiyuanlu opened 10 months ago

ruiyuanlu commented 10 months ago

It's been a long while since PyQt6 and PySide6 released, more projects are upgraded to these two, yet not supported by debugger extension. I think it might possible to avoid import errors by adding import functions in qt_loaders.py.

截图 2023-12-19 10-16-18

Beside, breakpoints cannot hit in PyQt6 threads due to lack of thread hooks support. I think this commit could be a possible reference.

709 also noticed these issues.

RogerJL commented 7 months ago

Did also run into this (guess the debugger is used when executing step by step) `

%% show downsampled data in external window

%matplotlib qt show_cloud(pcd) `

Traceback (most recent call last): File "/home/roger/.local/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3553, in run_code async_ : Bool (Experimental) File "<ipython-input-13-5439e3d0ef23>", line 1, in <module> get_ipython().run_line_magic('matplotlib', 'qt') File "/home/roger/.local/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 2456, in run_line_magic cm = self.find_cell_magic(magic_name) File "/home/roger/.local/lib/python3.10/site-packages/IPython/core/magics/pylab.py", line 99, in matplotlib gui, backend = self.shell.enable_matplotlib(args.gui.lower() if isinstance(args.gui, str) else args.gui) File "/home/roger/.local/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3653, in enable_matplotlib user's matplotlibrc configuration file). Note that not all backends File "/home/roger/.pycharm_helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 142, in enable_gui return real_enable_gui(gui, app) File "/home/roger/.pycharm_helpers/pydev/pydev_ipython/inputhook.py", line 565, in enable_gui return gui_hook(app) File "/home/roger/.pycharm_helpers/pydev/pydev_ipython/inputhook.py", line 183, in enable_qt from pydev_ipython.qt_for_kernel import QT_API, QT_API_PYQT5, QT_API_PYQT6 File "/home/roger/.pycharm_helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, **kwargs) File "/home/roger/.pycharm_helpers/pydev/pydev_ipython/qt_for_kernel.py", line 127, in <module> from pydev_ipython.qt import QtCore, QtGui, QtSvg, QT_API File "/home/roger/.pycharm_helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, **kwargs) File "/home/roger/.pycharm_helpers/pydev/pydev_ipython/qt.py", line 16, in <module> raise RuntimeError("Invalid Qt API %r, valid values are: %r, %r, %r, %r" % RuntimeError: Invalid Qt API 'pyside6', valid values are: 'pyside', 'pyqt', 'pyqt5', 'pyqt6'