Skip to content

[SPARK-47166][INFRA] Improves the HINTs of merge_spark_pr.py#45256

Closed
yaooqinn wants to merge 3 commits into
apache:masterfrom
yaooqinn:SPARK-47166
Closed

[SPARK-47166][INFRA] Improves the HINTs of merge_spark_pr.py#45256
yaooqinn wants to merge 3 commits into
apache:masterfrom
yaooqinn:SPARK-47166

Conversation

@yaooqinn
Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

This improves the UX of merge_spark_pr.py

  • Print errors in red in order to get attention effectively
    image
  • Print prompt in bold
  • Print the default option for y/n from prompt in upper case

Why are the changes needed?

better dev UX

Does this PR introduce any user-facing change?

no, committer only

How was this patch tested?

manually

image

Was this patch authored or co-authored using generative AI tooling?

no

@github-actions github-actions Bot added the INFRA label Feb 26, 2024
@yaooqinn yaooqinn changed the title Bold/Red/Upper [SPARK-47166][INFRA] Improves the HINTs of merge_spark_pr.py Feb 26, 2024
Comment thread dev/merge_spark_pr.py

def bold_input(prompt) -> str:
return input("\033[1m%s\033[0m" % prompt)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit. We need two empty new lines, don't we?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fixed

Comment thread dev/merge_spark_pr.py


def print_error(msg):
print("\033[91m%s\033[0m" % msg)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just a question. Does this color code work in all shell and OS environments?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

https://en.wikipedia.org/wiki/ANSI_escape_code#Colors

Not all terminals and operating systems, but most of them support ANSI colors

Comment thread dev/merge_spark_pr.py
print("Original: %s" % pr["title"])
print("Modified: %s" % modified_title)
result = input("Would you like to use the modified title? (y/n): ")
result = bold_input("Would you like to use the modified title? (y/N): ")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The default value suggestion looks nice to me.

Copy link
Copy Markdown
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

Please fix the Python linter failure, @yaooqinn .

@yaooqinn yaooqinn changed the title [SPARK-47166][INFRA] Improves the HINTs of merge_spark_pr.py [SPARK-47166][INFRA] Improves the HINTs of merge_spark_pr.py Feb 27, 2024
Copy link
Copy Markdown
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

+1, LGTM.

@dongjoon-hyun
Copy link
Copy Markdown
Member

Thank you, @yaooqinn .

@yaooqinn yaooqinn closed this in 611ed06 Feb 27, 2024
@yaooqinn
Copy link
Copy Markdown
Member Author

Thank you @dongjoon-hyun, merged to master

@yaooqinn yaooqinn deleted the SPARK-47166 branch February 27, 2024 03:07
TakawaAkirayo pushed a commit to TakawaAkirayo/spark that referenced this pull request Mar 4, 2024
### What changes were proposed in this pull request?

This improves the UX of merge_spark_pr.py

- Print errors in red in order to get attention effectively
![image](https://github.com/apache/spark/assets/8326978/ce9550ec-f73f-4d1a-b9c6-708689e7db3f)
- Print prompt in bold
- Print the default option for `y/n` from prompt in upper case

### Why are the changes needed?

better dev UX

### Does this PR introduce _any_ user-facing change?

no, committer only

### How was this patch tested?

manually

![image](https://github.com/apache/spark/assets/8326978/1a8dfc50-7e21-4bcf-b86e-6e5668499c26)

### Was this patch authored or co-authored using generative AI tooling?
no

Closes apache#45256 from yaooqinn/SPARK-47166.

Authored-by: Kent Yao <yao@apache.org>
Signed-off-by: Kent Yao <yao@apache.org>
ericm-db pushed a commit to ericm-db/spark that referenced this pull request Mar 5, 2024
### What changes were proposed in this pull request?

This improves the UX of merge_spark_pr.py

- Print errors in red in order to get attention effectively
![image](https://github.com/apache/spark/assets/8326978/ce9550ec-f73f-4d1a-b9c6-708689e7db3f)
- Print prompt in bold
- Print the default option for `y/n` from prompt in upper case

### Why are the changes needed?

better dev UX

### Does this PR introduce _any_ user-facing change?

no, committer only

### How was this patch tested?

manually

![image](https://github.com/apache/spark/assets/8326978/1a8dfc50-7e21-4bcf-b86e-6e5668499c26)

### Was this patch authored or co-authored using generative AI tooling?
no

Closes apache#45256 from yaooqinn/SPARK-47166.

Authored-by: Kent Yao <yao@apache.org>
Signed-off-by: Kent Yao <yao@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants