Skip to content

Add type variables to parameters in several drivers - #8694

Open
Jens Hedegaard Nielsen (jenshnielsen) wants to merge 8 commits into
microsoft:mainfrom
jenshnielsen:generic_step
Open

Jens Hedegaard Nielsen (jenshnielsen) wants to merge 8 commits into
microsoft:mainfrom
jenshnielsen:generic_step

Conversation

@jenshnielsen

Copy link
Copy Markdown
Collaborator

No description provided.

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread docs/examples/writing_drivers/Creating-Instrument-Drivers.ipynb Outdated
@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.24%. Comparing base (a34b964) to head (5c12321).
⚠️ Report is 10 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants