Skip to content
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

Fix naming of npe1 converted contribution commands and add tests #374

Merged
merged 2 commits into from
Feb 19, 2025

Conversation

DragaDoncila
Copy link
Contributor

Prior to this PR, declaring multiple implementations of the same hookspec in an npe1 plugin would lead to a converted manifest with multiple commands of the same ID e.g. plugin_name.get_reader multiple times, or plugin_name.write_labels multiple times.

Even though this is technically "valid" per the schema, it should not be, because this leads to errors in trying to register the commands in napari. App-model (correctly, imo), does not allow you to register multiple commands with the same ID.

We should update the schema validator to disallow multiple declarations of the same command ID, but in the meantime, this PR disambiguates converted commands for the same hook spec by using the function name instead of the spec name.

Copy link

codecov bot commented Feb 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (c536e39) to head (7ba08e8).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #374   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           37        37           
  Lines         2711      2711           
=========================================
  Hits          2711      2711           

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

Copy link
Member

@jni jni left a comment

Choose a reason for hiding this comment

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

wow, nice find 😵

@jni jni merged commit 40b67d7 into napari:main Feb 19, 2025
32 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.

2 participants