wgpu-py icon indicating copy to clipboard operation
wgpu-py copied to clipboard

Loop from sniffio

Open almarklein opened this issue 3 months ago • 1 comments

Make use of https://github.com/pygfx/rendercanvas/pull/151, so that loop detection is fully automatic, via sniffio.

This only depends on https://github.com/pygfx/rendercanvas/pull/151 for code that uses .then(). So if we assume no user is using request_adapter(...loop=loop), we can safely merge this :)

almarklein avatar Nov 25 '25 12:11 almarklein

Looks like Github is deprecating macos_x86?

almarklein avatar Nov 25 '25 14:11 almarklein

Ok, this morning in the shower (as insights often do) I realized that the asyncgen hook is often a method on a loop object, so we can get the loop object (and corresponding call_soon_threadsafe function) in a way that's faster, but also removes the need for rendercanvas to have a "current loop".

Code is updated to reflect this. Also see the additions to the gui_direct.py example.

almarklein avatar Dec 16 '25 11:12 almarklein

Tests pass, except that CD run, which I fixed in #784.

almarklein avatar Dec 17 '25 09:12 almarklein