Make zhinst dependencies optional and enable python3.10+ compatibility
Explanation of changes
For the user's perspective, we have the following:
for Qblox users:
- nothing breaks, and they can now use python 3.8, 3.9, 3.10, 3.11 and 3.12
for Zhinst users:
- when importing anything
zhinst
related:- if python version >3.9: raise a
RuntimeWarning
with error message "The zhinst backend is only compatible with Python 3.8 and Python 3.9, but you have Python {major}.{minor}. Please install a compatible python version." - if no zhinst dependencies are installed: raise
ModuleNotFoundError
with error message "The zhinst backend could not be found. Please install the zhinst backend viapip install quantify-scheduler[zhinst]
."
- if python version >3.9: raise a
pip installs will never complain:
-
pip install quantify-scheduler
: no longer installszhinst
(and related) -
pip install quantify-scheduler[zhinst]
: installszhinst
(and related) only ifpython_version<3.10
. -
pip install quantify-scheduler[dev]
: also installszhinst
(and related) only ifpython_version<3.10
.
The last thing makes the pipeline a bit cleaner. We no longer have to create conditional docker images (e.g. explicitly install zhinst for 3.8 and 3.9 tests, but exclude for 3.10+).
Motivation of changes
- Avoid dependency conflicts in developing the new Zurich Instruments backend (&7)
- Allow us to support
python>=3.10
Merge checklist
See also merge request guidelines
-
Merge request has been reviewed (in-depth by a knowledgeable contributor), and is approved by a project maintainer. -
New code is covered by unit tests (or N/A). -
New code is documented and docstrings use numpydoc format (or N/A). -
New functionality: considered making private instead of extending public API (or N/A). -
Public API changed: added @deprecated
and entry in deprecated code suggestions (or N/A). -
Newly added/adjusted documentation and docstrings render properly (or N/A). -
Pipeline fix or dependency update: post in #software-for-developers
channel to mergemain
back in or update local packages (or N/A). -
Tested on hardware (or N/A). -
CHANGELOG.md
andAUTHORS.md
have been updated (or N/A). -
Performance tests: if changes can affect performance, trigger CI manually and evaluate results (or N/A). -
Windows tests in CI pipeline pass (manually triggered by maintainers before merging). - Maintainers do not hit Auto-merge, we need to actively check as manual tests do not block pipeline
For reference, the issues workflow is described in the contribution guidelines.
Edited by Robert Sokolewicz