-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Update readthedocs-environment.json
file when env vars are added/deleted
#5540
Conversation
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.
Thanks for your PR.
I think we should use what we already have at PythonEnvironment
class that handle most of these there and just add a new check instead of duplicating the efforts in EnvironmentVariable
model.
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.
Hey! Changes look way better now!
I left some comments to improve the logic, but I think this is really close.
@stsewd |
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.
Thanks for working on this!
Changes are good to me!
def _get_env_vars(self): | ||
"""Return tuple of tuples of env vars with their values of the project.""" | ||
env_vars = self.version.project.environmentvariable_set.values_list('name', 'value') | ||
return tuple(env_vars) |
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 don't think this is needed (cast explicitly to a tuple)
@@ -174,6 +176,7 @@ def is_obsolete(self): | |||
|
|||
env_python = environment_conf.get('python', {}) | |||
env_build = environment_conf.get('build', {}) | |||
env_vars_hash = environment_conf.get('env_vars_hash', None) |
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.
Defaulting to None
will cause to every build before this change to wipe. Not really sure if that will be a problem, but we could default to the hash of an empty string here to prevent that.
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.
Yeahhh.. that is better.
Should I generate it every time or should I copy the value from the web for the sha256 hash of empty string?
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.
Defaulting to None
is fine.
The internal method should return None
as well if there are no Environment Variables.
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.
The internal method returns the hash of the empty string
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 understand that this PR is ready to merge. I think the last thing we talked here (#5540 (comment)) can be left as is it right not in the PR. |
…on"" This reverts commit 7d1f4c9.
…on"" This reverts commit 7d1f4c9.
Closes #5249