Skip to content

Commit

Permalink
replace yaspin with halo for spinners (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
mercuryseries authored Jan 20, 2025
1 parent 817f3a5 commit 1649472
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 26 deletions.
2 changes: 1 addition & 1 deletion env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies:
- pydantic >=2
- pydantic-settings >=2
- fsspec
- yaspin
- halo
- typing-extensions >=4.12.0
- boto3 <1.36.0
- pyroaring
Expand Down
11 changes: 6 additions & 5 deletions polaris/utils/context.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from contextlib import contextmanager

from yaspin import yaspin
from yaspin.spinners import Spinners
from halo import Halo

from polaris.mixins import FormattingMixin

Expand All @@ -23,7 +22,7 @@ def __init__(self, success_msg: str, error_msg: str, start_msg: str = "In progre
self._success_msg = success_msg
self._error_msg = error_msg

self._spinner = yaspin(Spinners.dots, text=self._start_msg)
self._spinner = Halo(text=self._start_msg, spinner="dots")

def __enter__(self):
self._spinner.start()
Expand All @@ -33,9 +32,11 @@ def __exit__(self, exc_type, exc_value, traceback):
self._spinner.text = ""

if exc_type:
self._spinner.red.fail(f"💥 ERROR: {self._error_msg}")
self._spinner.text_color = "red"
self._spinner.fail(f"ERROR: {self._error_msg}")
else:
self._spinner.green.ok(f"✅ SUCCESS: {self.format(self._success_msg, self.BOLD)}\n")
self._spinner.text_color = "green"
self._spinner.succeed(f"SUCCESS: {self.format(self._success_msg, self.BOLD)}\n")

self._spinner.stop()

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dependencies = [
"tqdm",
"typer",
"typing-extensions>=4.12.0",
"yaspin",
"halo",
"zarr >=2,<3",
]

Expand Down
60 changes: 41 additions & 19 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1649472

Please sign in to comment.