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

allow overwriting existing registry entries #2744

Merged
merged 1 commit into from
Mar 8, 2024

Conversation

kecnry
Copy link
Member

@kecnry kecnry commented Mar 8, 2024

Description

This pull request adds support for overwriting existing registry entries, which is particularly useful for downstream apps that want to modify something already in the registry without having to give it a new name.

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)?

@kecnry kecnry added no-changelog-entry-needed changelog bot directive Affects-dev changelog bot directive labels Mar 8, 2024
@kecnry kecnry added this to the 3.9 milestone Mar 8, 2024
@kecnry kecnry mentioned this pull request Mar 8, 2024
8 tasks
@kecnry kecnry force-pushed the downstream-registry-overwrite branch from c9e2be8 to f9c348e Compare March 8, 2024 16:51
Copy link

codecov bot commented Mar 8, 2024

Codecov Report

Attention: Patch coverage is 91.66667% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 88.92%. Comparing base (af8d1b8) to head (f9c348e).
Report is 4 commits behind head on main.

Files Patch % Lines
jdaviz/core/registries.py 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2744      +/-   ##
==========================================
+ Coverage   88.85%   88.92%   +0.07%     
==========================================
  Files         108      108              
  Lines       15920    16003      +83     
==========================================
+ Hits        14145    14230      +85     
+ Misses       1775     1773       -2     

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

@kecnry kecnry marked this pull request as ready for review March 8, 2024 17:44
@@ -75,10 +77,12 @@ def add(self, name, cls, label=None):
in the first parameter.
label : str, optional
The label displayed in the tooltip when hovering over the tray tab.
overwrite : bool, optional
Whether to overwrite an existing entry with the same ``label``.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add one more sentence to explain what would happen to the old thing that was overwritten?

Copy link
Member Author

Choose a reason for hiding this comment

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

suggestions for wording? It is replacing it in the registry, so calls to access the item will retrieve the new one instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is the old one going to be destroyed somewhere or just sitting in purgatory? I am not familiar with this machinery.

Copy link
Member Author

Choose a reason for hiding this comment

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

This doesn't do anything to destroy it, no, it just replaces the reference in the registry.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we destroy it?

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 see any reason to, its generally just a class and shouldn't be instantiated yet

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.

Code looks like code. Thanks!

@pllim
Copy link
Contributor

pllim commented Mar 8, 2024

It is Friday and the weather is nice, let's get this in. 😆

@pllim pllim merged commit 43487aa into spacetelescope:main Mar 8, 2024
20 checks passed
@kecnry kecnry deleted the downstream-registry-overwrite branch March 8, 2024 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Affects-dev changelog bot directive no-changelog-entry-needed changelog bot directive Ready for final review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants