Skip to content
Closed
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
8 changes: 3 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ 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",
Expand All @@ -31,9 +30,9 @@ dependencies = [
"jsonschema>=4.9.0",
"matplotlib>=3.6.0",
"networkx>=3.1",
"numpy>=1.22.4",
"numpy>=1.26.0",
"packaging>=20.0",
"pandas>=1.5.0",
"pandas>=2.2.3",
"pyarrow>=11.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",
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
2 changes: 1 addition & 1 deletion src/qcodes/dataset/data_set_cache.py
Original file line number Diff line number Diff line change
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
4 changes: 2 additions & 2 deletions src/qcodes/dataset/dond/sweeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions src/qcodes/dataset/measurements.py
Original file line number Diff line number Diff line change
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
4 changes: 2 additions & 2 deletions src/qcodes/dataset/threading.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/qcodes/extensions/_driver_test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 3 additions & 4 deletions src/qcodes/instrument_drivers/AlazarTech/ATS.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@

if TYPE_CHECKING:
from collections.abc import Iterator, Sequence

from typing_extensions import Unpack
from typing import Unpack

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -828,7 +827,7 @@ def __del__(self) -> None:
)


class AcquisitionInterface(Generic[OutputType]):
class AcquisitionInterface[OutputType]:
"""
This class represents all choices that the end-user has to make regarding
the data-acquisition. this class should be subclassed to program these
Expand Down Expand Up @@ -904,7 +903,7 @@ def buffer_done_callback(self, buffers_completed: int) -> None:
pass


class AcquisitionController(Instrument, AcquisitionInterface[Any], Generic[OutputType]):
class AcquisitionController[OutputType](Instrument, AcquisitionInterface[Any]):
"""
Compatibility class. The methods of :class:`AcquisitionController`
have been extracted. This class is the base class fro AcquisitionInterfaces
Expand Down
4 changes: 2 additions & 2 deletions src/qcodes/instrument_drivers/AlazarTech/ats_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
POINTER_c_long = Any


IntOrParam: TypeAlias = "int | Parameter"
type IntOrParam = "int | Parameter"
# deprecated alias for backwards compatibility
int_or_param: TypeAlias = IntOrParam # noqa: PYI042
type int_or_param = IntOrParam # noqa: PYI042


class AlazarATSAPI(WrappedDll):
Expand Down
2 changes: 1 addition & 1 deletion src/qcodes/instrument_drivers/AlazarTech/dll_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _api_call_task(
return retval


def _normalize_params(*args: T) -> list[T]:
def _normalize_params[T](*args: T) -> list[T]:
args_out: list[T] = []
for arg in args:
if isinstance(arg, ParameterBase):
Expand Down
2 changes: 1 addition & 1 deletion src/qcodes/instrument_drivers/AlazarTech/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


class TraceParameter(
Parameter[ParameterDataTypeVar, "AlazarTechATS"], Generic[ParameterDataTypeVar]
Parameter[ParameterDataTypeVar, "AlazarTechATS"], Generic[ParameterDataTypeVar] # noqa: UP046
):
"""
A parameter that keeps track of if its value has been synced to
Expand Down
2 changes: 1 addition & 1 deletion src/qcodes/instrument_drivers/CopperMountain/_M5065.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from ._M5xxx import CopperMountainM5xxx

if TYPE_CHECKING:
from typing_extensions import Unpack
from typing import Unpack

from qcodes.instrument import VisaInstrumentKWArgs

Expand Down
Loading
Loading