-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use full plugin_name
when finding chosen reader
rather than startswith
#297
Conversation
Codecov Report
@@ Coverage Diff @@
## main #297 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 37 37
Lines 2788 2788
=========================================
Hits 2788 2788
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is... Pretty crazy. LOL
I can vaguely imagine the logic. Like, it's cool that git checkout
works with only the first few digits of a hash... But in a world where most plugin names start with napari-
, that's, um, not a good strategy! 😂
Pretty sure the napari tests failure is unrelated... it's a |
@DragaDoncila this seems like a genuine failure? I think? https://github.com/napari/npe2/actions/runs/5285688739/jobs/9564414847?pr=297#step:6:241
|
@jni I don't think it's possible for it to be related to this change, but I will take a closer look - I've been surprised before 😂 |
LOL Sorry, GH not updating. 😅 Um, yeah, there's been some issues with napari-svg recently but I don't know what the CI setup is/means here. I hope @tlambert03 or @Czaki might be able to comment on what the |
The other failure is definitely unrelated. I saw a few toots about how to drop codecov yesterday so I expect it's a widespread thing. 😂 |
|
@jni I have described you a problem with The workaround is using a constraints file when installing napari. see #298. We also need to add test for the latest released version of napari to avoid recent problems with npe2 0.7.0 and napari 0.4.17 |
Workaround for problem with napari-svg problem pointed in #297. The original bug is in repository as `("0", "1", "6") > ("0", "1", "10")` - the wrong code for version comparison.
In the context of wrong plugin selection. In PartSeg I have 2 plugins to read tiff files. First read plain tiff, second read tiff if there is the additional file with suffix |
Sounds grim @Czaki. If you can make a reproducible example or point me to how I can run the right workflow I'll happily look into it. |
As I think it is npe2 bug, and then I open the Issue here: #299 There is a movie showing the problem in this issue. |
Following the report [here](https://napari.zulipchat.com/#narrow/stream/212875-general/topic/reader.20plugin.20issue.20with.200.2E4.2E18) , this PR updates the `_read` function to check if a specific reader contribution of the form `plugin_name.reader_contribution` was passed as `plugin_name`. This worked before #297 (though it was **not** part of the intended public API), but will not work with `npe2>0.7.0` without this change. Note that this PR does not throw a specific error if the given plugin doesn't exist - we can add a check for that but it's actually non-trivial since the only public reader method atm is `iter_compatible_readers`. We arguably should never be passing a non-existent plugin this level deep so maybe that's ok. No doubt `napari` tests will now fail, but I will go and make those updates separately... cc @Czaki @psobolewskiPhD --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Ashley Anderson <aganders3@gmail.com> Co-authored-by: Nathan Clack <nclack@chanzuckerberg.com> Co-authored-by: Nathan Clack <nclack@gmail.com> Co-authored-by: Juan Nunez-Iglesias <jni@fastmail.com>
Prior to this PR, the wrong plugin might be chosen when multiple compatible readers are available with similar names, and the user chose to use a plugin with a shorter name. As a concrete example, if a user chose explicitly to read a file with
napari
, but a plugin with a longer name that starts withnapari
was also compatible, e.g.napari-tifffile
, the user's choice may have been ignored, depending on which plugin came up first in the comparison.To avoid this, this PR changes the comparison from
rdr.command.startswith
to strict comparison onrdr.plugin_name
. I've added a test that always passes in this branch, and only sometimes passes onmain
(😬) but I'm not sure if it's worth keeping it or if we are all just happy to accept the logic 🤷♀️