Skip to content
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

Fix trusted deprecation warning. #1412

Merged
merged 1 commit into from
Feb 21, 2025
Merged

Fix trusted deprecation warning. #1412

merged 1 commit into from
Feb 21, 2025

Conversation

marius-baseten
Copy link
Contributor

@marius-baseten marius-baseten commented Feb 21, 2025

🚀 What

See #1405 (comment)

💻 How

🔬 Testing

@@ -1087,8 +1087,8 @@ def run_python(script, target_directory):
type=bool,
is_flag=True,
required=False,
default=False,
help="[DEPRECATED]Trust truss with hosted secrets.",
default=None,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it weird to make a bool flag have a possible value of None? Instead could we leave the default as False, and then log below if trusted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A bit weird, it's "implicit" optional which is against strict typing. Unfortunately Optional[bool] does not work with click.option.

However, I find it more weird to set the default to False while the effective behavior is actually True.

None seems a good value for indicating "unspecified" which seems aligend with deprecated, even if there's a typing nit here. Alternatively we could set the default to True, then the warning case would never be triggered.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's good to leave the warning in case people are explicitly passing --trusted as well (and no longer need to). I'm sold that None is better than a confusing default, and the typing of the actual python function is more clear!

@marius-baseten marius-baseten merged commit 3c18a9e into main Feb 21, 2025
5 checks passed
@marius-baseten marius-baseten deleted the marius/trusted-fix branch February 21, 2025 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants