Repository navigation
Add type variables to parameters in several drivers - #8694
Open
Jens Hedegaard Nielsen (jenshnielsen) wants to merge 8 commits into
Open
Jens Hedegaard Nielsen (jenshnielsen) wants to merge 8 commits into
Jens Hedegaard Nielsen (jenshnielsen) wants to merge 8 commits into
Conversation
Add the first tests for the Basel drivers, with a pyvisa-sim file for the SP983a whose replies follow the format the driver parses.
Explain how to annotate a parameter with its value type and annotate all example drivers. Typing them revealed and fixed example bugs: units= instead of unit=, a missing Keithley model attribute and _display_settext method, and outdated Alazar TraceParameter arguments.
auto_zero_once and trigger_in_ext_clear were command-only parameters, so calling them without an argument, as the examples do, returned the cached value and sent nothing to the instrument.
The validator was copied from the Keithley 2000 trigger count. The DMM6500 Reference Manual gives 1 to 100,000,000 with 0 repeating the scan until aborted, and no string options.
Jens Hedegaard Nielsen (jenshnielsen)
requested a review
from a team
as a code owner
October 30, 2026 05:56
Jens Hedegaard Nielsen (jenshnielsen)
requested a balanced review from Copilot
October 30, 2026 06:04
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The driver-writing guide describes explicitly typed examples as using bare Parameter annotations, misleading readers about when value-type checking is disabled.
1 open issue
What changed in this PR
This PR improves static typing across QCoDeS instrument drivers and updates the driver-writing guide to demonstrate typed parameters.
Changes:
- Adds value and instrument type annotations to Basel, Ithaco, and Keithley parameters.
- Converts two Keithley 7510 command-only parameters into methods and updates Keithley 6500 scan-count validation.
- Adds regression tests, simulator support, updated examples, and release notes.
| File | Description |
|---|---|
| tests/drivers/test_keithley_7510.py | Tests buffer parameters and command-only methods. |
| tests/drivers/test_keithley_6500.py | Tests scan-count limits and numeric conversion. |
| tests/drivers/test_keithley_2450.py | Tests buffer-element round trips and validation. |
| tests/drivers/test_ithaco.py | Adds parameter validation and current-conversion tests. |
| tests/drivers/test_basel.py | Adds gain, filter, and overload tests. |
| src/qcodes/instrument/sims/keithley_7510.yaml | Adds command-only simulator responses. |
| src/qcodes/instrument/sims/Keithley_6500.yaml | Adds scan-count simulation. |
| src/qcodes/instrument/sims/Basel_SP983a.yaml | Adds a Basel SP983a simulator. |
| src/qcodes/instrument_drivers/Keithley/Keithley_s46.py | Types the closed-channel list parameter. |
| src/qcodes/instrument_drivers/Keithley/Keithley_7510.py | Types parameters and introduces action methods. |
| src/qcodes/instrument_drivers/Keithley/Keithley_6500.py | Types scan count and updates accepted values. |
| src/qcodes/instrument_drivers/Keithley/Keithley_2450.py | Types buffer and sweep-axis parameters. |
| src/qcodes/instrument_drivers/Keithley/_Keithley_2600.py | Types time-trace parameters. |
| src/qcodes/instrument_drivers/ithaco/Ithaco_1211.py | Types numeric manual parameters. |
| src/qcodes/instrument_drivers/basel/BaselSP983a.py | Types gain and filter parameters. |
| src/qcodes/instrument_drivers/basel/BaselSP983.py | Types shared Basel manual parameters. |
| docs/examples/writing_drivers/Creating-Instrument-Drivers.ipynb | Explains parameter typing and repairs example code. |
| docs/changes/newsfragments/8694.improved_driver | Documents driver typing improvements. |
| docs/changes/newsfragments/8694.improved | Documents guide updates and example fixes. |
| docs/changes/newsfragments/8694.breaking.1 | Documents scan-count behavior changes. |
| docs/changes/newsfragments/8694.breaking | Documents migration to command-only methods. |
Review effort: Balanced
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8694 +/- ##
==========================================
+ Coverage 75.02% 75.24% +0.21%
==========================================
Files 307 307
Lines 32511 32511
==========================================
+ Hits 24392 24463 +71
+ Misses 8119 8048 -71 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Clarified the annotation of parameters in example drivers to specify explicit value and instrument types instead of using 'Any'. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
esben (esbenh4)
approved these changes
Oct 30, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

No description provided.