Skip to content

Commit 12cc963

Browse files
committed
ci: pin actions to v5/v6 to silence Node 20 deprecation; ruff: add explicit [tool.ruff.format] with line-ending=lf; reformat python/ to satisfy format check (12 files normalized after recent edits)
1 parent 8f02fcf commit 12cc963

14 files changed

Lines changed: 44 additions & 38 deletions

File tree

.github/workflows/CI.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
matrix:
3737
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
3838
steps:
39-
- uses: actions/checkout@v4
39+
- uses: actions/checkout@v5
4040

4141
- name: Inject Rust source
4242
env:
@@ -52,7 +52,7 @@ jobs:
5252
echo "SKIP_BUILD=0" >> "$GITHUB_ENV"
5353
fi
5454
55-
- uses: actions/setup-python@v5
55+
- uses: actions/setup-python@v6
5656
if: env.SKIP_BUILD == '0'
5757
with:
5858
python-version: ${{ matrix.python-version }}
@@ -83,7 +83,7 @@ jobs:
8383
matrix:
8484
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
8585
steps:
86-
- uses: actions/checkout@v4
86+
- uses: actions/checkout@v5
8787

8888
- name: Inject Rust source
8989
env:
@@ -100,7 +100,7 @@ jobs:
100100
echo "SKIP_BUILD=0" >> "$GITHUB_ENV"
101101
fi
102102
103-
- uses: actions/setup-python@v5
103+
- uses: actions/setup-python@v6
104104
if: env.SKIP_BUILD == '0'
105105
with:
106106
python-version: ${{ matrix.python-version }}
@@ -131,7 +131,7 @@ jobs:
131131
matrix:
132132
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
133133
steps:
134-
- uses: actions/checkout@v4
134+
- uses: actions/checkout@v5
135135

136136
- name: Inject Rust source
137137
env:
@@ -147,7 +147,7 @@ jobs:
147147
echo "SKIP_BUILD=0" >> "$GITHUB_ENV"
148148
fi
149149
150-
- uses: actions/setup-python@v5
150+
- uses: actions/setup-python@v6
151151
if: env.SKIP_BUILD == '0'
152152
with:
153153
python-version: ${{ matrix.python-version }}
@@ -177,7 +177,7 @@ jobs:
177177
matrix:
178178
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
179179
steps:
180-
- uses: actions/checkout@v4
180+
- uses: actions/checkout@v5
181181

182182
- name: Inject Rust source
183183
env:
@@ -193,7 +193,7 @@ jobs:
193193
echo "SKIP_BUILD=0" >> "$GITHUB_ENV"
194194
fi
195195
196-
- uses: actions/setup-python@v5
196+
- uses: actions/setup-python@v6
197197
if: env.SKIP_BUILD == '0'
198198
with:
199199
python-version: ${{ matrix.python-version }}

.github/workflows/tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ jobs:
2020
name: ruff-and-mypy
2121
runs-on: ubuntu-latest
2222
steps:
23-
- uses: actions/checkout@v4
24-
- uses: actions/setup-python@v5
23+
- uses: actions/checkout@v5
24+
- uses: actions/setup-python@v6
2525
with:
2626
python-version: "3.12"
2727
- name: Install linting tools
@@ -52,7 +52,7 @@ jobs:
5252
runs-on: ubuntu-latest
5353
continue-on-error: true
5454
steps:
55-
- uses: actions/checkout@v4
55+
- uses: actions/checkout@v5
5656
- name: Build Docker image (Rust source stub -- expected failure)
5757
run: docker build -t qector-decoder-test:ci . || echo "::warning::Docker build failed (stub src -- expected)"
5858

@@ -67,8 +67,8 @@ jobs:
6767
matrix:
6868
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
6969
steps:
70-
- uses: actions/checkout@v4
71-
- uses: actions/setup-python@v5
70+
- uses: actions/checkout@v5
71+
- uses: actions/setup-python@v6
7272
with:
7373
python-version: ${{ matrix.python-version }}
7474
- name: Install from PyPI

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,13 @@ ignore_missing_imports = true
129129
line-length = 120
130130
target-version = "py39"
131131

132+
[tool.ruff.format]
133+
# Ensure consistent formatting on Linux CI runners (LF) even when edited on Windows.
134+
line-ending = "lf"
135+
quote-style = "double"
136+
indent-style = "space"
137+
docstring-code-format = true
138+
132139
[tool.ruff.lint]
133140
# E702: semicolons used intentionally for chained one-liners in plotting helpers.
134141
# E731: lambda assignments used for compact callback tables in a few helpers.

