Skip to content

Commit 9c5e495

Browse files
feat(dataset): expose ParamSpecBase from qcodes.dataset
``ParamSpecBase`` is the canonical base class used for building ``InterDependencies_`` graphs on the public API surface, but until now it was only importable from :mod:`qcodes.parameters`, while :mod:`qcodes.dataset` only re-exported the legacy :class:`~qcodes.dataset.descriptions.param_spec.ParamSpec` class. Users who followed the documented dataset-centric entry points had to reach into ``qcodes.parameters`` to construct dependency graphs. Re-export ``ParamSpecBase`` from ``qcodes.dataset`` and add it to ``__all__`` so the public namespace matches the actual recommended usage. Adds a regression test that pins both the re-export and its presence in ``__all__``. Closes #7369 Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
1 parent 36967bf commit 9c5e495

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
``ParamSpecBase`` is now re-exported from :mod:`qcodes.dataset` so that users
2+
defining custom ``InterDependencies_`` graphs via the public ``qcodes.dataset``
3+
namespace do not need to reach into :mod:`qcodes.parameters` to obtain it.

src/qcodes/dataset/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
export_datasets_and_create_metadata_db,
1818
extract_runs_into_db,
1919
)
20+
from qcodes.parameters import ParamSpecBase
21+
2022
from .descriptions.dependencies import InterDependencies_, ParamSpecTree
2123
from .descriptions.param_spec import ParamSpec
2224
from .descriptions.rundescriber import RunDescriber
@@ -77,6 +79,7 @@
7779
"LogSweep",
7880
"Measurement",
7981
"ParamSpec",
82+
"ParamSpecBase",
8083
"ParamSpecTree",
8184
"RunDescriber",
8285
"SQLiteSettings",

tests/dataset/test_dependencies.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
from tests.common import error_caused_by
1818

1919

20+
def test_param_spec_base_reexported_from_qcodes_dataset() -> None:
21+
"""``ParamSpecBase`` is part of the public :mod:`qcodes.dataset` API."""
22+
import qcodes.dataset as qdataset
23+
24+
assert qdataset.ParamSpecBase is ParamSpecBase
25+
assert "ParamSpecBase" in qdataset.__all__
26+
27+
2028
def test_wrong_input_raises() -> None:
2129
for pspecs in (
2230
["p1", "p2", "p3"],

0 commit comments

Comments
 (0)