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

Initial attempt to create base GUI classes #113

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

dalthviz
Copy link
Member

@dalthviz dalthviz commented Nov 7, 2024

Description

Create a set of base GUI classes so the logic implement can be reused while also keeping an implementation for napari

Part of #59

Notes

  • Although more work needs to be done here (somehow improve coverage/add test to the base classes for example). Marking as ready to review to get some feedback on the approach used here. Let me know what you think @jaimergp !

@dalthviz dalthviz self-assigned this Nov 7, 2024
Copy link

codecov bot commented Nov 7, 2024

Codecov Report

Attention: Patch coverage is 91.97397% with 74 lines in your changes missing coverage. Please review.

Project coverage is 92.38%. Comparing base (dbcd362) to head (e5c1e63).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
napari_plugin_manager/base_qt_plugin_dialog.py 91.77% 72 Missing ⚠️
napari_plugin_manager/qt_plugin_dialog.py 95.65% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #113      +/-   ##
==========================================
- Coverage   93.54%   92.38%   -1.16%     
==========================================
  Files          10       11       +1     
  Lines        1813     1931     +118     
==========================================
+ Hits         1696     1784      +88     
- Misses        117      147      +30     

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

@dalthviz dalthviz marked this pull request as ready for review November 13, 2024 18:34
PYPI = 'PyPI'


class BasePackageMetadata(Protocol):
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this just for the types? Should it be guarded behind TYPE_CHECKING? Not saying that's the best practice, I honestly don't know, but it was weird to see the same schema in this protocol class and also in the named tuple below.

author, source, version, and buttons to update, install/uninstall, etc.
"""

BASE_PACKAGE_NAME = ''
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this for? I think the base class should be very well documented so downstream users know what to subclass.

self.install_info_button.addWidget(self.info_choice_wdg)
self.info_choice_wdg.show()

def _handle_plugin_api_version(self, plugin_api_version):
Copy link
Contributor

Choose a reason for hiding this comment

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

As a rule of thumb, if the base class method is raising NotImplementedError, I think we should explain what's the expected behavior of this method with a docstring.

Comment on lines 39 to 40
CONDA = 'Conda'
PYPI = 'PyPI'
Copy link
Contributor

Choose a reason for hiding this comment

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

These two globals are also available in the base module. Shall we delete here?

@jaimergp
Copy link
Contributor

I like it a lot @dalthviz. Just added some comments about documenting the pieces that are meant to be subclassed. The base class docstring should detail how to get to a functional plugin manager in the subclass; e.g. "make sure to subclass all the methods that raise NotImplementedError, details are available in each method docstring".

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