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

Cleanup plugin apis #3453

Merged
merged 7 commits into from
Feb 24, 2025
Merged

Cleanup plugin apis #3453

merged 7 commits into from
Feb 24, 2025

Conversation

kecnry
Copy link
Member

@kecnry kecnry commented Feb 19, 2025

Description

This pull request cleans up exposed plugin APIs which are meant for internal use only, including:

  • replacing **kwargs from subset_tools.import_region(..., **kwargs) with explicit region_format=None. If there are other kwargs passed to load_regions that we want the user to access, we should explicitly add and document those as well.
  • remove update=False in subset_tools.set_center(..., update=False) and hardcode to update=True. IMPORTANT: this is technically a change in behavior. Do we need to deprecate or is a changelog entry in a minor release sufficient? set_center was first made public in 4.1 by Rename Subsets Plugin #3304.. (see discussion at Cleanup plugin apis #3453 (comment))
  • remove models=None from model_fitting.get_model_parameters(models=None, ...). The helper-method is already deprecated and the plugin-method has not been released yet, so the existing deprecation should be sufficient.
  • remove models=None from model_fitting.get_models(models=None, ...). The helper-method is already deprecated and the plugin-method has not been released yet, so the existing deprecation should be sufficient.

Change log entry

  • Is a change log needed? If yes, is it added to CHANGES.rst? If you want to avoid merge conflicts,
    list the proposed change log here for review and add to CHANGES.rst before merge. If no, maintainer
    should add a no-changelog-entry-needed label.

Checklist for package maintainer(s)

This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.

  • Are two approvals required? Branch protection rule does not check for the second approval. If a second approval is not necessary, please apply the trivial label.
  • Do the proposed changes actually accomplish desired goals? Also manually run the affected example notebooks, if necessary.
  • Do the proposed changes follow the STScI Style Guides?
  • Are tests added/updated as required? If so, do they follow the STScI Style Guides?
  • Are docs added/updated as required? If so, do they follow the STScI Style Guides?
  • Did the CI pass? If not, are the failures related?
  • Is a milestone set? Set this to bugfix milestone if this is a bug fix and needs to be released ASAP; otherwise, set this to the next major release milestone. Bugfix milestone also needs an accompanying backport label.
  • After merge, any internal documentations need updating (e.g., JIRA, Innerspace)?

* if we have need for any kwargs passed through load_regions, we can explicitly include/document those as well
* user API is now hardcoded to update=True, which was not the previous default (BEHAVIOR CHANGE)
* deprecation warning already exists for the old helper methods, and plugin APIs have not been released yet, so no need to add deprecations here
@kecnry kecnry added this to the 4.2 milestone Feb 19, 2025
@github-actions github-actions bot added testing imviz plugin Label for plugins common to multiple configurations labels Feb 19, 2025
@kecnry kecnry marked this pull request as ready for review February 19, 2025 19:59
@@ -830,6 +830,26 @@ def set_center(self, new_cen, subset_name=None, update=False):
self.subset_definitions = []
self.subset_definitions = tmp

def set_center(self, new_cen, subset_name=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm I thought we agreed to just remove it from the public API exposure?

Copy link
Member Author

Choose a reason for hiding this comment

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

that's effectively what this does, but we want it to always be True now, whereas the internal method defaults to False

Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking more along the line of a one-line change here:

Copy link
Member Author

Choose a reason for hiding this comment

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

oh that removes set_center entirely, we don't want to do that, we just don't want to expose the update keyword argument

Copy link
Member Author

Choose a reason for hiding this comment

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

did we decide that we didn't want it exposed at all anymore? Maybe I just misunderstood/misremembered

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought we said it shouldn't be public API in the first place, right, @javerbukh ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes it shouldn't be public since it doesn't really make sense as API. The Recenter button provides a new center (as an estimate) which is what the subset is then centered on. Using that method with API would require the user to come up with the center themselves and at that point they should just use the update subset public API (which does not exist yet).

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, then I can revert that here and maybe we should wait until the alternative (upcoming) edit subset API is in place and then deprecate this method then?

@kecnry kecnry force-pushed the cleanup-plugin-apis branch from fb4285c to 8f78d52 Compare February 21, 2025 15:27
Copy link

codecov bot commented Feb 21, 2025

Codecov Report

Attention: Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 87.58%. Comparing base (dfe9a2f) to head (8f78d52).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
jdaviz/core/helpers.py 0.00% 2 Missing ⚠️

❌ Your patch status has failed because the patch coverage (60.00%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3453      +/-   ##
==========================================
- Coverage   87.59%   87.58%   -0.01%     
==========================================
  Files         128      128              
  Lines       20047    20042       -5     
==========================================
- Hits        17560    17554       -6     
- Misses       2487     2488       +1     

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

@@ -987,6 +987,35 @@ def get_model_parameters(self, models=None, model_label=None, x=None, y=None):

return parameters_cube

def get_model_parameters(self, model_label=None, x=None, y=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this not need a change log?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think so (see explanation in description), but can add it if you think there should

@pllim pllim added the api API change label Feb 21, 2025
Copy link
Contributor

@pllim pllim left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

Copy link
Contributor

@javerbukh javerbukh left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@kecnry kecnry merged commit f759009 into spacetelescope:main Feb 24, 2025
31 of 33 checks passed
@kecnry kecnry deleted the cleanup-plugin-apis branch February 24, 2025 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api API change imviz plugin Label for plugins common to multiple configurations Ready for final review testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants