Skip to content

consider using qtpy for qt abstraction layer #6118

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

Closed
tacaswell opened this issue Mar 6, 2016 · 15 comments
Closed

consider using qtpy for qt abstraction layer #6118

tacaswell opened this issue Mar 6, 2016 · 15 comments
Labels
Difficulty: Medium https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues GUI: Qt
Milestone

Comments

@tacaswell
Copy link
Member

Instead of rolling our own, use https://github.com/spyder-ide/qtpy

The proposal would be to replace our qt_compat.py almost wholesale with qtpy imports.

@tacaswell tacaswell added GUI: Qt Difficulty: Medium https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues labels Mar 6, 2016
@tacaswell tacaswell added this to the 2.1 (next point release) milestone Mar 6, 2016
@jenshnielsen
Copy link
Member

Sounds like a very good idea to me

@mdboom
Copy link
Member

mdboom commented Mar 7, 2016

Yes. Spyder's needs of Qt are much more complex than ours, so I suspect it should do everything we need it to do.

@tacaswell
Copy link
Member Author

spyder-ide/qtpy#84 <- they now support pyside2 so are back to wrapping parity.

@tacaswell tacaswell modified the milestones: 2.1 (next point release), 2.2 (next next feature release) Oct 3, 2017
@anntzer
Copy link
Contributor

anntzer commented Dec 13, 2017

See #9993 (comment) for arguments against it.

@anntzer
Copy link
Contributor

anntzer commented Jan 30, 2018

I think spyder-ide/qtpy#138 needs to be fixed first by them.

Edit: my PR to fix the issue went in.

@anntzer
Copy link
Contributor

anntzer commented Jun 19, 2018

Upon further thought, I am against switching to qtpy. The main reason for this is that we already don't declare a dependency on any qt binding, and I guess we wouldn't declare a dependency on qtpy either. Likewise, qtpy does not (by design) declare a dependency on any qt binding. The end result is that you'd have to add yet another manual dependency management step for whoever wants to install matplotlib+qt from pypi.

@timhoffm
Copy link
Member

Not sure if this really works and is an accepted way of doing things, but could we create a placeholder package matplotlib-qt, that will basically only resolve the required dependencies when installing it with pip?

@anntzer
Copy link
Contributor

anntzer commented Jun 20, 2018

That doesn't really help, as the main sticking point is that multiple underlying qt bindings are supported (unless you want to create matplotlib-pyqt4, matplotlib-pyqt5, matplotlib-pyside, matplotlib-pyside2, but meh).

@timhoffm
Copy link
Member

All of them are an overkill, but maybe we declare one of them (pyside2 in the long run?) the preferred choice. Then there would be a simple way for the "standard" installation. If people want to use other bindings, they can but have to resolve the dependencies themselves.

@tacaswell
Copy link
Member Author

We have to keep supporting all the qt bindings and probably should not pick an (official) favorite. We definitely can not pick up any dependencies on GUI bindings on pypi by default. We probably should be using the 'extras' part of setup.py a bit more effectively though to support pip install matplotlib[pyside2] etc.

The advantage of moving to qtpy is that we can deprecate all of our binding selection logic and off-load it to qtpy. We are then automatically in sync with any other project that uses qtpy (there is nothing more frustrating that trying to use more than one package that is opinionated about how to import qt bindings....).

@tacaswell tacaswell modified the milestones: v3.0, v3.1 Jun 20, 2018
@anntzer
Copy link
Contributor

anntzer commented Jun 21, 2018

The advantage of moving to qtpy is that we can deprecate all of our binding selection logic and off-load it to qtpy. We are then automatically in sync with any other project that uses qtpy (there is nothing more frustrating that trying to use more than one package that is opinionated about how to import qt bindings....).

I think this would only be true if you decide to kill the qt4agg and qt5agg backends and replace them by a single qtagg backend, because otherwise we would still need to maintain code to override the backend selection logic to force either qt4 (pyqt4/pyside) or qt5 (pyqt5/pyside2). (TBH I actually wouldn't mind doing such a deprecation, but I won't be the one making the call...)

@jklymak jklymak modified the milestones: v3.1.0, v3.2.0 Feb 5, 2019
@timhoffm timhoffm modified the milestones: v3.2.0, v3.3.0 Aug 16, 2019
@QuLogic QuLogic modified the milestones: v3.3.0, v3.4.0 May 7, 2020
@timhoffm
Copy link
Member

Is this still needed now that Qt4 is deprecated since Matplotlib 3.3?

@QuLogic
Copy link
Member

QuLogic commented Jul 15, 2020

Depends on how Qt6 goes, I guess?

@timhoffm
Copy link
Member

Do we need to/would this cover also PySide2? I not I propose to close this as Qt6 is not yet there and we don't need to hold the PR open just in case it may become relevant.

@efiring
Copy link
Member

efiring commented Jul 15, 2020

Closing. The last discussion was 2 years ago. If new reasons to switch to qtpy arise, a new issue can be opened.

@efiring efiring closed this as completed Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty: Medium https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues GUI: Qt
Projects
None yet
Development

No branches or pull requests

8 participants