python/qector_decoder_v3/backend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
>>> from qector_decoder_v3.backend import AutoDecoder
1818
>>> code = codes.rotated_surface_code(7)
1919
>>> dec = AutoDecoder(code.check_to_qubits, code.n_qubits)
20-
>>> dec.calibrate() # optional: tune the GPU threshold
21-
>>> out = dec.batch_decode(syndromes) # picks CPU / Rayon / GPU automatically
20+
>>> dec.calibrate() # optional: tune the GPU threshold
21+
>>> out = dec.batch_decode(syndromes) # picks CPU / Rayon / GPU automatically
2222
>>> dec.diagnostics()
2323
"""
2424

python/qector_decoder_v3/belief_matching.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
-------
2525
>>> import stim
2626
>>> from qector_decoder_v3.belief_matching import BeliefMatching
27-
>>> dem = stim.Circuit.generated("surface_code:rotated_memory_x", distance=5,
28-
... rounds=5, after_clifford_depolarization=0.005).detector_error_model(
29-
... decompose_errors=True)
27+
>>> dem = stim.Circuit.generated(
28+
... "surface_code:rotated_memory_x", distance=5, rounds=5, after_clifford_depolarization=0.005
29+
... ).detector_error_model(decompose_errors=True)
3030
>>> bm = BeliefMatching.from_detector_error_model(dem)
3131
>>> predicted_observables = bm.decode_batch(detection_events)
3232
"""

python/qector_decoder_v3/bp_cupy.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@
3535
-------
3636
>>> from qector_decoder_v3 import codes
3737
>>> from qector_decoder_v3.bp_cupy import batched_bp_decode
38-
>>> cx, _ = codes.bivariate_bicycle_code(6, 6, [("x", 3), ("y", 1), ("y", 2)],
39-
... [("y", 3), ("x", 1), ("x", 2)])
38+
>>> cx, _ = codes.bivariate_bicycle_code(6, 6, [("x", 3), ("y", 1), ("y", 2)], [("y", 3), ("x", 1), ("x", 2)])
4039
>>> H = cx.parity_check_matrix()
4140
>>> import numpy as np
4241
>>> errs = (np.random.default_rng(0).random((128, 72)) < 0.05).astype(np.uint8)

python/qector_decoder_v3/bposd.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
-------
1616
>>> from qector_decoder_v3 import codes
1717
>>> from qector_decoder_v3.bposd import BpOsdDecoder
18-
>>> cx, cz = codes.bivariate_bicycle_code(6, 6, [("x",3),("y",1),("y",2)],
19-
... [("y",3),("x",1),("x",2)])
18+
>>> cx, cz = codes.bivariate_bicycle_code(6, 6, [("x", 3), ("y", 1), ("y", 2)], [("y", 3), ("x", 1), ("x", 2)])
2019
>>> dec = BpOsdDecoder(cx.parity_check_matrix(), error_rate=0.05, osd_order=0)
2120
>>> correction = dec.decode(syndrome)
2221
"""

python/qector_decoder_v3/dem.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
Example
2424
-------
2525
>>> from qector_decoder_v3 import dem
26-
>>> model = dem.load_dem_file("circuit.dem") # or dem.from_stim(dem_object)
27-
>>> code = model.to_code() # a codes.Code
26+
>>> model = dem.load_dem_file("circuit.dem") # or dem.from_stim(dem_object)
27+
>>> code = model.to_code() # a codes.Code
2828
>>> decoder = model.make_decoder("sparse_blossom")
2929
>>> correction = decoder.decode(syndrome)
3030
>>> logical_pred = model.predicted_observables(correction)

python/qector_decoder_v3/gpu_backend.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
Example
2727
-------
2828
>>> from qector_decoder_v3 import gpu_backend as gb
29-
>>> xp = gb.get_array_module(prefer_gpu=True) # cupy if usable, else numpy
30-
>>> dev = gb.to_device([1, 0, 1, 1]) # host -> device (counted)
31-
>>> gb.is_on_gpu(dev) # True iff really on the GPU
32-
>>> host = gb.to_host(dev) # device -> host (counted)
33-
>>> gb.get_backend().summary() # one-glance capability report
29+
>>> xp = gb.get_array_module(prefer_gpu=True) # cupy if usable, else numpy
30+
>>> dev = gb.to_device([1, 0, 1, 1]) # host -> device (counted)
31+
>>> gb.is_on_gpu(dev) # True iff really on the GPU
32+
>>> host = gb.to_host(dev) # device -> host (counted)
33+
>>> gb.get_backend().summary() # one-glance capability report
3434
"""
3535

3636
from __future__ import annotations

python/qector_decoder_v3/qiskit_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from qector_decoder_v3.qiskit_plugin import decode_qiskit_result, create_qiskit_decoder
1111
1212
decoder = create_qiskit_decoder(code_distance=5)
13-
result = job.result() # qiskit.result.Result
13+
result = job.result() # qiskit.result.Result
1414
decoded = decoder(result)
1515
1616
Usage (sans Qiskit — mode dict brut) ::

0 commit comments

Comments
 (0)