Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Use upstream feature-flag proposal for aperture marks #7

Closed
wants to merge 2 commits into from

Conversation

kecnry
Copy link
Owner

@kecnry kecnry commented Jan 19, 2024

This PR re-implements the feature-flag in spacetelescope#2664 using the proposed infrastructure up-for-debate in XXX (and therefore also includes that diff here).

# To make a feature public:
# * search for all instances of the feature label and remove any if-blocks, boolean traitlets
# in plugins, and ultimately remove from this dictionary.
feature_flags = Dict({'cone_apertures': False}).tag(sync=True)
Copy link
Owner Author

Choose a reason for hiding this comment

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

the feature-label itself is defined here

dev_cone_support = Bool(False).tag(sync=True)
ff_cone_apertures = Bool(False).tag(sync=True)
Copy link
Owner Author

Choose a reason for hiding this comment

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

this creates the traitlet in the plugin so that we can use v-if within vu

@@ -109,6 +109,8 @@ def __init__(self, *args, **kwargs):
"please load data to enable this plugin."
)

self._sync_feature_flag('ff_cone_apertures', 'cone_apertures')
Copy link
Owner Author

Choose a reason for hiding this comment

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

this synchronizes the boolean traitlet in the plugin to get updates when the feature flag is toggled

<div v-if="aperture_selected !== 'Entire Cube' && dev_cone_support">
<div v-if="aperture_selected !== 'Entire Cube' && ff_cone_apertures">
Copy link
Owner Author

Choose a reason for hiding this comment

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

this allows hiding elements in vue when the feature is disabled

extract_plg._obj.dev_cone_support = True
extract_plg._obj.wavelength_dependent = True
assert mark.x[1] == before_x[1]
with cubeviz_helper.app._ff_temporarily_enabled('cone_apertures'):
Copy link
Owner Author

Choose a reason for hiding this comment

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

and lastly, tests that use the feature can use this context manager to temporarily enable them for testing. Once the feature is ready to be made public, we can either set the default to True, or preferably just search for all instances of the label, remove those lines, and remove some indentation.

@kecnry kecnry force-pushed the aperture-marks-using-ff branch from 553af3c to dea26c2 Compare January 22, 2024 13:34
@kecnry kecnry force-pushed the aperture-marks-using-ff branch from dea26c2 to 9682af1 Compare January 22, 2024 17:27
@kecnry kecnry force-pushed the aperture-marks branch 2 times, most recently from 67e68e0 to 0dcfd1d Compare January 24, 2024 14:25
@kecnry kecnry force-pushed the aperture-marks-using-ff branch from 9682af1 to c505591 Compare January 24, 2024 14:26
Copy link

codecov bot commented Jan 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (aperture-marks@0dcfd1d). Click here to learn what that means.

Additional details and impacted files
@@                Coverage Diff                @@
##             aperture-marks       #7   +/-   ##
=================================================
  Coverage                  ?   90.86%           
=================================================
  Files                     ?      162           
  Lines                     ?    21132           
  Branches                  ?        0           
=================================================
  Hits                      ?    19201           
  Misses                    ?     1931           
  Partials                  ?        0           

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

@kecnry kecnry deleted the branch aperture-marks January 26, 2024 13:00
@kecnry kecnry closed this Jan 26, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant