Repository navigation
Run Python 3.15 CI with lazy QCoDeS imports + Move and Deprecate modules that overlap classes - #8600
Open
Jens Hedegaard Nielsen (jenshnielsen) wants to merge 6 commits into
Open
Jens Hedegaard Nielsen (jenshnielsen) wants to merge 6 commits into
Jens Hedegaard Nielsen (jenshnielsen) wants to merge 6 commits into
Conversation
Jens Hedegaard Nielsen (jenshnielsen)
requested a review
from a team
as a code owner
October 12, 2026 18:15
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #8600 +/- ##
==========================================
+ Coverage 75.37% 75.60% +0.23%
==========================================
Files 308 326 +18
Lines 32686 32762 +76
==========================================
+ Hits 24636 24771 +135
+ Misses 8050 7991 -59 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Jens Hedegaard Nielsen (jenshnielsen)
force-pushed
the
lazy_import_test
branch
from
October 13, 2026 05:12
751b22d to
e01d97e
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Under lazy imports, importing a submodule that has the same name as an object exported from its package (e.g. stanford_research.SR830) replaces that object on the package with the module. Move the implementations to private modules and keep the old module paths as deprecated aliases. Importing a deprecated alias would still replace the public object on the package, so the affected packages use a module type that does not let a submodule replace an existing attribute of the same name.
do2d_retrace did not pass the outer sweep parameter to dond_into, so adding results failed with missing setpoints. Also register additional_setpoints in the datasets and call exit_actions once after the measurement. Export it from qcodes.dataset so it has a public home now that qcodes.dataset.dond is deprecated.
Jens Hedegaard Nielsen (jenshnielsen)
force-pushed
the
lazy_import_test
branch
from
November 6, 2026 20:33
e01d97e to
720d374
Compare
…vate VoltageParameter is meant to be constructed by users around a measured parameter, so give it a driver specific name and export it from the stanford_research package. The SR830 and SR86x parameter classes are only created by the drivers themselves, so they stay private.
Rename ChannelBuffer, ChannelTrace and GeneratedSetPoints to SR830ChannelBuffer, SR830ChannelTrace and SR830GeneratedSetPoints. The old names remain available from the deprecated SR830 module alias.
| ) | ||
|
|
||
| LOG = logging.getLogger(__name__) | ||
| TRACER = trace.get_tracer(__name__) |
Collaborator
Author
There was a problem hiding this comment.
I wonder if this dod2_retrace is something that we want to deprecate instead. The code is not working on main . It was never documented etc.
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.
Runs the Python 3.15 CI job with
PYTHON_LAZY_IMPORTS=all, limited to imports that involve QCoDeS (see.github/lazy-imports/sitecustomize.py), and fixes what that uncovered.Why
Some packages export an object with the same name as one of their submodules, e.g. the
SR830class and theqcodes.instrument_drivers.stanford_research.SR830module, theqcodes.dataset.dondfunction and theqcodes.dataset.dondsubpackage, orqcodes.utils.full_class. Importing a submodule sets it as an attribute on its parent package, so depending on import orderstanford_research.SR830can end up being the module rather than the class. Lazy imports change the import order and expose this.What changed
Implementation modules moved to private modules
qcodes.dataset.dond.*→qcodes.dataset._dond.*qcodes.utils.full_class→qcodes.utils._full_classstanford_research.{SG384,SR560,SR830,SR860,SR865,SR865A,SR86x}→stanford_research._sg384,._sr560, …basel.{BaselSP983,BaselSP983a,BaselSP983c}→basel._basel_sp983, …The old module paths remain as deprecated aliases that emit a
QCoDeSDeprecationWarning.Deprecated aliases no longer replace the public object. Importing an alias module would otherwise still overwrite the public object on the package. For example, after
from qcodes.instrument_drivers.stanford_research.SR830 import SR830,stanford_research.SR830would be the module. The affected packages now call_keep_attributes_shadowing_submodules(inqcodes.utils.deprecate), which stops a submodule from replacing an existing attribute of the same name. This can be removed together with the aliases.Public API decisions
SR560VoltageParameter(previouslyVoltageParameter) is now exported. Users construct it themselves, like the IthacoCurrentParameter.ChannelBuffer,ChannelTraceandGeneratedSetPointsare renamed toSR830ChannelBuffer,SR830ChannelTraceandSR830GeneratedSetPointsand are private. They are only created by the driver itself.SR86xBufferReadoutis private, keeping its name.DondKWargs,ParameterGroup,ParameterSetEventandcatch_interrupts. The newsfragment asks users to open an issue if they rely on one of them.do2d_retracefixed and exported fromqcodes.dataset. It previously failed on the first point because the outer sweep parameter was never added to the datasets, and it had no tests. It also calledexit_actionsafter every outer step, andadditional_setpointswere not registered. Its only import path was the now-deprecatedqcodes.dataset.dond, so it is now exported fromqcodes.dataset.Reviewing
The commits are split to make review easier:
do2d_retracefix and export.SR560VoltageParameter.Coverage
Project coverage goes up slightly, from 74.76% to 74.91% in a local run of the full suite (before the last SR560 tests were added). The moved files have the same coverage as before, and the alias modules and the guard are fully covered.
Codecov's patch coverage will look low. Because the old paths still exist as alias modules, GitHub does not detect the moves as renames, so the moved driver code (notably
_sr830.pyand_sr86x.py) counts as new lines.Testing
PYTHON_LAZY_IMPORTS=alland the CIsitecustomize. Run locally on Windows without h5py, so the netcdf export tests were not run there.pyrightand pre-commit.do2d_retrace.SR560VoltageParameter.Newsfragments:
8600.breaking,8600.breaking.1,8600.improved.