Skip to content

Commit

Permalink
Merge pull request #6 from LouisJalouzot/main
Browse files Browse the repository at this point in the history
Add the possibility to specify the rich console to use
  • Loading branch information
jonghwanhyeon authored Nov 7, 2024
2 parents 8b3fb5d + decbc7a commit d826357
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion joblib_progress/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import Optional

import joblib
from rich.console import Console
from rich.progress import (
BarColumn,
MofNCompleteColumn,
Expand All @@ -17,7 +18,11 @@


@contextlib.contextmanager
def joblib_progress(description: Optional[str] = None, total: Optional[int] = None):
def joblib_progress(
description: Optional[str] = None,
total: Optional[int] = None,
console: Optional[Console] = None,
):
if description is None:
description = "Processing..."

Expand All @@ -30,6 +35,7 @@ def joblib_progress(description: Optional[str] = None, total: Optional[int] = No
TimeElapsedColumn(),
"<",
TimeRemainingColumn(),
console=console,
)
task_id = progress.add_task(f"[cyan]{description}", total=total)

Expand Down

0 comments on commit d826357

Please sign in to comment.