Skip to content

Fix #1122: Reinstate graphics APIs - #1123

Merged
leofang merged 7 commits into
NVIDIA:mainfrom
mdboom:fix-graphics-bindings
Oct 13, 2025
Merged

leofang merged 7 commits into
NVIDIA:mainfrom
mdboom:fix-graphics-bindings

Conversation

@mdboom

@mdboom mdboom commented Oct 10, 2025

Copy link
Copy Markdown
Contributor

These inadvertently got commented out in #914.

@copy-pr-bot

ghost commented Oct 10, 2025

Copy link
Copy Markdown
Contributor

Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@mdboom mdboom added the to-be-backported Trigger the bot to raise a backport PR upon merge label Oct 10, 2025
@mdboom mdboom self-assigned this Oct 10, 2025
@mdboom
mdboom requested a review from leofang October 10, 2025 14:57
@mdboom mdboom added the P0 High priority - Must do! label Oct 10, 2025
@mdboom

ghost commented Oct 10, 2025

Copy link
Copy Markdown
Contributor Author

/ok to test

@github-actions

This comment has been minimized.

@mdboom

ghost commented Oct 10, 2025

Copy link
Copy Markdown
Contributor Author

/ok to test

leofang
leofang previously approved these changes Oct 10, 2025
@leofang leofang added the cuda.bindings Everything related to the cuda.bindings module label Oct 10, 2025
@leofang leofang added this to the cuda-python 13-next, 12-next milestone Oct 10, 2025

@pytest.mark.skipif(PySide6 is None, reason="PySide6 not installed")
def test_graphics_api_smoketest():
from PySide6 import QtGui, QtOpenGL

ghost Oct 10, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems like we can avoid a bunch of the noisy skipif and imports by using importorskip here:

Suggested change
from PySide6 import QtGui, QtOpenGL
PySide6 = pytest.importorskip("PySide6")
QtGui = PySide6.QtGui
QtOpenGL = PySide6.QtOpenGL

ghost Oct 10, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I didn't know about the importorskip trick.

Still need to import the subpackages explicitly, though. PySide6 doesn't import everything automatically.

ghost Oct 10, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can pass a dotted path to importorskip, making this code even shorter:

QtGui = pytest.importorksip("PySide6.QtGui")
# etc

ghost Oct 10, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Didn't realize they were subpackages, otherwise I would've made that my original suggestion!

Co-authored-by: Leo Fang <leo80042@gmail.com>
@mdboom

ghost commented Oct 10, 2025

Copy link
Copy Markdown
Contributor Author

/ok to test

@mdboom
mdboom requested a review from cpcloud October 10, 2025 19:38
cpcloud
cpcloud previously approved these changes Oct 10, 2025

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The additional skip can be done later if desired.



def test_graphics_api_smoketest():
_ = pytest.importorskip("PySide6")

ghost Oct 10, 2025

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't love skippable tests because I feel too much complexity is introduced from the lack of symmetry between local and ci builds. For example, there is a potential for the tests to bit-rot if they aren't run frequently enough by devs or the ci runners.

@mdboom

ghost commented Oct 13, 2025

Copy link
Copy Markdown
Contributor Author

/ok to test

@mdboom

ghost commented Oct 13, 2025

Copy link
Copy Markdown
Contributor Author

/ok to test

@mdboom

ghost commented Oct 13, 2025

Copy link
Copy Markdown
Contributor Author

I have updated this to use the pyglet-based test as suggested by @pijyoi (and pyglet is small enough, I think it's fine to add a a test-only dependency) and added a the "always expected to fail" test as suggested by @rparolin. I think this is ready to go.

@mdboom

ghost commented Oct 13, 2025

Copy link
Copy Markdown
Contributor Author

/ok to test

@leofang leofang linked an issue Oct 13, 2025 that may be closed by this pull request
1 task done
@github-actions

ghost commented Oct 13, 2025

Copy link
Copy Markdown
Contributor

Successfully created backport PR for 12.9.x:

@github-actions

ghost commented Oct 13, 2025

Copy link
Copy Markdown
Contributor
Doc Preview CI
Preview removed because the pull request was closed or merged.

@rwgk

ghost commented Nov 4, 2025

Copy link
Copy Markdown
Contributor

FYI

See #1210 (comment)

test_graphics_apis.py::test_graphics_api_smoketest is SKIPPED in all CI jobs.

This isn't critical at the moment. However, SWQA stumbled over this test, PR #1210 is for resolving that issue.

@mdboom
mdboom deleted the fix-graphics-bindings branch December 9, 2025 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.bindings Everything related to the cuda.bindings module P0 High priority - Must do! to-be-backported Trigger the bot to raise a backport PR upon merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: cudaGraphicsGLRegisterImage returns null handle with cuda-bindings 12.9.3

5 participants