44from logging import getLogger
55
66from rich .align import Align
7+ from rich .live import Live
78from rich .panel import Panel
89
910from skore_hub_project import console
@@ -31,8 +32,8 @@ def login(*, timeout: int = 600) -> None:
3132 logger .debug (f"Already logged in { URI } with { type (credentials )} ." )
3233 console .print (
3334 Panel (
34- Align .center ("[blink] Already logged in." ),
35- title = "[cyan]Login to [bold ]Skore Hub" ,
35+ Align .center ("Already logged in." ),
36+ title = "[cyan]Login to [b ]Skore Hub" ,
3637 border_style = "cyan" ,
3738 padding = 1 ,
3839 )
@@ -43,36 +44,25 @@ def login(*, timeout: int = 600) -> None:
4344 try :
4445 credentials = APIKey ()
4546 except KeyError :
46- console .print (
47- Panel (
48- Align .center (
49- "Falling back to interactive authentication for the session.\n "
50- "We recommend that you set up an API key via [url](coming soon) "
51- "and use it to log in."
52- ),
53- title = "[cyan]Login to [bold]Skore Hub" ,
54- subtitle = "[dark_orange bold]API key not detected" ,
55- border_style = "dark_orange" ,
56- padding = 1 ,
57- )
58- )
47+ with Live (console = console , auto_refresh = False ) as live :
48+ credentials = Token (timeout = timeout , live = live )
5949
60- credentials = Token (timeout = timeout )
61-
62- console .print (
63- Panel (
64- Align .center ("[blink]Login successful." ),
65- title = "[cyan]Login to [b]Skore Hub" ,
66- border_style = "cyan" ,
67- padding = 1 ,
50+ live .update (
51+ Panel (
52+ Align .center (
53+ "Login successful using [b]interactive authentication."
54+ ),
55+ title = "[cyan]Login to [bold]Skore Hub" ,
56+ border_style = "cyan" ,
57+ padding = 1 ,
58+ )
6859 )
69- )
60+ live . refresh ( )
7061 else :
7162 console .print (
7263 Panel (
73- Align .center ("[blink] Login successful." ),
64+ Align .center ("Login successful using [b]API key ." ),
7465 title = "[cyan]Login to [bold]Skore Hub" ,
75- subtitle = "[cyan bold]API key detected" ,
7666 border_style = "cyan" ,
7767 padding = 1 ,
7868 )
0 commit comments