Skip to content

Conversation

@jenshnielsen
Copy link
Collaborator

No description provided.

@jenshnielsen jenshnielsen requested a review from a team as a code owner November 18, 2025 19:05
@jenshnielsen jenshnielsen force-pushed the generic_instrument_in_parameter branch from 4f8cb7e to 7177cc8 Compare November 19, 2025 08:51


class ParameterBase(MetadatableWithName):
class ParameterBase(MetadatableWithName, Generic[_InstrumentType_co]):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Before merging this we need to decide which generic parameters the parameter class should take and which order they should be in. 3.13+ allows some generic arguments to be omitted but since there are no support for kwargs they must be included in order so the first argument should be the one that must be costumized the most often

Candidates are ParamDataType, ParamRawDataType and Instrument.

It probably makes sense that ParamDataType is the first since each Parameter instance may have a different datatype while the Instrument type typically only needs to be customized in a subclass.

Should we include ParamRawData type or just leave it as any (if we include it should it come before or after Instrument)

@jenshnielsen jenshnielsen force-pushed the generic_instrument_in_parameter branch 2 times, most recently from 15fbd4e to 5410bf0 Compare November 19, 2025 12:15
@codecov
Copy link

codecov bot commented Nov 19, 2025

Codecov Report

❌ Patch coverage is 62.12121% with 50 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.76%. Comparing base (e22f404) to head (87e601a).
⚠️ Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
src/qcodes/parameters/parameter_base.py 52.94% 16 Missing ⚠️
...odes/instrument_drivers/yokogawa/Yokogawa_GS200.py 43.75% 9 Missing ⚠️
src/qcodes/parameters/parameter.py 0.00% 8 Missing ⚠️
...des/instrument_drivers/Keysight/Keysight_N9030B.py 85.18% 4 Missing ⚠️
src/qcodes/parameters/array_parameter.py 0.00% 3 Missing ⚠️
src/qcodes/parameters/multi_parameter.py 0.00% 3 Missing ⚠️
src/qcodes/parameters/parameter_with_setpoints.py 0.00% 3 Missing ⚠️
...rc/qcodes/instrument_drivers/rigol/Rigol_DG1062.py 0.00% 2 Missing ⚠️
src/qcodes/instrument_drivers/AlazarTech/utils.py 66.66% 1 Missing ⚠️
...ent_drivers/QuantumDesign/DynaCoolPPMS/DynaCool.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7655      +/-   ##
==========================================
- Coverage   59.78%   58.76%   -1.03%     
==========================================
  Files         352      352              
  Lines       31659    31666       +7     
==========================================
- Hits        18927    18607     -320     
- Misses      12732    13059     +327     

☔ View full report in Codecov by Sentry.
📢 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.

@jenshnielsen jenshnielsen force-pushed the generic_instrument_in_parameter branch 2 times, most recently from f6b1528 to f0b3cce Compare November 30, 2025 20:54
@jenshnielsen jenshnielsen force-pushed the generic_instrument_in_parameter branch from 304ba93 to 6b16d13 Compare December 4, 2025 14:24
class ParameterBase(MetadatableWithName):
class ParameterBase(
MetadatableWithName, Generic[_ParameterDataTypeVar, _InstrumentType_co]
):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We need to agree on this order of generic arguments before merging since changing this would be a breaking change for all Parameter usage and implementations.

Roughly there are three relevant generic parameters for an instrument.

  1. ParameterData type (input/output from get/set)
  2. InstrumentType (what self.instrument returns)
  3. RawParameterData. What is passed to self.write/ask etc

Here I propose that we add 1 and 2 but omit 3 for the time being.
This means that we cannot add 3 before

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.

1 participant