Skip to content

WIP: use scenex#276

Draft
gselzer wants to merge 15 commits into
pyapp-kit:mainfrom
gselzer:scenex-v2
Draft

WIP: use scenex#276
gselzer wants to merge 15 commits into
pyapp-kit:mainfrom
gselzer:scenex-v2

Conversation

@gselzer
Copy link
Copy Markdown
Collaborator

@gselzer gselzer commented May 4, 2026

Overview

This PR aims to replace the references to multiple canvas backends (vispy, pygfx) with a single implementation against scenex models. It's a large change, deserving lots of review and scrutiny.

Reasoning

  1. One canvas implementation The flexibility ndv offers users presents significant effort for ndv developers who want to enable a feature across both canvas implementations. Both src/ndv/views/_vispy and src/ndv/views/_pygfx have thousands of lines of code and separate test bases. As this PR shows, adopting scenex results in far fewer raw lines of code to maintain.

  2. Robust scene models Adding more functionality (including the ability to display multiple datasets, multiscale data as suggested in multiscale chunked rendering #275, orthoviews, etc.) will require knowledge of the scenegraph state. There are already bits and pieces of this in ndv (e.g. ImageHandle, RectangularROIHandle), but scenex exists for this purpose.

Implementation Goals

The primary goal of this PR is to condense down to a single canvas implementation, removing dependencies on vispy and pygfx in favor of dependencies of scenex, while maintaining the same public API, and all (excluding tests aimed at removed behavior) tests.

@tlambert03 your review is always welcome, but might be good to wait a little longer, as I fear that despite passing tests on my machine this PR will show me that there are many more things to clean up!

@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

❌ Patch coverage is 91.25737% with 89 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.77%. Comparing base (1dc1a8f) to head (5d08da8).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/ndv/views/_histogram.py 89.90% 32 Missing ⚠️
src/ndv/views/_shared_histogram.py 92.34% 29 Missing ⚠️
src/ndv/views/_data_canvas.py 93.24% 10 Missing ⚠️
src/ndv/controllers/_array_viewer.py 91.11% 8 Missing ⚠️
src/ndv/controllers/_channel_controller.py 82.22% 8 Missing ⚠️
src/ndv/views/_jupyter/_array_view.py 90.00% 1 Missing ⚠️
src/ndv/views/_qt/_array_view.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #276      +/-   ##
==========================================
+ Coverage   85.38%   86.77%   +1.38%     
==========================================
  Files          53       44       -9     
  Lines        7192     5180    -2012     
==========================================
- Hits         6141     4495    -1646     
+ Misses       1051      685     -366     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

gselzer added 2 commits May 4, 2026 15:40
Since we aren't running within a notebook, vispy will try to use glfw
over jupyter unless we force jupyter with the environment variable. This
is the same thing we do in scenex
Needed to get SignalGroupDesciptor.connect_child_events
gselzer added 5 commits May 11, 2026 15:18
This avoids some scenex errors from casting very large values into
32-bit floats
Will probably move them to a different file later
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.

1 participant