Skip to content

Maintain argument propagatoin to super class#2516

Merged
j9ac9k merged 4 commits intopyqtgraph:masterfrom
koutoftimer:feature/parentItem-propagation
Jan 19, 2023
Merged

Maintain argument propagatoin to super class#2516
j9ac9k merged 4 commits intopyqtgraph:masterfrom
koutoftimer:feature/parentItem-propagation

Conversation

@koutoftimer
Copy link
Copy Markdown
Contributor

All classes from pyqtgraph.opengl.__init__ based on GLGraphicsItem didn't respect parentItem argument, which leads to setParentItem() call each time you want to group up graphics.

Fixes #2514

All classes from `pyqtgraph.opengl.__init__` based on `GLGraphicsItem`
didn't respect `parentItem` argument, which leads to `setParentItem()`
call each time you want to group up graphics.
@koutoftimer
Copy link
Copy Markdown
Contributor Author

I can see that for 2D graphics there are tests for parent, but not for 3D, I suppose I have to add tests to this merge request.

Copy link
Copy Markdown
Member

@j9ac9k j9ac9k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the extra tests!

@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Nov 5, 2022

Hi @koutoftimer

Could you add some pytest.importskip to skip tests if pyopengl is not installed? You can see an example of how we do that with matplotlib here:

pytest.importorskip("matplotlib")

@koutoftimer
Copy link
Copy Markdown
Contributor Author

koutoftimer commented Nov 5, 2022

@j9ac9k I can, but I will ask you to explain to me why it is important, because I don't quite understand.

From the user's perspective I can see that there are no need to install opengl without actually using it, but as developer what is the guarantee that doing your stuff you will not break anything behind importorskip ? To asnwer this question you have to install opengl in dev environment, so why to bother?

@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Nov 5, 2022

@j9ac9k I can, but I will ask you to explain to me why it is important, because I don't quite understand.

From the user's perspective I can see that there are no need to install opengl without actually using it, but as developer what is the guarantee that doing your stuff you will not break anything behind importorskip ? To asnwer this question you have to install opengl in dev environment, so why to bother?

The main reason is that pyopengl is an optional dependency as you were commenting and the test suite should not fail in the absence of an optional dependency.

On my machine I have about 13 PyQtGraph virtual environments I use for development and testing; not all of them need pyopengl.

@koutoftimer
Copy link
Copy Markdown
Contributor Author

@j9ac9k why do you need 13 virtual environments? I can imagine a lot of pros and cons of using impororskip but I'd like to know real world test case.

@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Nov 6, 2022

I have so many environments due to testing different versions of Qt bindings and different versions of Python; and one environment for documentation builds.

Basically it's often I want to try and replicate a test failure, and run pip install numpy pyqt6 pytest and then run pytest tests.

The CI system has pyopengl for all pipelines so it should catch any issues that way.

@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Nov 6, 2022

Oh, the other gotcha w/ pyopengl is that on Python 3.8 and recent versions of macOS pyopengl won't work... we have a note about that in the README.

@koutoftimer
Copy link
Copy Markdown
Contributor Author

@j9ac9k if you still concerned about annotations, I can add from __future__ import annotations

@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Jan 19, 2023

@j9ac9k if you still concerned about annotations, I can add from __future__ import annotations

Sorry for the long wait here, a lot happens over here through the holidays and I end up taking an extended break from OSS work during that time.

I would rather avoid the from __future__ import annotations so using string based annotations are fine, they're just new to the library is all :)

test suite passed on my system without pyopengl so thanks for adding that skip check! This looks good to me, will give one last lookover before merging.

@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Jan 19, 2023

@koutoftimer thanks for your patience, this LGTM, merging!

Sorry for the delay!

@j9ac9k j9ac9k merged commit 1437a3a into pyqtgraph:master Jan 19, 2023
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.

Bug: 3D widgets didn't use parentItem

2 participants