-
Notifications
You must be signed in to change notification settings - Fork 77
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
Improve cli for tips review #813
Conversation
🚚 Moved rich console object into a separate file in utils as it can be reused whenever we want to use it in the future.
Any areas for improvement? While this is the visual ui that Somya suggested, I would say that it is a pretty big upgrade compared to what it previously looked like. |
Thanks for starting this off. I think it's a step in the right direction, I have a few suggestions for improvement:
|
Yeah all those suggestions make sense, here is the updated version updated_review_script.movI wanted to make the second header left-aligned but I couldn't figure out how to do that in the docs. |
Nice! It's looking much cleaner now :)
|
Instead of Markdown, have you tried just Text? https://rich.readthedocs.io/en/stable/text.html#text-attributes |
Sorry, I forgot to push my commit, yeah I started using Prompt.ask and it simplifies a lot of the error checking that I was doing, which is good. I don't think the bonus field can be optional, you either have to pay a bonus or don't pay a bonus. The bonus field does not show if you reject a tip. I'm not exactly sure how I would make the reason field optional. Should I just add an extra question asking if you want to write a reason? I feel like there might already be too many steps for accepting a tip. |
Yeah I could do that. The headers would have to be removed from the markdown to use that, which I guess is fine. The only way to make a list to my knowledge is to use markdown |
Codecov Report
@@ Coverage Diff @@
## main #813 +/- ##
==========================================
+ Coverage 64.44% 64.66% +0.22%
==========================================
Files 107 107
Lines 9281 9281
==========================================
+ Hits 5981 6002 +21
+ Misses 3300 3279 -21
Continue to review full report at Codecov.
|
♻️ Used .format() instead of concatenating strings
@JackUrb After adding the rich dependency to my requirements.txt and pyproject.toml I get this error in the Python test /build github action step:
After searching online the solution may be to pin the version of pip that we are upgrading. At least according to this comment:
|
Oy this is tough, I'm thinking the best approach right now would be to drop the |
Agreed that there are already too many steps, I would suggest using smart defaults to streamline/optionalize:
Benefits
|
…h/Mephisto into improve-cli-for-tips-review
Yeah I just made it so that you need the package installed to run the scripts: |
Makes sense. I agree Here is the video that shows some of the defaultsscript_defaults.mov |
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 rich
script changes are really nice. Happy to get this in.
try: | ||
from rich import print | ||
except ImportError: | ||
print( | ||
"\nYou need to have rich installed to use this script. For example: pip install rich\n" | ||
) | ||
exit(1) |
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 we need this casing if we're adding rich
as a core part of our cli
tooling.
try: | ||
from rich import print | ||
except ImportError: | ||
print( | ||
"\nYou need to have rich installed to use this script. For example: pip install rich\n" | ||
) | ||
exit(1) |
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.
Ditto
@@ -96,8 +96,8 @@ def main(): | |||
|
|||
removal_response = Prompt.ask( | |||
"\nDo you want to remove this tip? (Default: n)", | |||
choices=["y", "n"], | |||
default="n", | |||
choices=[TipsRemovalType.REMOVE, TipsRemovalType.KEEP], |
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.
It seems I was wrong about list
, but this can still likely be less verbose with [t.value for t in TipsRemovalType]
Summary
Uses the information in #388 to improve the cli for the review_tips_for_task.py and remove_accepted_tip.py scripts.
I tested using
rich
(cli formatting python package) out on these two scripts first because they are of low importance. Once this is reviewed then more important commands likemephisto wut
can potentially be reformatted usingrich
.Video of new cli
New Video:
#813 (comment)
Old Video:
new_review_script.mov