-
Notifications
You must be signed in to change notification settings - Fork 340
Generic parameter #7730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Generic parameter #7730
Conversation
Add generic type arguments to ParameterBase and Cache classes for data type and instrument type.
ae7712a to
26d86fa
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #7730 +/- ##
==========================================
- Coverage 59.80% 59.78% -0.02%
==========================================
Files 352 352
Lines 31805 31815 +10
==========================================
Hits 19022 19022
- Misses 12783 12793 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| class Parameter( | ||
| ParameterBase[ParameterDataTypeVar, InstrumentType_co], | ||
| Generic[ParameterDataTypeVar, InstrumentType_co], | ||
| ): |
There was a problem hiding this comment.
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 four relevant generic parameters for an instrument.
- ParameterData type (input/output from get/set)
- InstrumentType (what self.instrument returns)
- RootInstrumentType (what self.root_instrument) returns
- RawParameterData. What is passed to self.write/ask etc
Here I propose that we add 1 and 2 but omit 3 and 4 for the time being.
That is a tradeoff between the features and the amount of parameters
that needs to be passed to each generic Parameter since currently if
one generic parameter is supplied to a Generic function/class they must all be supplied.
This, however, also means that we cannot add these in a non-breaking way before we drop 3.12 support.
In 3.13 onwards it becomes possible to omit values for type parameters that have default values so we can simply append these and omit them when they don't add value
Make parameter generic in data and instrument type. This enables significantly better introspection of qcodes instruments and their data returned from parameters.
This takes the core infrastructure changes from #7655 and breaks it out into a pr with clean commits. The instrument improvements will land independently. Consult that pr for examples of improvements.