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

Remove deprecated libraries (pyqt4, pygtk) #225

Merged
merged 5 commits into from
Jun 18, 2024

Conversation

stephenfin
Copy link
Contributor

Both the PyGTK and PyQt4 libraries have been unsupported for many years. They
complicate the codebase and it's time we drop support for them. If people still
care about these, they can use older versions of pyperclip.

PyGTK is a dead project that hasn't seen any updates in over a decade
(since the release of GTK version 3) [1][2]. This is dead code.

[1] https://pypi.org/project/PyGTK/#history
[2] https://en.wikipedia.org/wiki/PyGTK

Signed-off-by: Stephen Finucane <[email protected]>
Qt4, and by extension PyQt4, are unsupported since 2015 [1]. There's no
reason to keep supporting them.

[1] https://www.qt.io/blog/2015/05/26/qt-4-8-7-released

Signed-off-by: Stephen Finucane <[email protected]>
Neither of these are supported anymore.

Signed-off-by: Stephen Finucane <[email protected]>
We were using a try-except "ladder" to handle switching between
backends. While there's nothing totally wrong with this, it was allowing for a
weird issue to develop. I had previously installed PyQt5 via my distro package
(Fedora) but had then removed this. Unfortunately removing the package had left
some files behind:

  $ ls /usr/lib64/python3.10/site-packages/PyQt5/* -la
  /usr/lib64/python3.10/site-packages/PyQt5/bindings:
  total 8
  drwxr-xr-x. 2 root root 4096 May 18 15:09 .
  drwxr-xr-x. 4 root root 4096 May 18 15:09 ..

  /usr/lib64/python3.10/site-packages/PyQt5/__pycache__:
  total 8
  drwxr-xr-x. 2 root root 4096 May 18 15:09 .
  drwxr-xr-x. 4 root root 4096 May 18 15:09 ..

This meant that I was able to import the 'PyQt5' module but nothing under this:

  $ python
  >>> import PyQt5
  >>> from PyQt5.QtWidgets import QApplication
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  ModuleNotFoundError: No module named 'PyQt5.QtWidgets'

This isn't pyperclip's fault. However, by moving away from this
try-catch ladder and wrapping the import logic inside the try block, we
can mitigate against this issue when it happens *and* result in less
indented code.

Signed-off-by: Stephen Finucane <[email protected]>
@stephenfin
Copy link
Contributor Author

I note that there are a couple of patches open to add support for the new GObject library in place for PyGTK. I'd be happy to drop that part of this PR and/or fold those PRs in here if that would help.

@jakemraz
Copy link

jakemraz commented Sep 5, 2022

awesome. it's hard to install pyqt4 on the recent ubuntu. please applying this PR to the latest!

@snowman2
Copy link

Seeing similar issues with gtk. Looks like others are trying to avoid them with their implementations in #233 & #182. Are there blockers preventing this PR (or one of the others) from being merged?

@snowman2
Copy link

Related #111

@asweigart asweigart merged commit 0d187a0 into asweigart:master Jun 18, 2024
@asweigart
Copy link
Owner

Thanks!

@stephenfin stephenfin deleted the remove-deprecated-libraries branch June 21, 2024 22:29
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

Successfully merging this pull request may close these issues.

4 participants