populse / capsul

Collaborative Analysis Platform : Simple, Unifying, Lean
Other
7 stars 14 forks source link

Documentation page generation is failing #259

Open sapetnioc opened 1 year ago

sapetnioc commented 1 year ago

In the doc generation workflow, there is the following error:

Exception occurred:
  File "/home/runner/work/capsul/capsul/capsul/qt_apps/utils/application.py", line 22, in <module>
    class Application(Qt.QApplication):
AttributeError: module 'PyQt5.Qt' has no attribute 'QApplication'
sapetnioc commented 1 year ago

There are many classes that are not available in Qt module in the context of the Github actions workflow but it works within a development environment. I fixed a couple of them in Capsul but now the error comes from soma-base:

Exception occurred:
  File "/opt/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/soma_base-5.2.0-py3.10.egg/soma/qt_gui/predef_lineedit.py", line 14, in <module>
    class QPredefLineEdit(Qt.QLineEdit):

I may need some help to understand what is going on with qt_backend. If we make some objects available in Qt in some context for backward compatibility, we must choose between changing the context in Github action or stopping backward compatibility to have the test giving the same result in all contexts.

denisri commented 1 year ago

It should not be different in different contexts. Something seems to be wrong (or different) in PyQt5 installation, which is unexpected. The PyQt5.Qt module is normally part of PyQt5, and soma.qt_gui.qt_backend just loads it. So I wonder if this install via pip is different from the one we usually use. I can try in a virtualenv for instance but I'm not sure which system gh-actions is running in.

denisri commented 1 year ago

That's it: when installed via pip, the module PyQt5.Qt exists, but is empty... Whereas in the one we use (compiled from sources and using the system Qt libs), PyQt5.Qt contains all Qt classes. That's weird. In PyQt6, the submodule Qt with all classes has been removed, but it did exist in PyQt5.

sapetnioc commented 1 year ago

Shouldn't we replace this module by an empty one in qt_backend ? Just to be sure to have an exception in all contexts if someone use it ?

denisri commented 1 year ago

PyQt5 installed via pip is based on sip6, (PyQt5.sip.SIP_VERSION_STR is '6.7.6') whereas the one we use is sip4 (PyQt5.sip.SIP_VERSION_STR is '4.19.15'), this is possibly what makes the difference.

denisri commented 1 year ago

Shouldn't we replace this module by an empty one in qt_backend ? Just to be sure to have an exception in all contexts if someone use it ?

I didn't know this module has been emptied (in sip6?) - I even wonder why it still exists since it doesn't contain anything. On the other hand the "working" PyQt5.Qt was very handy, and it is actually used in lots of our codes. So getting rid of its use is not a simple matter, it will need greps and hundreds of replacements in the codes. For now it's probably simpler to do it the other way: in qt_backend we could test if Qt is empty, and rebuild it (populate it with all classes from all modules). I think I have already done so for PyQt6 so this should not be difficult. In the long term, I agree we should not use it any longer as it is not present in PyQt6, but we just did not know that it would be deprecated.

denisri commented 1 year ago

I have pushed a fix in 5.1 and master branches. But in 6.0 the branches have really diverged, I don't know how to merge...

sapetnioc commented 1 year ago

Thanks. I will try to see if it is impossible or not to merge master into 6.0. I will probably go through a pull request to use Github features to see the differences.