Move providers from _providers.py to _qproviders.py#6743
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6743 +/- ##
=======================================
Coverage ? 92.38%
=======================================
Files ? 611
Lines ? 54837
Branches ? 0
=======================================
Hits ? 50663
Misses ? 4174
Partials ? 0 ☔ View full report in Codecov by Sentry. |
|
So the |
|
We've narrowed down why the This is what happens when you add a dummy test that uses
Then, it's time for the real test to run - the
|
|
Note the test failures are because some non-qt view actions actually req Qt (and the viewer provider I have just moved). This can be fixed by using E.g., this test fails: napari/napari/_tests/test_view_layers.py Lines 132 to 139 in f464121 I think this needs to stay as is, and so this PR is probably dependent on #6767. |
# References and relevant issues Noticed when working on #6743 # Description The current 'non-qt' actions defined in: `napari/_app_model/actions/_view_actions.py` actually only make sense with a GUI viewer (visibility of axes etc). I have moved these inside: `napari/_qt/_qapp_model/qactions/_view.py` with the other Qt view actions. Note I have kept `ViewerToggleAction` where it is as it is general enough that it *could* be used with a non-qt viewer, but happy to move if requested.
|
CI failure is real. |
|
Okay @DragaDoncila this is finally green! |
DragaDoncila
left a comment
There was a problem hiding this comment.
This all works for me, as far as I can tell, and I agree that's the right spot for them. There's a fair few uncovered lines of code though - were these always not covered and they're showing now because of the move?
| layer = viewer.layers[name] | ||
| layer.data = datum[0] | ||
| for k, v in datum[1].items(): | ||
| setattr(layer, k, v) |
There was a problem hiding this comment.
@lucyleeow were these lines previously also not covered by tests?
There was a problem hiding this comment.
Yes. I notice when I move things over to qt I get mypy errors, so I assumed mypy was not checking in the old location. I guess it could be the same for code coverage?
I don't think the processors are well. There is just one test_processors.py, which just checks for for error in _add_layer_data_to_viewer
There was a problem hiding this comment.
ahh yeah I remember we had an issue about adding more tests for these. Ok cool, I'm approving!
DragaDoncila
left a comment
There was a problem hiding this comment.
LGTM, thanks @lucyleeow. @Czaki aside from the coverage issues, which were already a problem prior to this PR, any concerns?
|
@Czaki @DragaDoncila could this go in? |
|
Yes. I just merged main to validate if latest updates (like mypy requirements) do not broke something. |
# Description There are now no more 'non-qt' providers and processors since #6743 Amended some wording to clarify.
# Description There are now no more 'non-qt' providers and processors since napari#6743 Amended some wording to clarify.
…416) # References and relevant issues Relates to napari/napari#6848 Depends on napari/napari#6743 # Description Updates the info on where actions live in the napari codebase. --------- Co-authored-by: Peter Sobolewski <76622105+psobolewskiPhD@users.noreply.github.com>
Original PR #6743 by lucyleeow Original: napari/napari#6743
…iders.py` Merged from original PR #6743 Original: napari/napari#6743
References and relevant issues
closes #6585
Description
All the providers in
napari/_app_model/injection/_providers.pydepend on Qt._provide_viewerreturnsViewerModelinstance, which technically does not require Qt but AFAICT there is no way to get theViewerModelwithout usingQt.Searching in the codebase I cannot see
ViewerModelever being instantiated bynapari. I thinkViewerModelis so users can doviewer = napari.viewer.ViewerModel()in headless mode (asViewerrequires Qt)