Repository navigation
Fix proxy methods for drivers with custom type annotations or non-literal defaults - #162
Merged
marcosfrenkel merged 4 commits intoOct 14, 2026
Conversation
…ature works, and leave omitted arguments to the server's defaults
…obals, apply ruff format Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Problem
Creating a proxy for some drivers crashes in
ProxyInstrumentModule._getProxyMethods(). This came up while adding the QDAC2 driver:_makeProxyMethodrebuilt each method by pastingstr(inspect.signature(method))into adefand running it withexec. That breaks on:-> cqedtoolbox....QDAC2.Trace_Context):NameError, since the module isn't available insideexec.reprisn't Python (<StatusFlag.EAV: 4>,<object object at 0x...>):SyntaxError.Fix
The fix is client-only (
client/proxy.py). The blueprint and wire format don't change, so a new client works with an old server.defis built from parameter names and kinds only. Every parameter defaults to a private_MISSINGmarker. The/and*markers are kept, so positional-only and keyword-only parameters are still enforced on the client.combine(0, c=5)) works.inspect.signature(proxy.method)still prints the server's signature, annotations and defaults included, through a smallSignaturesubclass. The client GUI uses this text as placeholder and tooltip. The docstring now starts withname(signature).from typing import */qcodes/collectionssetup the oldexecneeded.Behavior change: every parameter is optional on the client, because the blueprint doesn't say which ones have defaults. Leaving out a required argument now raises an error from the server instead of a client-side
TypeError.Tests
test/pytest/test_method_annotations.pyadds 18 tests using two new dummies intesting/dummy_instruments/generic.py:AnnotatedMethodsInstrumentuses a custom class as return and parameter annotation.DefaultValuesInstrumenthas enum, sentinel, positional-only, keyword-only and variadic defaults.All 18 failed before the fix and pass now. The rest of the suite has no new failures.
Not included
ChannelListblueprint support (the "Blueprints for instrument base type of ChannelList ... are currently not supported" warnings). The channels are still reachable as individual submodules. Possible follow-up.🤖 Generated with Claude Code