Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions skore/src/skore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
from skore._sklearn._plot.inspection.permutation_importance import (
PermutationImportanceDisplay,
)
from skore._utils._environment import is_environment_notebook_like
from skore._utils._patch import setup_jupyter_display
from skore._utils._show_versions import show_versions

Expand All @@ -54,28 +55,30 @@
)


__version__ = version("skore")
__all__ = [
"Check",
"CoefficientsDisplay",
"DiagnosticDisplay",
"CheckNotApplicable",
"CoefficientsDisplay",
"ComparisonReport",
"compare",
"ConfusionMatrixDisplay",
"CrossValidationReport",
"DiagnosticDisplay",
"Display",
"EstimatorReport",
"evaluate",
"ImpurityDecreaseDisplay",
"TrainTestSplit",
"MetricsSummaryDisplay",
"PermutationImportanceDisplay",
"PrecisionRecallCurveDisplay",
"PredictionErrorDisplay",
"Project",
"RocCurveDisplay",
"TableReportDisplay",
"TrainTestSplit",
"compare",
"configuration",
"console",
"evaluate",
"login",
"show_versions",
"train_test_split",
Expand All @@ -87,14 +90,11 @@
logger.setLevel(INFO)


skore_console_theme = Theme(
{
"repr.str": "cyan",
"rule.line": "orange1",
"repr.url": "orange1",
}
console = Console(
width=88,
theme=Theme({"repr.str": "cyan", "rule.line": "orange1", "repr.url": "orange1"}),
# FIXME:
# Force `force_jupyter` on Jupyterlite.
# Waiting for the merge of https://github.com/Textualize/rich/pull/4104.
force_jupyter=(is_environment_notebook_like() or None),
)


console = Console(theme=skore_console_theme, width=88)
__version__ = version("skore")
15 changes: 10 additions & 5 deletions skore/src/skore/_utils/_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,21 @@ def get_environment_info() -> dict[str, Any]:
try:
# get_ipython() is defined when running in Jupyter or IPython
# there is no need to import IPython here
shell = get_ipython().__class__.__name__ # type: ignore
ipython = get_ipython() # type: ignore[name-defined]
except NameError:
pass
else:
shell = ipython.__class__.__name__

env_info["details"]["ipython_shell"] = shell

if shell == "ZMQInteractiveShell": # Jupyter notebook/lab
# Jupyter notebook/lab or Jupyterlite
if (shell == "ZMQInteractiveShell") or ("pyodide" in str(ipython.__class__)):
env_info["is_jupyter"] = True
env_info["environment_name"] = "jupyter"
elif shell == "TerminalInteractiveShell": # IPython terminal
# IPython terminal
elif shell == "TerminalInteractiveShell":
env_info["environment_name"] = "ipython_terminal"
except NameError:
pass

if "VSCODE_PID" in os.environ:
env_info["is_vscode"] = True
Expand Down
13 changes: 5 additions & 8 deletions skore/src/skore/_utils/_progress_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@
from operator import length_hint
from typing import Any, TypeVar

from rich.progress import (
BarColumn,
Progress,
SpinnerColumn,
TextColumn,
)

from skore._config import configuration
from rich.progress import BarColumn, Progress, SpinnerColumn, TextColumn

T = TypeVar("T")

Expand All @@ -18,6 +11,9 @@ class ProgressBar:
"""Simplified progress bar based on ``rich.Progress``."""

def __init__(self, description: str, total: float | None):
from skore import console
from skore._config import configuration

progress = Progress(
SpinnerColumn(),
TextColumn("[bold cyan]{task.description}"),
Expand All @@ -27,6 +23,7 @@ def __init__(self, description: str, total: float | None):
pulse_style="orange1",
),
TextColumn("[orange1]{task.percentage:>3.0f}%"),
console=console,
expand=False,
transient=True,
disable=(not configuration.show_progress),
Expand Down
Loading