From d6ecfe48f279876a2e9fed9f4974a9108dcdc3e9 Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 13:32:49 -0500 Subject: [PATCH 01/27] partial coverage fix --- src/qldpc/codes/common.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/qldpc/codes/common.py b/src/qldpc/codes/common.py index a538d87c..29d4c5b0 100644 --- a/src/qldpc/codes/common.py +++ b/src/qldpc/codes/common.py @@ -154,9 +154,14 @@ def matrix_as_string(self) -> str: checks = ["[" + ",".join(map(str, line)) + "]" for line in self.matrix] return "[" + ",".join(checks) + "]" + @property + def canonicalized(self) -> AbstractCode: + """The same code with its parity matrix in reduced row echelon form.""" + return self if self._is_canonicalized else self._canonicalized + @functools.cached_property @abc.abstractmethod - def canonicalized(self) -> AbstractCode: + def _canonicalized(self) -> AbstractCode: """The same code with its parity matrix in reduced row echelon form.""" @staticmethod @@ -262,10 +267,8 @@ def __contains__( return not np.any(self.matrix @ np.asarray(words, dtype=int).view(self.field).T) @functools.cached_property - def canonicalized(self) -> ClassicalCode: + def _canonicalized(self) -> ClassicalCode: """The same code with its parity matrix in reduced row echelon form.""" - if self._is_canonicalized: - return self matrix_rref = self.matrix.row_reduce() matrix_rref = matrix_rref[np.any(matrix_rref, axis=1), :] code = ClassicalCode(matrix_rref, self.field.order) @@ -883,10 +886,8 @@ def is_subsystem_code(self) -> bool: return self._is_subsystem_code @functools.cached_property - def canonicalized(self) -> QuditCode: + def _canonicalized(self) -> QuditCode: """The same code with its parity matrix in reduced row echelon form.""" - if self._is_canonicalized: - return self matrix_rref = self.matrix.row_reduce() matrix_rref = matrix_rref[np.any(matrix_rref, axis=1), :] code = QuditCode(matrix_rref, self.field.order, is_subsystem_code=self._is_subsystem_code) @@ -2144,10 +2145,8 @@ def is_subsystem_code(self) -> bool: return self._is_subsystem_code @functools.cached_property - def canonicalized(self) -> CSSCode: + def _canonicalized(self) -> CSSCode: """The same code with its parity matrices in reduced row echelon form.""" - if self._is_canonicalized: - return self code = CSSCode( self.code_x.canonicalized, self.code_z.canonicalized, From f81379f8cc7686de82e0d69277d1bb8aba2cda0d Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 14:21:49 -0500 Subject: [PATCH 02/27] Revert "partial coverage fix" This reverts commit d6ecfe48f279876a2e9fed9f4974a9108dcdc3e9. --- src/qldpc/codes/common.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/qldpc/codes/common.py b/src/qldpc/codes/common.py index 29d4c5b0..a538d87c 100644 --- a/src/qldpc/codes/common.py +++ b/src/qldpc/codes/common.py @@ -154,14 +154,9 @@ def matrix_as_string(self) -> str: checks = ["[" + ",".join(map(str, line)) + "]" for line in self.matrix] return "[" + ",".join(checks) + "]" - @property - def canonicalized(self) -> AbstractCode: - """The same code with its parity matrix in reduced row echelon form.""" - return self if self._is_canonicalized else self._canonicalized - @functools.cached_property @abc.abstractmethod - def _canonicalized(self) -> AbstractCode: + def canonicalized(self) -> AbstractCode: """The same code with its parity matrix in reduced row echelon form.""" @staticmethod @@ -267,8 +262,10 @@ def __contains__( return not np.any(self.matrix @ np.asarray(words, dtype=int).view(self.field).T) @functools.cached_property - def _canonicalized(self) -> ClassicalCode: + def canonicalized(self) -> ClassicalCode: """The same code with its parity matrix in reduced row echelon form.""" + if self._is_canonicalized: + return self matrix_rref = self.matrix.row_reduce() matrix_rref = matrix_rref[np.any(matrix_rref, axis=1), :] code = ClassicalCode(matrix_rref, self.field.order) @@ -886,8 +883,10 @@ def is_subsystem_code(self) -> bool: return self._is_subsystem_code @functools.cached_property - def _canonicalized(self) -> QuditCode: + def canonicalized(self) -> QuditCode: """The same code with its parity matrix in reduced row echelon form.""" + if self._is_canonicalized: + return self matrix_rref = self.matrix.row_reduce() matrix_rref = matrix_rref[np.any(matrix_rref, axis=1), :] code = QuditCode(matrix_rref, self.field.order, is_subsystem_code=self._is_subsystem_code) @@ -2145,8 +2144,10 @@ def is_subsystem_code(self) -> bool: return self._is_subsystem_code @functools.cached_property - def _canonicalized(self) -> CSSCode: + def canonicalized(self) -> CSSCode: """The same code with its parity matrices in reduced row echelon form.""" + if self._is_canonicalized: + return self code = CSSCode( self.code_x.canonicalized, self.code_z.canonicalized, From 9a31dfcc56630f1e9ecb6b1ee5883846971fe6ef Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 14:23:07 -0500 Subject: [PATCH 03/27] no cover --- src/qldpc/codes/common.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qldpc/codes/common.py b/src/qldpc/codes/common.py index a538d87c..c4ba9192 100644 --- a/src/qldpc/codes/common.py +++ b/src/qldpc/codes/common.py @@ -264,7 +264,7 @@ def __contains__( @functools.cached_property def canonicalized(self) -> ClassicalCode: """The same code with its parity matrix in reduced row echelon form.""" - if self._is_canonicalized: + if self._is_canonicalized: # pragma: no cover return self matrix_rref = self.matrix.row_reduce() matrix_rref = matrix_rref[np.any(matrix_rref, axis=1), :] @@ -885,7 +885,7 @@ def is_subsystem_code(self) -> bool: @functools.cached_property def canonicalized(self) -> QuditCode: """The same code with its parity matrix in reduced row echelon form.""" - if self._is_canonicalized: + if self._is_canonicalized: # pragma: no cover return self matrix_rref = self.matrix.row_reduce() matrix_rref = matrix_rref[np.any(matrix_rref, axis=1), :] @@ -2146,7 +2146,7 @@ def is_subsystem_code(self) -> bool: @functools.cached_property def canonicalized(self) -> CSSCode: """The same code with its parity matrices in reduced row echelon form.""" - if self._is_canonicalized: + if self._is_canonicalized: # pragma: no cover return self code = CSSCode( self.code_x.canonicalized, From 854f3156a35a3451243760b7bee4f8658b04dff7 Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 14:31:35 -0500 Subject: [PATCH 04/27] enable conditional workflows for testing --- .github/workflows/build-changes.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-changes.yaml b/.github/workflows/build-changes.yaml index 8cf55b9f..e93b348b 100644 --- a/.github/workflows/build-changes.yaml +++ b/.github/workflows/build-changes.yaml @@ -7,8 +7,8 @@ on: - 'pyproject.toml' pull_request: branches: [ main ] - paths: - - 'pyproject.toml' + # paths: + # - 'pyproject.toml' types: [ opened, synchronize, reopened, ready_for_review ] # defaults plus ready_for_review workflow_dispatch: workflow_call: From 497232aff9a557c568f7707395a40e43569825c4 Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 14:34:21 -0500 Subject: [PATCH 05/27] use default Windows shell --- .github/workflows/build-changes.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-changes.yaml b/.github/workflows/build-changes.yaml index e93b348b..f256b732 100644 --- a/.github/workflows/build-changes.yaml +++ b/.github/workflows/build-changes.yaml @@ -53,6 +53,5 @@ jobs: - name: Install package and dependencies run: uv sync --extra dev - name: Run all checks - shell: cmd run: | uv run python checks/pytest_.py From 4447dfb62bc9f5b6a9489d5a63ea966891004ab9 Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 14:57:35 -0500 Subject: [PATCH 06/27] activate venv in windows --- .github/workflows/build-changes.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-changes.yaml b/.github/workflows/build-changes.yaml index f256b732..a4a40e7b 100644 --- a/.github/workflows/build-changes.yaml +++ b/.github/workflows/build-changes.yaml @@ -34,7 +34,7 @@ jobs: python -m pip install --upgrade pip python -m pip install '.[dev]' - name: Run all checks - run: checks/pytest_.py + run: python checks/pytest_.py windows: name: Windows check @@ -54,4 +54,7 @@ jobs: run: uv sync --extra dev - name: Run all checks run: | - uv run python checks/pytest_.py + .venv\Scripts\activate + python checks/pytest_.py + # TODO: shorten after https://github.com/Infleqtion/client-superstaq/pull/1347 + # uv run python checks/pytest_.py From 13a24283e9b8f161a69832b1375f8a0195db6ae7 Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 15:01:25 -0500 Subject: [PATCH 07/27] add TODO to pyproject.toml --- .github/workflows/build-changes.yaml | 4 ++-- pyproject.toml | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-changes.yaml b/.github/workflows/build-changes.yaml index a4a40e7b..d0ee7748 100644 --- a/.github/workflows/build-changes.yaml +++ b/.github/workflows/build-changes.yaml @@ -7,8 +7,8 @@ on: - 'pyproject.toml' pull_request: branches: [ main ] - # paths: - # - 'pyproject.toml' + paths: + - 'pyproject.toml' types: [ opened, synchronize, reopened, ready_for_review ] # defaults plus ready_for_review workflow_dispatch: workflow_call: diff --git a/pyproject.toml b/pyproject.toml index b2a2cbd7..ad45c802 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,6 +35,9 @@ dependencies = [ "sympy>=1.12", ] +# TODO: update relay-bp to +# "relay-bp[stim]==0.2.?", +# once https://github.com/trmue/relay/pull/30 is in a release [project.optional-dependencies] dev = [ "checks-superstaq>=0.5.45", From d88fdc75535508485c24ebada72a9608d991d44f Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 15:03:59 -0500 Subject: [PATCH 08/27] try windows fix --- .github/workflows/build-changes.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-changes.yaml b/.github/workflows/build-changes.yaml index d0ee7748..634e6176 100644 --- a/.github/workflows/build-changes.yaml +++ b/.github/workflows/build-changes.yaml @@ -54,7 +54,7 @@ jobs: run: uv sync --extra dev - name: Run all checks run: | - .venv\Scripts\activate + . .venv\Scripts\Activate.ps1 python checks/pytest_.py # TODO: shorten after https://github.com/Infleqtion/client-superstaq/pull/1347 # uv run python checks/pytest_.py From cef6e93c132bd8bbeae96e9769ac3eaa68fc6c87 Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 15:08:35 -0500 Subject: [PATCH 09/27] revert to old shell --- .github/workflows/build-changes.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-changes.yaml b/.github/workflows/build-changes.yaml index 634e6176..a505328f 100644 --- a/.github/workflows/build-changes.yaml +++ b/.github/workflows/build-changes.yaml @@ -53,8 +53,9 @@ jobs: - name: Install package and dependencies run: uv sync --extra dev - name: Run all checks + shell: cmd run: | - . .venv\Scripts\Activate.ps1 + .venv\Scripts\activate python checks/pytest_.py # TODO: shorten after https://github.com/Infleqtion/client-superstaq/pull/1347 # uv run python checks/pytest_.py From 1bce564ba0dc23be406593445d50f097fbc9e2e8 Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 15:15:44 -0500 Subject: [PATCH 10/27] use powershell --- .github/workflows/build-changes.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-changes.yaml b/.github/workflows/build-changes.yaml index a505328f..a4eba380 100644 --- a/.github/workflows/build-changes.yaml +++ b/.github/workflows/build-changes.yaml @@ -53,9 +53,9 @@ jobs: - name: Install package and dependencies run: uv sync --extra dev - name: Run all checks - shell: cmd + shell: pwsh run: | - .venv\Scripts\activate + . .venv\Scripts\Activate.ps1 python checks/pytest_.py # TODO: shorten after https://github.com/Infleqtion/client-superstaq/pull/1347 # uv run python checks/pytest_.py From a45ba5962f437f69b74997c62b32b74b9ce05d86 Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 15:23:49 -0500 Subject: [PATCH 11/27] try not using uv sync in Windows --- .github/workflows/build-changes.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-changes.yaml b/.github/workflows/build-changes.yaml index a4eba380..bb593e78 100644 --- a/.github/workflows/build-changes.yaml +++ b/.github/workflows/build-changes.yaml @@ -51,7 +51,9 @@ jobs: cache-dependency-glob: | **/pyproject.toml - name: Install package and dependencies - run: uv sync --extra dev + run: | + uv venv + uv pip install '.[dev]' - name: Run all checks shell: pwsh run: | From 9b6b9c3769e9fc9b3b35e45a1fac1a317925d8ed Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 15:25:40 -0500 Subject: [PATCH 12/27] Revert "try not using uv sync in Windows" This reverts commit a45ba5962f437f69b74997c62b32b74b9ce05d86. --- .github/workflows/build-changes.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build-changes.yaml b/.github/workflows/build-changes.yaml index bb593e78..a4eba380 100644 --- a/.github/workflows/build-changes.yaml +++ b/.github/workflows/build-changes.yaml @@ -51,9 +51,7 @@ jobs: cache-dependency-glob: | **/pyproject.toml - name: Install package and dependencies - run: | - uv venv - uv pip install '.[dev]' + run: uv sync --extra dev - name: Run all checks shell: pwsh run: | From 440011d138a10830f9c953ae6d0e528f01f54262 Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 15:29:56 -0500 Subject: [PATCH 13/27] change activate script --- .github/workflows/build-changes.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-changes.yaml b/.github/workflows/build-changes.yaml index a4eba380..05ad02ad 100644 --- a/.github/workflows/build-changes.yaml +++ b/.github/workflows/build-changes.yaml @@ -55,7 +55,7 @@ jobs: - name: Run all checks shell: pwsh run: | - . .venv\Scripts\Activate.ps1 + . .venv/bin/activate python checks/pytest_.py # TODO: shorten after https://github.com/Infleqtion/client-superstaq/pull/1347 # uv run python checks/pytest_.py From 4fb0f846010ad8a93370e96b98b5324b288ca285 Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 15:34:16 -0500 Subject: [PATCH 14/27] try different activation --- .github/workflows/build-changes.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-changes.yaml b/.github/workflows/build-changes.yaml index 05ad02ad..008dcddb 100644 --- a/.github/workflows/build-changes.yaml +++ b/.github/workflows/build-changes.yaml @@ -54,8 +54,6 @@ jobs: run: uv sync --extra dev - name: Run all checks shell: pwsh - run: | - . .venv/bin/activate - python checks/pytest_.py - # TODO: shorten after https://github.com/Infleqtion/client-superstaq/pull/1347 - # uv run python checks/pytest_.py + run: . .venv\Scripts\Activate.ps1; python checks/pytest_.py + # TODO: shorten after https://github.com/Infleqtion/client-superstaq/pull/1347 + # uv run python checks/pytest_.py From 58f9bf50cf5e7bb2df410b0862eece69a97c7acb Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 15:45:34 -0500 Subject: [PATCH 15/27] use old uv setup --- .github/workflows/build-changes.yaml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-changes.yaml b/.github/workflows/build-changes.yaml index 008dcddb..defdc802 100644 --- a/.github/workflows/build-changes.yaml +++ b/.github/workflows/build-changes.yaml @@ -51,9 +51,15 @@ jobs: cache-dependency-glob: | **/pyproject.toml - name: Install package and dependencies - run: uv sync --extra dev + # TODO: try to change this step to... + # run: uv sync --extra dev + run: | + uv venv + uv pip install '.[dev]' - name: Run all checks - shell: pwsh - run: . .venv\Scripts\Activate.ps1; python checks/pytest_.py + shell: cmd + run: | + .venv\Scripts\activate + python checks/pytest_.py # TODO: shorten after https://github.com/Infleqtion/client-superstaq/pull/1347 # uv run python checks/pytest_.py From c0892804e474c015d5b934fa6a7993028f15fa8f Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 18:25:42 -0500 Subject: [PATCH 16/27] uv sync --- .github/workflows/build-changes.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-changes.yaml b/.github/workflows/build-changes.yaml index defdc802..55333f7b 100644 --- a/.github/workflows/build-changes.yaml +++ b/.github/workflows/build-changes.yaml @@ -52,10 +52,10 @@ jobs: **/pyproject.toml - name: Install package and dependencies # TODO: try to change this step to... - # run: uv sync --extra dev - run: | - uv venv - uv pip install '.[dev]' + run: uv sync --extra dev + # run: | + # uv venv + # uv pip install '.[dev]' - name: Run all checks shell: cmd run: | From 14717271991aa2947a8610c6f4a6b1e3ca4587d7 Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 18:27:38 -0500 Subject: [PATCH 17/27] uv run --- .github/workflows/build-changes.yaml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-changes.yaml b/.github/workflows/build-changes.yaml index 55333f7b..a6c3bb39 100644 --- a/.github/workflows/build-changes.yaml +++ b/.github/workflows/build-changes.yaml @@ -51,15 +51,11 @@ jobs: cache-dependency-glob: | **/pyproject.toml - name: Install package and dependencies - # TODO: try to change this step to... run: uv sync --extra dev - # run: | - # uv venv - # uv pip install '.[dev]' - name: Run all checks shell: cmd run: | - .venv\Scripts\activate - python checks/pytest_.py - # TODO: shorten after https://github.com/Infleqtion/client-superstaq/pull/1347 - # uv run python checks/pytest_.py + uv run python checks/pytest_.py + # .venv\Scripts\activate + # python checks/pytest_.py + # TODO: shorten after https://github.com/Infleqtion/client-superstaq/pull/1347 From dff048bdc50cf3ef3768da070b34a2f883f284b0 Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 18:50:41 -0500 Subject: [PATCH 18/27] one more try --- .github/workflows/build-changes.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/build-changes.yaml b/.github/workflows/build-changes.yaml index a6c3bb39..68056c6c 100644 --- a/.github/workflows/build-changes.yaml +++ b/.github/workflows/build-changes.yaml @@ -54,8 +54,4 @@ jobs: run: uv sync --extra dev - name: Run all checks shell: cmd - run: | - uv run python checks/pytest_.py - # .venv\Scripts\activate - # python checks/pytest_.py - # TODO: shorten after https://github.com/Infleqtion/client-superstaq/pull/1347 + run: . .venv\Scripts\activate; python checks/pytest_.py From 4bd7a9a868f4a6eeb49f1185690e8d1a22cf1258 Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 18:51:35 -0500 Subject: [PATCH 19/27] shell --- .github/workflows/build-changes.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-changes.yaml b/.github/workflows/build-changes.yaml index 68056c6c..7284eeb2 100644 --- a/.github/workflows/build-changes.yaml +++ b/.github/workflows/build-changes.yaml @@ -53,5 +53,4 @@ jobs: - name: Install package and dependencies run: uv sync --extra dev - name: Run all checks - shell: cmd run: . .venv\Scripts\activate; python checks/pytest_.py From 8a95390e8fbad300bac88552a052cd750f285975 Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 18:59:00 -0500 Subject: [PATCH 20/27] uv system env --- .github/workflows/build-changes.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-changes.yaml b/.github/workflows/build-changes.yaml index 7284eeb2..393e9ba6 100644 --- a/.github/workflows/build-changes.yaml +++ b/.github/workflows/build-changes.yaml @@ -41,6 +41,8 @@ jobs: if: github.event.pull_request.draft == false runs-on: windows-latest timeout-minutes: 5 + env: + UV_SYSTEM_PYTHON: 1 steps: - uses: actions/checkout@v6 - name: Set up Python @@ -53,4 +55,4 @@ jobs: - name: Install package and dependencies run: uv sync --extra dev - name: Run all checks - run: . .venv\Scripts\activate; python checks/pytest_.py + run: python checks/pytest_.py From 2d038c647851644206454aabfbaa590d5c2c436a Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 19:01:38 -0500 Subject: [PATCH 21/27] uv pip install --- .github/workflows/build-changes.yaml | 2 +- .github/workflows/continuous-integration.yaml | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-changes.yaml b/.github/workflows/build-changes.yaml index 393e9ba6..514379d1 100644 --- a/.github/workflows/build-changes.yaml +++ b/.github/workflows/build-changes.yaml @@ -53,6 +53,6 @@ jobs: cache-dependency-glob: | **/pyproject.toml - name: Install package and dependencies - run: uv sync --extra dev + run: uv pip install -e ".[dev]" - name: Run all checks run: python checks/pytest_.py diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index c8e8377e..4e7debc4 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -12,6 +12,9 @@ on: workflow_dispatch: workflow_call: +env: + UV_SYSTEM_PYTHON: 1 + jobs: install: name: Installation check @@ -49,15 +52,15 @@ jobs: run: uv sync --extra dev - name: Run ruff format id: ruff-format - run: uv run python checks/format_.py + run: python checks/format_.py continue-on-error: true - name: Run ruff check id: ruff-check - run: uv run python checks/lint_.py + run: python checks/lint_.py continue-on-error: true - name: Run mypy id: mypy - run: uv run python checks/mypy_.py + run: python checks/mypy_.py continue-on-error: true - name: Check for failures run: | @@ -94,4 +97,4 @@ jobs: - name: Install package and dependencies run: uv sync --extra dev - name: Run coverage - run: uv run python checks/coverage_.py + run: python checks/coverage_.py From 6cfee7f2173e3d4b5082c6ceb2005cca0668d7e7 Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 19:05:23 -0500 Subject: [PATCH 22/27] use uv run in CI tests --- .github/workflows/continuous-integration.yaml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index 4e7debc4..c8e8377e 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -12,9 +12,6 @@ on: workflow_dispatch: workflow_call: -env: - UV_SYSTEM_PYTHON: 1 - jobs: install: name: Installation check @@ -52,15 +49,15 @@ jobs: run: uv sync --extra dev - name: Run ruff format id: ruff-format - run: python checks/format_.py + run: uv run python checks/format_.py continue-on-error: true - name: Run ruff check id: ruff-check - run: python checks/lint_.py + run: uv run python checks/lint_.py continue-on-error: true - name: Run mypy id: mypy - run: python checks/mypy_.py + run: uv run python checks/mypy_.py continue-on-error: true - name: Check for failures run: | @@ -97,4 +94,4 @@ jobs: - name: Install package and dependencies run: uv sync --extra dev - name: Run coverage - run: python checks/coverage_.py + run: uv run python checks/coverage_.py From a22239e1535f89e19f686d62fb191d528e47feb3 Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 19:11:10 -0500 Subject: [PATCH 23/27] fix tests in Windows --- src/qldpc/codes/common_test.py | 8 ++++---- src/qldpc/codes/quantum_test.py | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/qldpc/codes/common_test.py b/src/qldpc/codes/common_test.py index 14d17909..96aadd12 100644 --- a/src/qldpc/codes/common_test.py +++ b/src/qldpc/codes/common_test.py @@ -38,7 +38,7 @@ def test_constructions_classical(pytestconfig: pytest.Config) -> None: """Classical code constructions.""" np.random.seed(pytestconfig.getoption("randomly_seed")) - code = codes.ClassicalCode.random(5, 3, seed=np.random.randint(2**32)) + code = codes.ClassicalCode.random(5, 3, seed=np.random.randint(2**31)) assert len(code) == code.num_bits == 5 assert code.num_checks == 3 assert "ClassicalCode" in str(code) @@ -48,7 +48,7 @@ def test_constructions_classical(pytestconfig: pytest.Config) -> None: code.set_generator(np.roll(code.generator, shift=1, axis=0)) assert codes.ClassicalCode(code).generator is code.generator - code = codes.ClassicalCode.random(5, 3, field=3, seed=np.random.randint(2**32)) + code = codes.ClassicalCode.random(5, 3, field=3, seed=np.random.randint(2**31)) assert "GF(3)" in str(code) code = codes.RepetitionCode(2, field=3) @@ -86,8 +86,8 @@ def test_constructions_classical(pytestconfig: pytest.Config) -> None: assert np.array_equal(list(code.shortened([0]).iter_words()), [[0, 0]]) # stack two codes - code_a = codes.ClassicalCode.random(5, 3, field=3, seed=np.random.randint(2**32)) - code_b = codes.ClassicalCode.random(5, 3, field=3, seed=np.random.randint(2**32)) + code_a = codes.ClassicalCode.random(5, 3, field=3, seed=np.random.randint(2**31)) + code_b = codes.ClassicalCode.random(5, 3, field=3, seed=np.random.randint(2**31)) code = codes.ClassicalCode.stack([code_a, code_b]) assert len(code) == len(code_a) + len(code_b) assert code.dimension == code_a.dimension + code_b.dimension diff --git a/src/qldpc/codes/quantum_test.py b/src/qldpc/codes/quantum_test.py index 21fdc71f..4e637b46 100644 --- a/src/qldpc/codes/quantum_test.py +++ b/src/qldpc/codes/quantum_test.py @@ -242,8 +242,8 @@ def test_hypergraph_product( """Equivalency of matrix-based, graph-based, and chain-based hypergraph products.""" np.random.seed(pytestconfig.getoption("randomly_seed")) - code_a = codes.ClassicalCode.random(*bits_checks_a, field=field, seed=np.random.randint(2**32)) - code_b = codes.ClassicalCode.random(*bits_checks_b, field=field, seed=np.random.randint(2**32)) + code_a = codes.ClassicalCode.random(*bits_checks_a, field=field, seed=np.random.randint(2**31)) + code_b = codes.ClassicalCode.random(*bits_checks_b, field=field, seed=np.random.randint(2**31)) code = codes.HGPCode(code_a, code_b, set_logicals=True) graph = codes.HGPCode.get_graph_product(code_a.graph, code_b.graph) @@ -270,8 +270,8 @@ def test_subsystem_hypergraph_product( """Validity of the subsystem hypergraph product code.""" np.random.seed(pytestconfig.getoption("randomly_seed")) - code_a = codes.ClassicalCode.random(*bits_checks_a, field=field, seed=np.random.randint(2**32)) - code_b = codes.ClassicalCode.random(*bits_checks_b, field=field, seed=np.random.randint(2**32)) + code_a = codes.ClassicalCode.random(*bits_checks_a, field=field, seed=np.random.randint(2**31)) + code_b = codes.ClassicalCode.random(*bits_checks_b, field=field, seed=np.random.randint(2**31)) code = codes.SHPCode(code_a, code_b, set_logicals=True) # assert validity of the the "natural" stabilizers that are set at initialization time @@ -293,8 +293,8 @@ def test_trivial_lift( """The lifted product code with a trivial lift reduces to the HGP code.""" np.random.seed(pytestconfig.getoption("randomly_seed")) - code_a = codes.ClassicalCode.random(*bits_checks_a, field=field, seed=np.random.randint(2**32)) - code_b = codes.ClassicalCode.random(*bits_checks_b, field=field, seed=np.random.randint(2**32)) + code_a = codes.ClassicalCode.random(*bits_checks_a, field=field, seed=np.random.randint(2**31)) + code_b = codes.ClassicalCode.random(*bits_checks_b, field=field, seed=np.random.randint(2**31)) code_HGP = codes.HGPCode(code_a, code_b, field) matrix_a = abstract.TrivialGroup.to_ring_array(code_a.matrix) @@ -408,7 +408,7 @@ def test_quantum_tanner(pytestconfig: pytest.Config) -> None: # random quantum Tanner code group = abstract.CyclicGroup(12) subcode = codes.RepetitionCode(4, field=3) - code = codes.QTCode.random(group, subcode, seed=np.random.randint(2**32)) + code = codes.QTCode.random(group, subcode, seed=np.random.randint(2**31)) # assert that subgraphs have the right number of nodes, edges, and node degrees subgraph_x, subgraph_z = codes.QTCode.get_subgraphs(code.complex) From 93cd30b21b294aadf5f659c09666b23f077e658a Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 19:13:14 -0500 Subject: [PATCH 24/27] add comment --- .github/workflows/build-changes.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-changes.yaml b/.github/workflows/build-changes.yaml index 514379d1..18e6a1a4 100644 --- a/.github/workflows/build-changes.yaml +++ b/.github/workflows/build-changes.yaml @@ -42,7 +42,7 @@ jobs: runs-on: windows-latest timeout-minutes: 5 env: - UV_SYSTEM_PYTHON: 1 + UV_SYSTEM_PYTHON: 1 # needed because 'uv sync ...' followed by 'uv run ...' does not work... steps: - uses: actions/checkout@v6 - name: Set up Python From f7e4c9244076bdf2a548c265caf84e93e419cea0 Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 19:14:23 -0500 Subject: [PATCH 25/27] more test fixes --- src/qldpc/circuits/common_test.py | 2 +- src/qldpc/codes/distance_test.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qldpc/circuits/common_test.py b/src/qldpc/circuits/common_test.py index ed999a06..74f80951 100644 --- a/src/qldpc/circuits/common_test.py +++ b/src/qldpc/circuits/common_test.py @@ -44,7 +44,7 @@ def test_state_prep(pytestconfig: pytest.Config) -> None: codes_to_test = [ codes.FiveQubitCode(), codes.BaconShorCode(3), - codes.HGPCode(codes.ClassicalCode.random(5, 3, seed=np.random.randint(2**32 - 1))), + codes.HGPCode(codes.ClassicalCode.random(5, 3, seed=np.random.randint(2**31))), ] for code, only_zero in itertools.product(codes_to_test, [True, False]): diff --git a/src/qldpc/codes/distance_test.py b/src/qldpc/codes/distance_test.py index dd9b46ea..62381bd4 100644 --- a/src/qldpc/codes/distance_test.py +++ b/src/qldpc/codes/distance_test.py @@ -185,7 +185,7 @@ def test_count_trailing_zeros(base_val: int) -> None: @pytest.mark.parametrize("width", range(1, 8)) def test_inplace_rowsum(width: int) -> None: - arr = np.random.randint(2**32, size=(10, width), dtype=np.uint) + arr = np.random.randint(2**31, size=(10, width), dtype=np.uint) expected = arr.sum(-1) actual = qldpc.codes.distance._inplace_rowsum(arr) np.testing.assert_array_equal(actual, expected) From fd936cf6897f8a518aaf0cb5d787fab3b4bdf334 Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 19:45:00 -0500 Subject: [PATCH 26/27] fix coverage that sometimes fails --- src/qldpc/codes/common_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qldpc/codes/common_test.py b/src/qldpc/codes/common_test.py index 96aadd12..9e04d645 100644 --- a/src/qldpc/codes/common_test.py +++ b/src/qldpc/codes/common_test.py @@ -75,6 +75,7 @@ def test_constructions_classical(pytestconfig: pytest.Config) -> None: code = codes.ClassicalCode.random(6, 4, field=field) bits_to_remove = np.random.choice(range(len(code)), size=2, replace=False) bits_to_keep = [bit for bit in range(len(code)) if bit not in bits_to_remove] + code._matrix[:2, bits_to_remove] = -1 # ensure we have nontrivial row-reduction to do punctured_code = code.punctured(bits_to_remove) assert punctured_code.is_equiv_to( codes.ClassicalCode.from_generator(code.generator[:, bits_to_keep]) From 26da7c1cfa6794a9cfdec7803ad45cab601b401c Mon Sep 17 00:00:00 2001 From: "Michael A. Perlin" Date: Mon, 16 Feb 2026 19:52:23 -0500 Subject: [PATCH 27/27] sign fix --- src/qldpc/codes/common_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qldpc/codes/common_test.py b/src/qldpc/codes/common_test.py index 9e04d645..95e9cc1e 100644 --- a/src/qldpc/codes/common_test.py +++ b/src/qldpc/codes/common_test.py @@ -75,7 +75,7 @@ def test_constructions_classical(pytestconfig: pytest.Config) -> None: code = codes.ClassicalCode.random(6, 4, field=field) bits_to_remove = np.random.choice(range(len(code)), size=2, replace=False) bits_to_keep = [bit for bit in range(len(code)) if bit not in bits_to_remove] - code._matrix[:2, bits_to_remove] = -1 # ensure we have nontrivial row-reduction to do + code._matrix[:2, bits_to_remove] = 1 # ensure we have nontrivial row-reduction to do punctured_code = code.punctured(bits_to_remove) assert punctured_code.is_equiv_to( codes.ClassicalCode.from_generator(code.generator[:, bits_to_keep])