-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add support for experimental features #1053
Conversation
The doc linkchecker keeps failing on travis, though I've manually verified that the links work. I've added retries to this link checker: #1054 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine. Just had a comment and a question.
self.experimental_feature_flags = set() | ||
# This is marked as internal but is intended to be used by | ||
# any code within Chalice. | ||
self._features_used = set() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I'm not sure if I like this trend of marking something as an internal property and then accessing it in the deployer code. I think we did something similar in blueprints. I get why we are doing it right now, but I'm wondering if there are any alternatives to tell users that it is an internal property? Options that I am thinking include: Just documenting it as internal (somewhat similar to some of the standard library) or having like an property like app.internal_stuff
that could be a grab bag for anything that needs to be accessed in the deployer but should not be used in a user's Chalice app.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we've learned that lesson from botocore that this isn't a great idea. It basically comes down to either:
a) We make it public, call it something that's hopefully obvious (e.g. internal_stuff
) and document that users shouldn't touch it and hope that they don't.
b) Make it actually internal with a _
prefix, and then we (chalice devs) purposefully access internal attributes we know are safe.
I think (b) is a much safer alternative, especially given that the _
prefix is a much more explicit mechanism. We need the concept of "package private" and I would prefer the option that requires chalice devs to be mindful of what they're accessing (e.g that _features_used
is safe) vs. customers knowing that they shouldn't access an attribute called internal_features_used
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with james. I think the convention for a friend-ish class should just be marked private, its a lot safer for everyone involved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess its fine. The only thing I do not like about the _
prefix is that it can be hard to know which _
properties are public for our development only. The only way to really tell is to look for the comment in the code where it is defined. We also have to be diligent in making sure we test the _
property so we do not accidentally refactor it in a backwards incompatible way (but I think we have a good amount of tests for the ones we have added so that should be fine).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good. Just had some questions about tangential stuff like docs.
validate_feature_flags(config.chalice_app) | ||
|
||
|
||
def validate_feature_flags(chalice_app): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to have some sort of warning/alert that something has been removed from the feature flag list and is now a stable feature? Looks like it doesn't really matter but if I upgrade chalice and redeploy and blueprints was moved to stable. I will still have my BLUEPRINTS
entry in the experimental feature flags list when not necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, though it doesn't necessarily need to be added now since we won't be using it yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer not to. I think warnings should only be for things that may cause issues for a user (i.e. a deprecation of something). In this case it's just unnecessary code that runs.
Perhaps in the future we can have a some sort of linting command that can check these things, but I don't think it needs to happen at deploy time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linting command seems good. Agreed it doesn't need to be deploy time.
must add to the ``app.experimental_feature_flags`` attribute. | ||
The status of an experimental API can be: | ||
|
||
* ``Trial`` - You must explicitly opt-in to use this feature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add a column here for a link to context. PR/Feature request thread or something like that. Especially useful for tracking when/why something was rejected/accepted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
$ chalice deploy | ||
You are using experimental features without explicitly opting in. | ||
Experimental features do not guarantee backwards compatibility and may be removed in the future. | ||
If you still like to use these experimental features, you can opt-in by adding this to your app.py file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you would
chalice/deploy/validate.py
Outdated
'You are using experimental features without explicitly opting in.\n' | ||
'Experimental features do not guarantee backwards compatibility ' | ||
'and may be removed in the future.\n' | ||
'If you still like to use these ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you would
validate_feature_flags(config.chalice_app) | ||
|
||
|
||
def validate_feature_flags(chalice_app): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, though it doesn't necessarily need to be added now since we won't be using it yet.
must add to the ``app.experimental_feature_flags`` attribute. | ||
The status of an experimental API can be: | ||
|
||
* ``Trial`` - You must explicitly opt-in to use this feature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Looks great! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feedback incorporated, I'll take a look at what codecov is complaining about.
validate_feature_flags(config.chalice_app) | ||
|
||
|
||
def validate_feature_flags(chalice_app): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer not to. I think warnings should only be for things that may cause issues for a user (i.e. a deprecation of something). In this case it's just unnecessary code that runs.
Perhaps in the future we can have a some sort of linting command that can check these things, but I don't think it needs to happen at deploy time.
Codecov Report
@@ Coverage Diff @@
## blueprints #1053 +/- ##
==============================================
+ Coverage 95.45% 95.45% +<.01%
==============================================
Files 27 27
Lines 4528 4556 +28
Branches 569 574 +5
==============================================
+ Hits 4322 4349 +27
- Misses 134 135 +1
Partials 72 72
Continue to review full report at Codecov.
|
Not sure what codecov/patch is complaining about, otherwise travis is passing now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I'm not sure why Codecov is saying we are missing coverage for that line. We have a test for the CLI exception. Otherwise 🚢
Issue #, if available:
#1019
Description of changes:
This adds support for feature flags, as discussed here: #1019 (comment)
This PR branches on top of (and targets) the blueprints branch, so after we merge this PR, we can merge blueprints back to master.