Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest pyside6 (6.7.0) breaks traitsui #2045

Open
axel-kah opened this issue Apr 10, 2024 · 1 comment
Open

Latest pyside6 (6.7.0) breaks traitsui #2045

axel-kah opened this issue Apr 10, 2024 · 1 comment

Comments

@axel-kah
Copy link

Hi,
our CI picked up a problem when using latest traitsui version on Windows using python 3.11. One of it's (optional) dependencies pyside6 released breaking changes on the 9th of April with version 6.7.0.

tests\unit\test_alias_manager.py:46: in test_gui
    with tester.create_ui(alias, {"view": alias_edit_view()}):
C:\Python311\Lib\contextlib.py:137: in __enter__
    return next(self.gen)
.hatch\all.py3.11-pyside6\Lib\site-packages\traitsui\testing\tester\ui_tester.py:105: in create_ui
    ui = object.edit_traits(**ui_kwargs)
.hatch\all.py3.11-pyside6\Lib\site-packages\traits\has_traits.py:1811: in edit_traits
    return view.ui(
.hatch\all.py3.11-pyside6\Lib\site-packages\traitsui\view.py:457: in ui
    ui.ui(parent, kind)
.hatch\all.py3.11-pyside6\Lib\site-packages\traitsui\ui.py:234: in ui
    self.rebuild(self, parent)
.hatch\all.py3.11-pyside6\Lib\site-packages\traitsui\qt\toolkit.py:168: in ui_live
    ui_live.ui_live(ui, parent)
.hatch\all.py3.11-pyside6\Lib\site-packages\traitsui\qt\ui_live.py:52: in ui_live
    _ui_dialog(ui, parent, BaseDialog.NONMODAL)
.hatch\all.py3.11-pyside6\Lib\site-packages\traitsui\qt\ui_live.py:72: in _ui_dialog
    BaseDialog.display_ui(ui, parent, style)
.hatch\all.py3.11-pyside6\Lib\site-packages\traitsui\qt\ui_base.py:294: in display_ui
    ui.owner.init(ui, parent, style)
.hatch\all.py3.11-pyside6\Lib\site-packages\traitsui\qt\ui_live.py:103: in init
    self.create_dialog(parent, style)
.hatch\all.py3.11-pyside6\Lib\site-packages\traitsui\qt\ui_base.py:252: in create_dialog
    self.control = control = _StickyDialog(self.ui, parent)
.hatch\all.py3.11-pyside6\Lib\site-packages\traitsui\qt\ui_base.py:135: in __init__
    self.setLayout(layout)
E   TypeError: 'PySide6.QtWidgets.QWidget.setLayout' called with wrong argument types:
E     PySide6.QtWidgets.QWidget.setLayout(QVBoxLayout)
E   Supported signatures:
E     PySide6.QtWidgets.QWidget.setLayout(PySide6.QtWidgets.QLayout)

PS: I know this is technically a duplicate of #2044 but the problem is more generic and I thought this issues title is more to the point.

@mdickinson
Copy link
Member

Here's a related failure, with the most recent PySide6 and TraitsUI installed directly from PyPI, on Python 3.12.3, on OS X / Intel (with Python from Macports).

What's interesting about this is that the signature displayed in the error message is at first glance compatible with the call being made. On closer inspection, it turns out that we've somehow ended up with two distinct QWidget classes, and our main window is an instance of one class, while shiboken is expecting an instance of the other class.

~/Desktop % python -m venv --clear .venv && source .venv/bin/activate
(.venv) ~/Desktop % pip install pyside6 traitsui
Collecting pyside6
  Using cached PySide6-6.7.0-cp39-abi3-macosx_11_0_universal2.whl.metadata (5.3 kB)
Collecting traitsui
  Using cached traitsui-8.0.0-py3-none-any.whl.metadata (6.8 kB)
Collecting shiboken6==6.7.0 (from pyside6)
  Using cached shiboken6-6.7.0-cp39-abi3-macosx_11_0_universal2.whl.metadata (2.5 kB)
Collecting PySide6-Essentials==6.7.0 (from pyside6)
  Using cached PySide6_Essentials-6.7.0-cp39-abi3-macosx_11_0_universal2.whl.metadata (3.7 kB)
Collecting PySide6-Addons==6.7.0 (from pyside6)
  Using cached PySide6_Addons-6.7.0-cp39-abi3-macosx_11_0_universal2.whl.metadata (4.0 kB)
Collecting traits>=6.2 (from traitsui)
  Using cached traits-6.4.3-cp312-cp312-macosx_10_9_x86_64.whl.metadata (5.0 kB)
Collecting pyface>=8.0 (from traitsui)
  Using cached pyface-8.0.0-py3-none-any.whl.metadata (7.7 kB)
Using cached PySide6-6.7.0-cp39-abi3-macosx_11_0_universal2.whl (525 kB)
Using cached PySide6_Addons-6.7.0-cp39-abi3-macosx_11_0_universal2.whl (273.7 MB)
Using cached PySide6_Essentials-6.7.0-cp39-abi3-macosx_11_0_universal2.whl (153.4 MB)
Using cached shiboken6-6.7.0-cp39-abi3-macosx_11_0_universal2.whl (369 kB)
Using cached traitsui-8.0.0-py3-none-any.whl (1.5 MB)
Using cached pyface-8.0.0-py3-none-any.whl (1.3 MB)
Using cached traits-6.4.3-cp312-cp312-macosx_10_9_x86_64.whl (5.0 MB)
Installing collected packages: traits, shiboken6, PySide6-Essentials, pyface, traitsui, PySide6-Addons, pyside6
Successfully installed PySide6-Addons-6.7.0 PySide6-Essentials-6.7.0 pyface-8.0.0 pyside6-6.7.0 shiboken6-6.7.0 traits-6.4.3 traitsui-8.0.0
(.venv) ~/Desktop % pip list
Package            Version
------------------ -------
pip                24.0
pyface             8.0.0
PySide6            6.7.0
PySide6_Addons     6.7.0
PySide6_Essentials 6.7.0
shiboken6          6.7.0
traits             6.4.3
traitsui           8.0.0
(.venv) ~/Desktop % python
Python 3.12.3 (main, Apr 12 2024, 20:23:48) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from traits.api import HasTraits, Int
>>> class A(HasTraits):
...     foo = Int()
... 
>>> a = A()
>>> a.configure_traits()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/mdickinson/Desktop/.venv/lib/python3.12/site-packages/traits/has_traits.py", line 2159, in configure_traits
    rc = toolkit().view_application(
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mdickinson/Desktop/.venv/lib/python3.12/site-packages/traitsui/qt/toolkit.py", line 237, in view_application
    return view_application.view_application(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mdickinson/Desktop/.venv/lib/python3.12/site-packages/traitsui/qt/view_application.py", line 92, in view_application
    return ViewApplication(
           ^^^^^^^^^^^^^^^^
  File "/Users/mdickinson/Desktop/.venv/lib/python3.12/site-packages/traitsui/qt/view_application.py", line 127, in __init__
    self.ui = self.view.ui(
              ^^^^^^^^^^^^^
  File "/Users/mdickinson/Desktop/.venv/lib/python3.12/site-packages/traitsui/view.py", line 457, in ui
    ui.ui(parent, kind)
  File "/Users/mdickinson/Desktop/.venv/lib/python3.12/site-packages/traitsui/ui.py", line 234, in ui
    self.rebuild(self, parent)
  File "/Users/mdickinson/Desktop/.venv/lib/python3.12/site-packages/traitsui/qt/toolkit.py", line 168, in ui_live
    ui_live.ui_live(ui, parent)
  File "/Users/mdickinson/Desktop/.venv/lib/python3.12/site-packages/traitsui/qt/ui_live.py", line 52, in ui_live
    _ui_dialog(ui, parent, BaseDialog.NONMODAL)
  File "/Users/mdickinson/Desktop/.venv/lib/python3.12/site-packages/traitsui/qt/ui_live.py", line 72, in _ui_dialog
    BaseDialog.display_ui(ui, parent, style)
  File "/Users/mdickinson/Desktop/.venv/lib/python3.12/site-packages/traitsui/qt/ui_base.py", line 294, in display_ui
    ui.owner.init(ui, parent, style)
  File "/Users/mdickinson/Desktop/.venv/lib/python3.12/site-packages/traitsui/qt/ui_live.py", line 103, in init
    self.create_dialog(parent, style)
  File "/Users/mdickinson/Desktop/.venv/lib/python3.12/site-packages/traitsui/qt/ui_base.py", line 252, in create_dialog
    self.control = control = _StickyDialog(self.ui, parent)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mdickinson/Desktop/.venv/lib/python3.12/site-packages/traitsui/qt/ui_base.py", line 134, in __init__
    layout.addWidget(self._mw)
TypeError: 'PySide6.QtWidgets.QBoxLayout.addWidget' called with wrong argument types:
  PySide6.QtWidgets.QBoxLayout.addWidget(QMainWindow)
Supported signatures:
  PySide6.QtWidgets.QBoxLayout.addWidget(PySide6.QtWidgets.QWidget, int = 0, PySide6.QtCore.Qt.AlignmentFlag = Default(Qt.Alignment))
>>> 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants