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

Fix failing CI by using PySide6 in all of our dev environments #333

Merged
merged 6 commits into from
Feb 7, 2023

Conversation

apyrgio
Copy link
Contributor

@apyrgio apyrgio commented Feb 6, 2023

Our CI currently fails for several reasons, the main one being that more and more environments (Fedora 37, Debian Bookworm) use Python 3.11, which is incompatible with PySide2 from PyPI.

In this PR, we remove PySide2 as a dev dependency, and we use PySide6 for all of our environments. The Debian/Fedora packages for Dangerzone will still require PySide2, but that should be the last reference to PySide2 remaining, until we fuly complete the Qt6 transition.

Fixes #294
Fixes #330

(This PR depends on top of #296)

@deeplow
Copy link
Contributor

deeplow commented Feb 7, 2023

Other than the above comment, this LGTM. ✔️

@apyrgio apyrgio force-pushed the 330-pyside6 branch 2 times, most recently from a75eea0 to 9b72a57 Compare February 7, 2023 15:07
Remove a Poetry version pin to 1.2.2, which causes installation issues
on systems with Python 3.11.

The pin was originally introduced because Poetry 1.3 was deemed
unstable, due to the following bugs:

* #292 (comment)
* https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1029156

The first problem still stands, but we can circumvent it with the
`--no-ansi` flag, at no functionality cost. The second problem has been
resolved, but it never affected Ubuntu Focal in the first place.

Refs #292
Add libqt5gui5 as a test dependency in the 'convert-test-docs' step.
This package brings several other Qt and graphics libraries, which are
the ones that we actually require to run the tests *with PySide6*. Else,
we encounter this error:

```
Traceback (most recent call last):
  File "/home/circleci/project/dangerzone/gui/__init__.py", line 19, in <module>
    from PySide6 import QtCore, QtGui, QtWidgets
ImportError: libEGL.so.1: cannot open shared object file: No such file or directory
```

Note that the same package is not required when importing PySide2.QtGui,
which is why we hadn't encountered this issue before. Also, in the rest
of our environments, we explicitly install libqt5gui5, in order to run
the Dangerzone GUI.
@apyrgio apyrgio force-pushed the 330-pyside6 branch 3 times, most recently from 9347f8e to 86b2948 Compare February 7, 2023 16:05
Fix an issue in our PyTest wrapper, that caused this recursion error:

```
  File "shibokensupport/signature/loader.py", line 61, in feature_importedgc
  File "shibokensupport/feature.py", line 137, in feature_importedgc
  File "shibokensupport/feature.py", line 148, in _mod_uses_pysidegc
  File "/usr/lib/python3.10/inspect.py", line 1147, in getsourcegc
    lines, lnum = getsourcelines(object)gc
  File "/usr/lib/python3.10/inspect.py", line 1129, in getsourcelinesgc
    lines, lnum = findsource(object)gc
  File "/usr/lib/python3.10/inspect.py", line 954, in findsourcegc
    lines = linecache.getlines(file, module.__dict__)gc
  File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 177, in __dict__gc
    self.__makeattr(name)gc
  File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 157, in __makeattrgc
    result = importobj(modpath, attrname)gc
  File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 75, in importobjgc
    module = __import__(modpath, None, None, ["__doc__"])gc
  File "shibokensupport/signature/loader.py", line 54, in feature_importgc
RecursionError: maximum recursion depth exceededgc
```

This error seems to be related to
pytest-dev/pytest#1794. By not importing
`pytest` in our test wrapper, and instead executing directly, we can
avoid it.

Note that this seems to be triggered only by Shiboken6, which is why we
hadn't previously encountered it.
Instead of reinstalling shadow-utils, use the actual fix that the Fedora
devs have suggested (rpm --restore shadow-utils). The previous method
does not seem to work on Fedora 37, and it threw the following error
when building the development environment:

    Installed package shadow-utils-2:4.12.3-3.fc37.x86_64 (from koji-override-0) not available.
    Error: No packages marked for reinstall.
    Error: building at STEP "RUN dnf reinstall -y shadow-utils && dnf clean all": while running runtime: exit status 1
Drop PySide2 from our dependencies (previously used only on Linux
environments) and use PySide6 in all dev environments. The reason is
that PySide2 (from PyPI) does not support Python 3.11, and the variants
that do (Fedora/Debian packages) need to backport fixes from PySide6.

Our original attempt was to build PySide2 wheels for Python 3.11 but
it was not simple, nor maintainable. So, we were left with two options:

1. Install Python 3.10 in dev environments that have Python 3.11 by
   default.
2. Use PySide6 in all of our environments.

In both cases, we break package parity with the user's system, since we
are not testing Dangerzone under the same conditions. However, since
option (2) is forwards-compatible with where we want to move the
project (use Qt6 and PySide6), we chose that one.

Fixes #330
Run CI tests for Fedora 37 environments, now that we no longer require
PySide2 as a dev dependency.

Fixes #294
@apyrgio apyrgio merged commit e5368b1 into main Feb 7, 2023
@deeplow deeplow added this to the 0.4.1 milestone Feb 21, 2023
@deeplow deeplow deleted the 330-pyside6 branch May 11, 2023 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants