-
Notifications
You must be signed in to change notification settings - Fork 75
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
feat(store): promote command #2082
base: main
Are you sure you want to change the base?
Conversation
To be undone before merging
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.
Just few minor comments but nothing major
|
||
name = "promote" | ||
help_msg = "Promote a charm from one channel to another on Charmhub." | ||
overview = "TODO" |
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 few words may be helpful as it'll land in the docs 😄
overview = "TODO" | |
overview = "TODO" |
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.
Will do - I've asked for your second review for other things ITMT
# Check snapcraft for equiv logic | ||
from_channel = charmcraft.store.models.ChannelData.from_str( | ||
parsed_args.from_channel | ||
) | ||
to_channel = charmcraft.store.models.ChannelData.from_str( | ||
parsed_args.to_channel | ||
) | ||
if None in (from_channel.track, to_channel.track): | ||
package_metadata = store.get_package_metadata(name) | ||
default_track = package_metadata.default_track | ||
if from_channel.track is None: | ||
from_channel = dataclasses.replace(from_channel, track=default_track) | ||
if to_channel.track is None: | ||
to_channel = dataclasses.replace(to_channel, track=default_track) |
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'm not sure about this logic, shouldn't we just make it explicit and error out if track is missing ?
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 both are missing, will it try to promote from default to default?
with emit.pause(): | ||
print( | ||
tabulate(presentable_candidates, tablefmt="plain", headers="keys"), | ||
file=sys.stderr, | ||
) |
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.
Any particular reason why it can't be a progress as well (beside not logging it) ?
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.
emit.progress
tries to represent it as a single line, even with permanent=True
.
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.
Would it work this way ? It seems to be a bit more consistent and does not leak the sys.stderr
implementation detail
with emit.pause(): | |
print( | |
tabulate(presentable_candidates, tablefmt="plain", headers="keys"), | |
file=sys.stderr, | |
) | |
with emit.open_stream() as stream: | |
print( | |
tabulate(presentable_candidates, tablefmt="plain", headers="keys"), | |
file=stream, | |
) |
@@ -463,7 +462,7 @@ requires-dist = [ | |||
{ name = "craft-platforms", specifier = "~=0.5" }, | |||
{ name = "craft-providers", specifier = ">=2.0.0" }, | |||
{ name = "craft-providers", specifier = ">=2.1.0" }, | |||
{ name = "craft-store", specifier = ">=3.1.0" }, | |||
{ name = "craft-store", git = "https://github.com/canonical/craft-store" }, |
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.
Reminder to update to the proper release
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.
Thank you!
with emit.pause(): | ||
print( | ||
tabulate(presentable_candidates, tablefmt="plain", headers="keys"), | ||
file=sys.stderr, | ||
) |
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.
Would it work this way ? It seems to be a bit more consistent and does not leak the sys.stderr
implementation detail
with emit.pause(): | |
print( | |
tabulate(presentable_candidates, tablefmt="plain", headers="keys"), | |
file=sys.stderr, | |
) | |
with emit.open_stream() as stream: | |
print( | |
tabulate(presentable_candidates, tablefmt="plain", headers="keys"), | |
file=stream, | |
) |
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 implementation looks reasonable under my assumptions, but I missed the complete context because the PR has no description.
# Check snapcraft for equiv logic | ||
from_channel = charmcraft.store.models.ChannelData.from_str( | ||
parsed_args.from_channel | ||
) | ||
to_channel = charmcraft.store.models.ChannelData.from_str( | ||
parsed_args.to_channel | ||
) | ||
if None in (from_channel.track, to_channel.track): | ||
package_metadata = store.get_package_metadata(name) | ||
default_track = package_metadata.default_track | ||
if from_channel.track is None: | ||
from_channel = dataclasses.replace(from_channel, track=default_track) | ||
if to_channel.track is None: | ||
to_channel = dataclasses.replace(to_channel, track=default_track) |
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 both are missing, will it try to promote from default to default?
No description provided.