11import logging
22
3- import tiqi_zedboard .zedboard # type: ignore
3+ try :
4+ import tiqi_zedboard .zedboard # type: ignore
5+ HAS_TIQI_ZEDBOARD = True
6+ except ImportError :
7+ HAS_TIQI_ZEDBOARD = False
48
59from icon .config .config import get_config
610from icon .server .data_access .repositories .experiment_data_repository import ResultDict
@@ -21,11 +25,12 @@ def connect(self) -> None:
2125 logger .info ("Connecting to the Zedboard" )
2226 self ._host = get_config ().hardware .host
2327 self ._port = get_config ().hardware .port
24- self ._zedboard = tiqi_zedboard .zedboard .Zedboard (
25- hostname = self ._host , port = self ._port
26- )
27- if not self .connected :
28- logger .warning ("Failed to connect to the Zedboard" )
28+ if HAS_TIQI_ZEDBOARD :
29+ self ._zedboard = tiqi_zedboard .zedboard .Zedboard (
30+ hostname = self ._host , port = self ._port
31+ )
32+ if not self .connected :
33+ logger .warning ("Failed to connect to the Zedboard" )
2934
3035 @property
3136 def connected (self ) -> bool :
@@ -45,7 +50,11 @@ def run(self, *, sequence: str, number_of_shots: int) -> ResultDict:
4550 self .connect ()
4651
4752 if not self .connected :
48- raise RuntimeError ("Could not connect to the Zedboard" )
53+ if HAS_TIQI_ZEDBOARD :
54+ raise RuntimeError ("Could not connect to the Zedboard" )
55+ else :
56+ raise RuntimeError ("Tiqi zedboard package is not available. "
57+ "Please use 'uv sync --all-extras' to install all dependencies" )
4958
5059 self ._update_zedboard_sequence (sequence = sequence )
5160 self ._zedboard .sequence_JSON_parser .Parse_JSON_Header () # type: ignore
0 commit comments