-
Notifications
You must be signed in to change notification settings - Fork 7k
[release auto] use env var for twine password #59068
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
base: master
Are you sure you want to change the base?
Conversation
so that failed twine upload will not print the token out in logs Signed-off-by: Lonnie Liu <lonnie@anyscale.com>
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 Review
This pull request improves security by using an environment variable for the twine password, preventing it from being logged in case of an error. The changes are correct and effectively address the issue. I've added a couple of suggestions to improve the flexibility and maintainability of the _call_subprocess helper function by making the new add_env parameter optional.
| import subprocess | ||
| import sys | ||
| from typing import List | ||
| from typing import Dict, List |
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.
|
|
||
| def _call_subprocess(command: List[str]): | ||
| subprocess.run(command, check=True) | ||
| def _call_subprocess(command: List[str], add_env: Dict[str, str]): |
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 signature of _call_subprocess has been changed to require the add_env parameter. While this works for the current use case, it makes the function less reusable and breaks its previous contract. A more robust approach would be to make add_env an optional parameter. This would maintain backward compatibility and make the helper function more flexible for future use. You would also need to adjust the function body to handle the case where add_env is None.
| def _call_subprocess(command: List[str], add_env: Dict[str, str]): | |
| def _call_subprocess(command: List[str], add_env: Optional[Dict[str, str]] = None): |
so that failed twine upload subprocess call will not print the token out in logs as part of the exception.