Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.11", "3.12", "3.13", "3.14"]
python-version: ["3.12", "3.13", "3.14"]
exclude:
- os: windows-latest
python-version: 3.11
- os: windows-latest
python-version: 3.13
- os: windows-latest
Expand Down Expand Up @@ -122,7 +120,7 @@ jobs:
- name: Download artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: docs_3.11_ubuntu-latest
name: docs_3.12_ubuntu-latest
path: build_docs

- name: Deploy to gh pages
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,13 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.11", "3.12", "3.13", "3.14"]
python-version: ["3.12", "3.13", "3.14"]
min-version: [false]
include:
- os: ubuntu-latest
python-version: "3.11"
python-version: "3.12"
min-version: true
exclude:
- os: ubuntu-latest
python-version: "3.11"
- os: windows-latest
python-version: "3.11"
- os: windows-latest
python-version: "3.13"
- os: windows-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upload_to_pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.11'
python-version: '3.12'
- name: Install build deps
run: pip install --upgrade pip setuptools wheel build
- name: Build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"from typing import TYPE_CHECKING\n",
"\n",
"if TYPE_CHECKING:\n",
" from typing_extensions import Unpack\n",
" from typing import Unpack\n",
"\n",
"import numpy as np\n",
"import numpy.typing as npt\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
"from typing import TYPE_CHECKING, Any\n",
"\n",
"if TYPE_CHECKING:\n",
" from typing_extensions import (\n",
" Unpack, # can be imported from typing if python >= 3.12\n",
" )\n",
" from typing import Unpack\n",
"\n",
"import numpy as np\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"from qcodes.instrument.visa import VisaInstrument, VisaInstrumentKWArgs\n",
"\n",
"if TYPE_CHECKING:\n",
" from typing_extensions import Unpack\n",
" from typing import Unpack\n",
"\n",
"\n",
"class Weinschel8320(VisaInstrument):\n",
Expand Down
20 changes: 9 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,27 @@ classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Scientific/Engineering",
]
license = "MIT"
readme = "README.rst"
requires-python = ">=3.11"
requires-python = ">=3.12"
dependencies = [
"broadbean>=0.11.0",
"h5netcdf>=0.14.1",
"h5py>=3.8.0",
"h5netcdf>=1.3.0",
"h5py>=3.10.0",
"ipywidgets>=8.0.0,<9.0.0",
"ipykernel>=6.12.0", # implicitly required by ipywidgets >=8.0.5
"jsonschema>=4.9.0",
"matplotlib>=3.6.0",
"matplotlib>=3.8.0",
"networkx>=3.1",
"numpy>=1.22.4",
"numpy>=1.26.0",
"packaging>=20.0",
"pandas>=1.5.0",
"pyarrow>=11.0.0", # will become a requirement of pandas. Installing explicitly silences a warning
"pandas>=2.1.1",
"pyarrow>=14.0.0", # will become a requirement of pandas. Installing explicitly silences a warning
"pyvisa>=1.11.0, <1.17.0",
"ruamel.yaml>=0.16.0,!=0.16.6",
"tabulate>=0.9.0",
Expand All @@ -46,7 +45,7 @@ dependencies = [
"xarray>=2023.08.0",
"cf_xarray>=0.8.4",
"opentelemetry-api>=1.17.0",
"pillow>=9.2.0",
"pillow>=10.2.0",
"dask>=2022.1.0", # we are making use of xarray features that requires dask implicitly
]

Expand Down Expand Up @@ -99,7 +98,7 @@ docs = [
"furo>=2024.8.6",
"sphinxcontrib-towncrier>=0.5.0a0",
"towncrier>=24.8.0,<26.0.0", # sphinxcontrib-towncrier is likely to break with new versions
"scipy>=1.10.0", # examples using scipy
"scipy>=1.12.0", # examples using scipy
"qcodes_loop>=0.1.1", # legacy dataset import examples
"intersphinx_registry>=0.2603.16"
]
Expand Down Expand Up @@ -218,7 +217,6 @@ markers = "serial"
# and error on all other warnings
filterwarnings = [
'error',
'ignore:open_binary is deprecated:DeprecationWarning', # pyvisa-sim deprecated in 3.11 un-deprecated in 3.12. Drop filter once we drop support for 3.11
'ignore:unclosed database in:ResourceWarning', # internal should be fixed
'ignore:unclosed\ <socket\.socket:ResourceWarning', # not clear from where this is coming
'ignore:Model_336 is deprecated:qcodes.utils.deprecate.QCoDeSDeprecationWarning', # remove once deprecated Lakeshore Model_336 and its tests has been removed
Expand Down
4 changes: 2 additions & 2 deletions src/qcodes/dataset/data_set_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import logging
from pathlib import Path
from typing import TYPE_CHECKING, Generic, Literal, TypeVar
from typing import TYPE_CHECKING, Literal, TypeVar

import numpy as np
import numpy.typing as npt
Expand Down Expand Up @@ -39,7 +39,7 @@
log = logging.getLogger(__name__)


class DataSetCache(Generic[DatasetType_co]):
class DataSetCache[DatasetType_co: "DataSetProtocol"]:
"""
The DataSetCache contains a in memory representation of the
data in this dataset as well a a method to progressively read data
Expand Down
16 changes: 7 additions & 9 deletions src/qcodes/dataset/data_set_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,15 @@
# twice here convert to set to ensure no duplication.
_EXPORT_CALLBACKS = set(entry_points(group="qcodes.dataset.on_export"))

ScalarResTypes: TypeAlias = (
str | complex | np.integer | np.floating | np.complexfloating
)
ValuesType: TypeAlias = (
type ScalarResTypes = str | complex | np.integer | np.floating | np.complexfloating
type ValuesType = (
ScalarResTypes
| npt.NDArray
| Sequence[ScalarResTypes]
| Sequence[Sequence[ScalarResTypes]]
)
ResType: TypeAlias = "tuple[ParameterBase | str, ValuesType]"
SetpointsType: TypeAlias = "Sequence[str | ParameterBase]"
type ResType = "tuple[ParameterBase | str, ValuesType]"
type SetpointsType = "Sequence[str | ParameterBase]"

# deprecated alias left for backwards compatibility
array_like_types = (tuple, list, npt.NDArray)
Expand All @@ -71,12 +69,12 @@
setpoints_type: TypeAlias = SetpointsType # noqa PYI042


SPECS: TypeAlias = list[ParamSpec]
type SPECS = list[ParamSpec]
# Transition period type: SpecsOrInterDeps. We will allow both as input to
# the DataSet constructor for a while, then deprecate SPECS and finally remove
# the ParamSpec class
SpecsOrInterDeps: TypeAlias = SPECS | InterDependencies_
ParameterData: TypeAlias = dict[str, dict[str, npt.NDArray]]
type SpecsOrInterDeps = SPECS | InterDependencies_
type ParameterData = dict[str, dict[str, npt.NDArray]]

LOG = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion src/qcodes/dataset/dond/do_0d.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .do_nd import DondKWargs, dond

if TYPE_CHECKING:
from typing_extensions import Unpack
from typing import Unpack

from .do_nd_utils import (
AxesTupleListWithDataSet,
Expand Down
2 changes: 1 addition & 1 deletion src/qcodes/dataset/dond/do_1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from .sweeps import LinSweep

if TYPE_CHECKING:
from typing_extensions import Unpack
from typing import Unpack

from qcodes.dataset.dond.do_nd_utils import (
AxesTupleListWithDataSet,
Expand Down
6 changes: 3 additions & 3 deletions src/qcodes/dataset/dond/sweeps.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, Generic, TypeVar
from typing import TYPE_CHECKING, Any, TypeVar

import numpy as np
import numpy.typing as npt
Expand All @@ -15,7 +15,7 @@
T = TypeVar("T", bound=np.generic)


class AbstractSweep(ABC, Generic[T]):
class AbstractSweep[T: np.generic](ABC):
"""
Abstract sweep class that defines an interface for concrete sweep classes.
"""
Expand Down Expand Up @@ -195,7 +195,7 @@ def get_after_set(self) -> bool:
return self._get_after_set


class ArraySweep(AbstractSweep, Generic[T]):
class ArraySweep[T: np.generic](AbstractSweep):
"""
Sweep the values of a given array.

Expand Down
6 changes: 3 additions & 3 deletions src/qcodes/dataset/measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from itertools import chain
from numbers import Number
from time import perf_counter, perf_counter_ns
from typing import TYPE_CHECKING, Any, TypeAlias, TypeVar, cast
from typing import TYPE_CHECKING, Any, TypeVar, cast

import numpy as np
import numpy.typing as npt
Expand Down Expand Up @@ -74,8 +74,8 @@
Callable[..., Any], MutableSequence[Any] | MutableMapping[Any, Any]
]

ParameterResultType: TypeAlias = tuple[ParameterBase, ValuesType]
DatasetResultDict: TypeAlias = dict[ParamSpecBase, npt.NDArray]
type ParameterResultType = tuple[ParameterBase, ValuesType]
type DatasetResultDict = dict[ParamSpecBase, npt.NDArray]


class ParameterTypeError(Exception):
Expand Down
6 changes: 3 additions & 3 deletions src/qcodes/dataset/threading.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import logging
from collections import defaultdict
from functools import partial
from typing import TYPE_CHECKING, Protocol, TypeAlias, TypeVar
from typing import TYPE_CHECKING, Protocol, TypeVar

from qcodes.utils import RespondingThread

Expand All @@ -21,8 +21,8 @@
from qcodes.dataset.data_set_protocol import ValuesType
from qcodes.parameters import ParamDataType, ParameterBase

ParamMeasT: TypeAlias = "ParameterBase | Callable[[], None]"
OutType: TypeAlias = "list[tuple[ParameterBase, ValuesType]]"
type ParamMeasT = "ParameterBase | Callable[[], None]"
type OutType = "list[tuple[ParameterBase, ValuesType]]"

T = TypeVar("T")

Expand Down
4 changes: 2 additions & 2 deletions src/qcodes/extensions/_driver_test_case.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import unittest
from typing import TYPE_CHECKING, Generic, TypeVar
from typing import TYPE_CHECKING, TypeVar

if TYPE_CHECKING:
from qcodes.instrument import Instrument
Expand All @@ -28,7 +28,7 @@
T = TypeVar("T", bound="Instrument")


class DriverTestCase(unittest.TestCase, Generic[T]):
class DriverTestCase[T: "Instrument"](unittest.TestCase):
# override this in a subclass
driver: type[T] | None = None
instrument: T
Expand Down
8 changes: 4 additions & 4 deletions src/qcodes/extensions/infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def _merge_user_and_class_attrs(
return set.union(set(alt_source_attrs), set(InferAttrs.known_attrs()))


def get_chain_links_of_type(
def get_chain_links_of_type[C: ParameterBase](
link_param_type: type[C] | tuple[type[C], ...], parameter: Parameter
) -> tuple[C, ...]:
"""Gets all parameters in a chain of linked parameters that match a given type"""
Expand All @@ -237,7 +237,7 @@ def get_chain_links_of_type(
return tuple(chain_links)


def get_sole_chain_link_of_type(
def get_sole_chain_link_of_type[C: ParameterBase](
link_param_type: type[C] | tuple[type[C], ...], parameter: Parameter
) -> C:
"""Gets the one parameter in a chain of linked parameters that matches a given type"""
Expand All @@ -256,7 +256,7 @@ def get_sole_chain_link_of_type(
return chain_links[0]


def get_parent_instruments_from_chain_of_type(
def get_parent_instruments_from_chain_of_type[TInstrument: InstrumentBase](
instrument_type: type[TInstrument] | tuple[type[TInstrument], ...],
parameter: Parameter,
) -> tuple[TInstrument, ...]:
Expand All @@ -272,7 +272,7 @@ def get_parent_instruments_from_chain_of_type(
)


def get_sole_parent_instrument_from_chain_of_type(
def get_sole_parent_instrument_from_chain_of_type[TInstrument: InstrumentBase](
instrument_type: type[TInstrument] | tuple[type[TInstrument], ...],
parameter: Parameter,
) -> TInstrument:
Expand Down
4 changes: 1 addition & 3 deletions src/qcodes/instrument/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
from .instrument_base import InstrumentBase

if TYPE_CHECKING:
from typing import Self

from typing_extensions import Unpack
from typing import Self, Unpack

from .instrument_base import InstrumentBaseKWArgs

Expand Down
6 changes: 2 additions & 4 deletions src/qcodes/instrument/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
from .instrument_meta import InstrumentMeta

if TYPE_CHECKING:
from typing import Self

from typing_extensions import Unpack
from typing import Self, Unpack

from qcodes.logger.instrument_logger import InstrumentLoggerAdapter

Expand Down Expand Up @@ -461,7 +459,7 @@ def ask_raw(self, cmd: str) -> str:
)


def find_or_create_instrument(
def find_or_create_instrument[T: "Instrument"](
instrument_class: type[T],
name: str,
*args: Any,
Expand Down
3 changes: 1 addition & 2 deletions src/qcodes/instrument/ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
if TYPE_CHECKING:
from collections.abc import Sequence
from types import TracebackType

from typing_extensions import Unpack
from typing import Unpack

from .instrument_base import InstrumentBaseKWArgs

Expand Down
4 changes: 1 addition & 3 deletions src/qcodes/instrument/visa.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@

if TYPE_CHECKING:
from collections.abc import Mapping, Sequence
from typing import NotRequired

from typing_extensions import Unpack
from typing import NotRequired, Unpack

from qcodes.parameters.parameter import Parameter

Expand Down
2 changes: 1 addition & 1 deletion src/qcodes/instrument_drivers/AimTTi/_AimTTi_PL_P.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from qcodes.parameters import Parameter, create_on_off_val_mapping

if TYPE_CHECKING:
from typing_extensions import Unpack
from typing import Unpack


class NotKnownModel(Exception):
Expand Down
Loading
Loading