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 terminal.style.spinner config value #1471

Merged
merged 4 commits into from May 23, 2024
Merged

Conversation

Grub4K
Copy link
Contributor

@Grub4K Grub4K commented May 6, 2024

terminal.styles.spinner has no effect, which seems to be a typo:

--- a/src/hatch/cli/terminal.py
+++ b/src/hatch/cli/terminal.py
@@ -198,7 +198,7 @@ class Terminal:
-                setattr(self, attribute, f'_style_{option}')
+                setattr(self, f'_style_{option}', style)

While this simple fix solves the problem, this can cause a runtime error later while trying to show a spinner. I thought this might be even worse, so I created a special case where we call Spinner() instead and catch KeyError. To get the original error message we have to use e.args[0] (just Python things). The else branch was kept alive since it was probably created for later extensibility.

Copy link
Sponsor Collaborator

@ofek ofek left a comment

Choose a reason for hiding this comment

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

Thank you!

@ofek ofek merged commit 3d899bd into pypa:master May 23, 2024
46 checks passed
github-actions bot pushed a commit that referenced this pull request May 23, 2024
Co-authored-by: Ofek Lev <ofekmeister@gmail.com> 3d899bd
@Grub4K Grub4K deleted the fix/spinner branch May 23, 2024 05:44
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.

None yet

2 participants