From 060c679305a631cde815598f22d19c11033ff719 Mon Sep 17 00:00:00 2001 From: Tobias Ahrens Date: Tue, 14 Jan 2025 11:06:16 +0100 Subject: [PATCH] Update github actions --- .github/workflows/docs.yml | 6 +++--- .github/workflows/lint.yml | 6 +++--- .github/workflows/publish.yml | 6 +++--- .github/workflows/tests.yml | 12 ++++++------ docs/source/spelling_wordlist.txt | 3 ++- src/zhinst/toolkit/driver/devices/base.py | 12 +++--------- src/zhinst/toolkit/driver/modules/shfqa_sweeper.py | 2 +- src/zhinst/toolkit/waveform.py | 4 ++-- tests/test_base.py | 5 +++++ tox.ini | 4 ++-- 10 files changed, 30 insertions(+), 30 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 3ff45302..7aee46f6 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -14,12 +14,12 @@ jobs: runs-on: "ubuntu-latest" steps: - name: "Checkout tag/branch" - uses: "actions/checkout@v3" + uses: "actions/checkout@v4" with: { fetch-depth: 0, submodules: "true" } - name: "Setup Python" - uses: "actions/setup-python@v3" + uses: "actions/setup-python@v5" with: - python-version: "3.9" + python-version: "3.12" - name: "Install build dependencies" run: | diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4c701604..b691ab79 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -15,11 +15,11 @@ jobs: tool: [black, lint, typing] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: - python-version: 3.7 + python-version: 3.12 - name: Install dependencies run: pip install -U tox - name: Run Tox diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8e079b3e..7b43d0d9 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,11 +10,11 @@ jobs: runs-on: "ubuntu-latest" steps: - name: "Checkout tag/branch" - uses: "actions/checkout@v3" + uses: "actions/checkout@v4" - name: "Setup Python" - uses: "actions/setup-python@v3" + uses: "actions/setup-python@v5" with: - python-version: "3.9" + python-version: "3.12" - name: "Install build dependencies" run: | diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 574a3ed5..8bee7cdf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,12 +14,6 @@ jobs: strategy: matrix: include: - - name: py37 - python: 3.7 - tox: py37 - - name: py38 - python: 3.8 - tox: py38 - name: py39 python: 3.9 coverage: true @@ -30,6 +24,12 @@ jobs: - name: py311 python: "3.11" tox: py311 + - name: py312 + python: "3.12" + tox: py312 + - name: py313 + python: "3.13" + tox: py313 steps: - uses: "actions/checkout@v2" diff --git a/docs/source/spelling_wordlist.txt b/docs/source/spelling_wordlist.txt index 55d2cd4c..ed5ec519 100644 --- a/docs/source/spelling_wordlist.txt +++ b/docs/source/spelling_wordlist.txt @@ -140,4 +140,5 @@ func enums GSa QHub -qhub \ No newline at end of file +qhub +qualname \ No newline at end of file diff --git a/src/zhinst/toolkit/driver/devices/base.py b/src/zhinst/toolkit/driver/devices/base.py index f9b2551a..01e7589e 100644 --- a/src/zhinst/toolkit/driver/devices/base.py +++ b/src/zhinst/toolkit/driver/devices/base.py @@ -120,15 +120,9 @@ def _version_string_to_tuple(version: str) -> t.Tuple[int, int, int]: Returns: Version as a tuple of ints """ - version_split = version.split(".") - result = [0] * max(3, len(version_split)) - for i, value in enumerate(version_split): - try: - result[i] = int(value) - except ValueError: - if i < 3: # ignore dev versions - result[i] = 0 - return result[0], result[1], result[2] + return tuple( + int(v) if v.isdigit() else 0 for v in version.split(".")[:3] + ) # type: ignore @staticmethod def _check_python_versions( diff --git a/src/zhinst/toolkit/driver/modules/shfqa_sweeper.py b/src/zhinst/toolkit/driver/modules/shfqa_sweeper.py index 4b869827..076db883 100644 --- a/src/zhinst/toolkit/driver/modules/shfqa_sweeper.py +++ b/src/zhinst/toolkit/driver/modules/shfqa_sweeper.py @@ -141,7 +141,7 @@ def _create_nodetree(self) -> NodeTree: for config_class, parent_name in self._config_classes.items(): for parameter, default_value in asdict(config_class()).items(): node = ( - f"/{parent_name[0]}/{self._renamed_nodes.get(parameter,parameter)}" + f"/{parent_name[0]}/{self._renamed_nodes.get(parameter, parameter)}" ) try: info[node] = raw_info[node] diff --git a/src/zhinst/toolkit/waveform.py b/src/zhinst/toolkit/waveform.py index 24b3e9a0..cb753ef1 100644 --- a/src/zhinst/toolkit/waveform.py +++ b/src/zhinst/toolkit/waveform.py @@ -342,8 +342,8 @@ def to_wave_str(i: int) -> str: if marker is None: return f"placeholder({wave_length}, false, false)" return ( - f"placeholder({wave_length}, {marker_to_bool(i*2)}, " - + f"{marker_to_bool(i*2+1)})" + f"placeholder({wave_length}, {marker_to_bool(i * 2)}, " + + f"{marker_to_bool(i * 2 + 1)})" ) w1_assign = to_wave_str(0) diff --git a/tests/test_base.py b/tests/test_base.py index c971af28..9f5fc11f 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -176,6 +176,11 @@ def test_version_string_to_tuple_old(): assert test_version == (25, 1, 2586) +def test_version_string_to_tuple_dev(): + test_version = BaseInstrument._version_string_to_tuple("25.1.dev2586") + assert test_version == (25, 1, 0) + + def test_version_string_to_tuple_invalid(): test_version = BaseInstrument._version_string_to_tuple("25.1.2586.4.8.d") assert test_version == (25, 1, 2586) diff --git a/tox.ini b/tox.ini index 61f64210..661c25b2 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py37, py38, py39, py310, py311, lint, typing +envlist = py39, py310, py311, py312, py313, lint, typing skip_missing_interpreters = true skipsdist = true # pyproject.toml: To use a PEP 517 build-backend you are required to configure tox to use an isolated_build @@ -13,7 +13,7 @@ allowlist_externals = flake8 scripts/zhinst_toolkit_symlink.py deps = - py{37,38,39,310,311}: -rrequirements.txt + py{39,310,311,312,313}: -rrequirements.txt pytest-cov commands = {envpython} -m pip install .