File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change 6
6
from loguru import logger
7
7
8
8
from . import __version__
9
- from .busyserve import busyserve_cli
10
9
from .callbacks import string_to_scaled_color
11
10
from .global_options import GlobalOptions
12
11
from .manager import LightManager
18
17
for subcommand in subcommands :
19
18
cli .add_typer (subcommand )
20
19
21
- cli .add_typer (busyserve_cli )
20
+ # Conditionally add busyserve CLI if webapi dependencies are available
21
+ try :
22
+ from .busyserve import busyserve_cli
23
+ cli .add_typer (busyserve_cli )
24
+ except ImportError :
25
+ # webapi extras not installed, skip busyserve functionality
26
+ pass
22
27
23
28
webcli = typer .Typer ()
24
29
Original file line number Diff line number Diff line change 5
5
import typer
6
6
from loguru import logger
7
7
8
+ # Check if webapi dependencies are available, fail import if not
8
9
try :
9
10
import uvicorn
10
11
except ImportError as error :
11
- logger .error (f"import uvicorn failed: { error } " )
12
- typer .secho (
13
- "The package `uvicorn` is missing, unable to serve the busylight API." ,
14
- fg = "red" ,
15
- )
16
- raise typer .Exit (code = 1 ) from None
12
+ raise ImportError (
13
+ "The package `uvicorn` is missing, unable to serve the busylight API. "
14
+ "Install with webapi extras: pip install busylight-for-humans[webapi]"
15
+ ) from error
17
16
18
17
busyserve_cli = typer .Typer ()
19
18
You can’t perform that action at this time.
0 commit comments