Skip to content

Use len(draw_data.cmd_lists) in imgui backend - #830

Merged
almarklein merged 2 commits into
pygfx:mainfrom
hmaarrfk:fix-imgui-cmd-lists-count
Aug 19, 2026
Merged

Use len(draw_data.cmd_lists) in imgui backend#830
almarklein merged 2 commits into
pygfx:mainfrom
hmaarrfk:fix-imgui-cmd-lists-count

Conversation

@hmaarrfk

@hmaarrfk hmaarrfk commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

closes #829

see failing tests in #831

stays compatible with 1.19.X

Claude's draft

ImDrawData.cmd_lists_count was a legacy alias documented as == CmdLists.Size, and imgui_bundle removed it in 1.92.900. Every ImguiWgpuBackend.render() call now raises AttributeError against that release. Fixes #829.

len(draw_data.cmd_lists) is exactly what the removed attribute equalled and works on all releases in the supported imgui-bundle>=1.92.0,<2 range, verified against 1.92.0, 1.92.3, 1.92.4, 1.92.5, 1.92.600, 1.92.601, 1.92.700, 1.92.801 and 1.92.900. No shim or version check is needed, and the pin does not need narrowing.

Add tests/test_util_imgui.py, which renders one real frame through ImguiRenderer on an offscreen canvas. The existing example tests never enter the backend's render() (the offscreen canvas does not pump a draw), so they pass even with the bug present. The "Test Examples" job is the only CI job that installs imgui_bundle, so it now runs that test file too; adding imgui-bundle to the tests extra was rejected because that extra is used by the 3.14 and pypy3.11 matrix jobs.

Resume this Claude session:

cd /home/mark/git/wgpu-py
claude --resume 590dd7bc-312c-419e-ad3d-2c69d00943cd

hmaarrfk added a commit to conda-forge-admin/wgpu-py-feedstock that referenced this pull request Aug 18, 2026
<details><summary>Claude's draft</summary>

imgui-bundle 1.92.900 removed `ImDrawData.cmd_lists_count`, a legacy
alias documented as `== CmdLists.Size`. Against that release every
`ImguiWgpuBackend.render()` call in wgpu 0.32.0 raises AttributeError.

Backport the one-line source change from
pygfx/wgpu-py#830 (commit 495a413), which uses
`len(draw_data.cmd_lists)` instead — exactly what the removed attribute
equalled, and valid across the whole supported `imgui-bundle>=1.92.0,<2`
range, so no pin change is needed. The upstream CHANGELOG, CI workflow
and new test file are not relevant to the package and are not included.

Verified the patch applies to the wgpu-0.32.0 PyPI sdist with both
`patch -p1 --dry-run` and `git apply --check -p1`.

Bump the build number to 1: 0.32.0 build 0 is already published on
conda-forge, so the repackaged content needs a new build.

Resume this Claude session:
```
cd /home/mark/git/feedstocks
claude --resume 5ef2cc50-a932-469f-af39-981f03b34d85
```
</details>
@hmaarrfk hmaarrfk closed this Aug 19, 2026
@hmaarrfk hmaarrfk reopened this Aug 19, 2026
<details><summary>Claude's draft</summary>

test_examples_run() ran an example's __main__ block and stopped there. Under
the offscreen canvas that only constructs the canvas and registers a draw
function, so nothing is drawn and the draw function -- the bulk of most
examples -- was never executed. Draw one frame for every example that exposes
a canvas.

Drawing is not enough on its own: rendercanvas calls the draw function inside
its log_exception() context, so an exception there is logged to the
"rendercanvas" logger and swallowed, and a frame still comes out. Assert that
nothing was logged there.

This makes the imgui examples fail against imgui_bundle 1.92.900, which is the
bug reported in pygfx#829 and is fixed in
the next commit.

Resume this Claude session:
```
cd /home/mark/git/wgpu-py
claude --resume 590dd7bc-312c-419e-ad3d-2c69d00943cd
```
</details>
<details><summary>Claude's draft</summary>

`ImDrawData.cmd_lists_count` was a legacy alias, documented in the imgui_bundle
stubs as `== CmdLists.Size`, and imgui_bundle removed it in 1.92.900. Every
`ImguiWgpuBackend.render()` call raises AttributeError against that release.
Fixes pygfx#829.

`len(draw_data.cmd_lists)` is exactly what the removed attribute equalled, and
works across the whole supported `imgui-bundle>=1.92.0,<2` range: verified
against 1.92.0, 1.92.3, 1.92.4, 1.92.5, 1.92.600, 1.92.601, 1.92.700, 1.92.801
and 1.92.900. No shim or version check is needed, and the pin does not need
narrowing.

The test from the previous commit fails without this change and passes with it.

Resume this Claude session:
```
cd /home/mark/git/wgpu-py
claude --resume 590dd7bc-312c-419e-ad3d-2c69d00943cd
```
</details>
@hmaarrfk
hmaarrfk force-pushed the fix-imgui-cmd-lists-count branch from fb2f641 to 461e941 Compare August 19, 2026 01:49

@almarklein almarklein left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@almarklein
almarklein merged commit 2c6ce9a into pygfx:main Aug 19, 2026
19 checks passed
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.

cmd_list_counts is no longer available in latest imgui_bundle

2 participants