openquantumhardware / qick

QICK: Quantum Instrumentation Control Kit
MIT License
206 stars 87 forks source link

Module import gives extraneous warning when used on non-Zynq platform #157

Closed ionick closed 1 year ago

ionick commented 1 year ago

Based on the code comments, it appears that the qick module is designed to be importable on non-Zynq platforms (but importing the hardware drivers should be skipped).

the following code is in qick_lib/qick/__init__.py, line 50-52:

# only import the hardware drivers if running on a Zynq
# also import if we're in the ReadTheDocs Sphinx build (the imports won't really work but they will be mocked)
if platform.machine() in ['aarch64', 'armv7l'] or os.getenv('READTHEDOCS', default='True')=='True':

I believe the intended behavior should default the READTHEDOCS environment variable to False if it doesn't exist.

I am assuming that people (1) using the qick library on a non-Zynq system and (2) not doing a sphinx build will not have the READTHEDOCS variable defined. Thus for most people, the import will incorrectly attempt to load the hardware drivers and fail, printing an ominous (but admittedly harmless error message).

Can you confirm this is a bug?

meeg commented 1 year ago

Thanks, I agree, good catch!