-
Notifications
You must be signed in to change notification settings - Fork 279
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
Migration script: migrate with user input #3044
Conversation
If I updated yt on a cluster and run a batch job, I'd be very unhappy that my CPUh were spent on waiting on |
Ok, this is an extremely good point. Let's brainstorm solutions.
…On Wed, Jan 27, 2021, 6:01 PM Kacper Kowalik ***@***.***> wrote:
If I updated yt on a cluster and run a batch job, I'd be very unhappy that
my CPUh were spent on waiting on input(). I'd be infinitely less unhappy
if it died right away.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#3044 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAVXO4PSQ3YQITKPAFJHMLS4CSMJANCNFSM4WV6WJWA>
.
|
Can we just do it like we do with everything else? Start with deprecation warning over the course of one release, then die if not fixed after next + 1 release? |
The point was to protect users from ignoring the warning + wondering what went wrong later. In all honesty, I'm reconsidering if it's even worth it. Thanks @Xarthisius for bringing this up. It actually happened to me once and I confirm it didn't make me a fan of the code in question... Can we automatically perform the migration BUT keep the original file without appending ".bak" to it ? |
I have made a recap of all the solutions that emerged out of the discussion. Please feel free to edit the pros/cons so that we converge relatively quickly.
Please vote for your favourite solution by flagging this message with the corresponding emoji. |
I voted 🎉 because the "cons" is actually aligned with yt's old behaviour: we used to create a ytrc file when none was found, BUT I actually don't like this "feature" very much (for the exact reason you're mentioning).
Again, if this turns into a monstrosity of maintainability, my second preferred option is ":rocket:" |
Regarding
Regarding your points:
|
excellent
Fair enough, I didn't connect the dots. |
Are we also putting folks into a weird spot if they have both a 3.x and 4.x installation present? |
Currently, the only problematic case is when If both config files exists, there is a warning and nothing else. |
OK, that actually sounds like an OK solution to having both, to me...
…On Thu, Jan 28, 2021 at 4:59 AM Corentin Cadiou ***@***.***> wrote:
Are we also putting folks into a weird spot if they have both a 3.x and
4.x installation present?
Currently, the only problematic case is when ~/.config/yt/ytrc exists,
~/.config/yt/yt.toml does not *and* users are on the main branch of yt.
If both config files exists, there is a warning and nothing else.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3044 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAVXOZRITK7OLGVPWGFX6LS4E7RZANCNFSM4WV6WJWA>
.
|
@matthewturk @Xarthisius @neutrinoceros I have created two other PRs (#3047 and #3046) that implement the automatic migration and the simple warning solution respectively. Could you have a look and tell me which one should be kept? |
#3047 is my preferred option, given some further changes. |
It seems like 🚀 is winning the poll? |
Yup. As the only advocate for a different option I gracefully resign. I think the poll was open long enough that everyone who wanted to vote already did. Moving forward ? :) |
I think 🚀 was still your second choice option though!
I support it! |
Closing this now in favour of #3046. |
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.
Oops, forgot to push the "submit" button yesterday. Might as well publish this review even if the PR is dead
prompt = "Perform the migration now [yn]? " | ||
user_input = input(prompt).lower() | ||
while user_input not in ("y", "yes", "n", "no"): | ||
print(f"Did not understand your input '{user_input}'. Please enter 'y' or 'n'.") | ||
user_input = input(prompt).lower() | ||
|
||
if user_input in ("y", "yes"): | ||
migrate_config() | ||
else: | ||
raise SystemExit("Migration not performed: exiting.") |
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.
Obviously a semi-joke because we don't have rich as dep, but let's imagine for a second we do:
prompt = "Perform the migration now [yn]? " | |
user_input = input(prompt).lower() | |
while user_input not in ("y", "yes", "n", "no"): | |
print(f"Did not understand your input '{user_input}'. Please enter 'y' or 'n'.") | |
user_input = input(prompt).lower() | |
if user_input in ("y", "yes"): | |
migrate_config() | |
else: | |
raise SystemExit("Migration not performed: exiting.") | |
from rich.prompt import Confirm | |
migrate = Confirm.ask("Perform the migration now ?") | |
if not migrate: | |
raise SystemExit("Migration not performed: exiting.") | |
migrate_config() |
(rich is awesome)
More seriously, I think this is fine but I'm still haunted by @Xarthisius' remark: this would be orders of magnitude better with a timeout. Problem is I have no idea how to implement it and 5min of stackoverflowing didn't help much.
@@ -209,7 +209,9 @@ def get_local_config_file(): | |||
since="4.0.0", |
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.
this message requires some tweaking, since running the shell command isn't required after all.
PR Summary
At the moment, if a user has
~/.config/yt/ytrc
but no~/.config/yt/yt.toml
, a hard-exit happens which prevent yt from being used. Though we display an explicit message advising the user on how to fix the issue, we may give the user a chance to interactively perform the migration immediately to lower the friction of this transition.