Skip to content

Conversation

@aslonnie
Copy link
Collaborator

so that failed twine upload subprocess call will not print the token out in logs as part of the exception.

so that failed twine upload will not print the token out in logs

Signed-off-by: Lonnie Liu <lonnie@anyscale.com>
@aslonnie aslonnie requested a review from a team as a code owner November 29, 2025 02:10
@aslonnie aslonnie added the go add ONLY when ready to merge, run all tests label Nov 29, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

To support making add_env an optional argument in _call_subprocess as suggested in another comment, Optional should be imported from typing.

Suggested change
from typing import Dict, List
from typing import Dict, List, Optional


def _call_subprocess(command: List[str]):
subprocess.run(command, check=True)
def _call_subprocess(command: List[str], add_env: Dict[str, str]):
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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.

Suggested change
def _call_subprocess(command: List[str], add_env: Dict[str, str]):
def _call_subprocess(command: List[str], add_env: Optional[Dict[str, str]] = None):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devprod go add ONLY when ready to merge, run all tests release-test release test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants