From 9b959c5dca1dfb28568f7bc3602f59cc30127d7e Mon Sep 17 00:00:00 2001 From: Craig Gidney Date: Mon, 15 Jun 2026 20:53:56 -0700 Subject: [PATCH 01/13] Fix stimflow `start="auto"` failing for observables - Similarly fix `end="auto"` - Also improve `stimflow.Flow.__repr__` not returning a parseable result --- .../stimflow/_chunk/_chunk_builder_test.py | 28 +++++++++++++++++++ .../src/stimflow/_chunk/_flow_util.py | 6 ++-- glue/stimflow/src/stimflow/_core/_flow.py | 23 +++++++++------ 3 files changed, 46 insertions(+), 11 deletions(-) diff --git a/glue/stimflow/src/stimflow/_chunk/_chunk_builder_test.py b/glue/stimflow/src/stimflow/_chunk/_chunk_builder_test.py index 968a1e16e..7b5c7779b 100644 --- a/glue/stimflow/src/stimflow/_chunk/_chunk_builder_test.py +++ b/glue/stimflow/src/stimflow/_chunk/_chunk_builder_test.py @@ -311,3 +311,31 @@ def test_partial_observable_include_memory_experiment(): assert np.count_nonzero(dets) == 0 assert 200 <= np.count_nonzero(obs[:, 0]) <= 300 # Some measurements included in partial X obs assert np.count_nonzero(obs[:, 1]) == 0 # No measurements included in partial Z obs + + +def test_auto_obs(): + builder = stimflow.ChunkBuilder(allowed_qubits=[0, 1]) + builder.append("R", [0]) + builder.add_flow( + start="auto", + end=stimflow.PauliMap({0: 'Z', 1: 'Z'}, obs_name='test'), + ) + builder.add_flow( + start=stimflow.PauliMap({1: 'Z'}, obs_name='test2'), + end="auto", + ) + chunk = builder.finish_chunk() + chunk.verify() + + assert chunk.flows == ( + stimflow.Flow( + start=stimflow.PauliMap({1: 'Z'}, obs_name='test'), + end=stimflow.PauliMap({0: 'Z', 1: 'Z'}, obs_name='test'), + center=0.5, + ), + stimflow.Flow( + start=stimflow.PauliMap({1: 'Z'}, obs_name='test2'), + end=stimflow.PauliMap({1: 'Z'}, obs_name='test2'), + center=1, + ), + ) diff --git a/glue/stimflow/src/stimflow/_chunk/_flow_util.py b/glue/stimflow/src/stimflow/_chunk/_flow_util.py index 96bb3f83a..8032066d7 100644 --- a/glue/stimflow/src/stimflow/_chunk/_flow_util.py +++ b/glue/stimflow/src/stimflow/_chunk/_flow_util.py @@ -29,7 +29,7 @@ def _solve_auto_flow_starts( except ValueError: failure_out.append(flow) continue - start = PauliMap({i2q[q]: "_XYZ"[stim_start[q]] for q in stim_start.pauli_indices()}) + start = PauliMap({i2q[q]: "_XYZ"[stim_start[q]] for q in stim_start.pauli_indices()}, obs_name=flow.end.obs_name) new_flows.append(flow.with_edits(start=start)) return new_flows @@ -43,7 +43,7 @@ def _solve_auto_flow_ends( failure_out: list[Flow], ) -> list[Flow]: - num_qubits = circuit.num_qubits + num_qubits = max(q2i.values(), default=-1) + 1 i2q = {i: q for q, i in q2i.items()} new_flows = [] @@ -54,7 +54,7 @@ def _solve_auto_flow_ends( except ValueError: failure_out.append(flow) continue - end = PauliMap({i2q[q]: "_XYZ"[stim_end[q]] for q in stim_end.pauli_indices()}) + end = PauliMap({i2q[q]: "_XYZ"[stim_end[q]] for q in stim_end.pauli_indices()}, obs_name=flow.start.obs_name) new_flows.append(flow.with_edits(end=end)) return new_flows diff --git a/glue/stimflow/src/stimflow/_core/_flow.py b/glue/stimflow/src/stimflow/_core/_flow.py index d29443ed9..6beda72f8 100644 --- a/glue/stimflow/src/stimflow/_core/_flow.py +++ b/glue/stimflow/src/stimflow/_core/_flow.py @@ -209,14 +209,21 @@ def __str__(self) -> str: return result def __repr__(self): - return ( - f"stimflow.Flow(start={self.start!r}, " - f"end={self.end!r}, " - f"measurement_indices={self.measurement_indices!r}, " - f"flags={self.flags!r}, " - f"center={self.center!r}, " - f"sign={self.sign!r}" - ) + lines = ["stimflow.Flow("] + if self.start: + lines.append(f"start={self.start!r},") + if self.end: + lines.append(f"end={self.end!r},") + if self.measurement_indices: + lines.append(f"measurement_indices={self.measurement_indices!r},") + if self.flags: + lines.append(f"flags={self.flags!r},") + if self.center is not None: + lines.append(f"center={self.center!r},") + if self.sign is not None: + lines.append(f"sign={self.sign!r},") + lines.append(")") + return '\n'.join(lines) def with_xz_flipped(self) -> Flow: return self.with_edits(start=self.start.with_xz_flipped(), end=self.end.with_xz_flipped()) From 14da731e8955c60615094cd127df208f6eae48fc Mon Sep 17 00:00:00 2001 From: Craig Gidney Date: Mon, 15 Jun 2026 22:15:21 -0700 Subject: [PATCH 02/13] verbose pytest --- .github/workflows/ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6e41e752..12058cc4c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -110,7 +110,7 @@ jobs: CIBW_BUILD: "${{ matrix.os_dist.dist }}" CIBW_ARCHS_MACOS: "${{ matrix.os_dist.macosarch }}" CIBW_TEST_REQUIRES: cirq-core pytest - CIBW_TEST_COMMAND: pytest {project}/src {project}/glue/cirq && stim help + CIBW_TEST_COMMAND: pytest --verbose {project}/src {project}/glue/cirq && stim help steps: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 @@ -437,7 +437,7 @@ jobs: - run: bazel build :stim_dev_wheel - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl - run: pip install pytest - - run: pytest src + - run: pytest --verbose src - run: dev/doctest_proper.py --module stim test_stimcirq: runs-on: ubuntu-24.04 @@ -454,7 +454,7 @@ jobs: - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl - run: pip install -e glue/cirq - run: pip install pytest - - run: pytest glue/cirq + - run: pytest --verbose glue/cirq - run: dev/doctest_proper.py --module stimcirq --import cirq sympy test_stimflow: runs-on: ubuntu-24.04 @@ -471,7 +471,7 @@ jobs: - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl - run: pip install -e glue/stimflow - run: pip install pytest - - run: pytest glue/stimflow + - run: pytest --verbose glue/stimflow - run: dev/doctest_proper.py --module stimflow --suppress_examples_warning_for stimflow.str_svg stimflow.str_html stimflow.Viewable3dModelGLTF test_sinter: runs-on: ubuntu-24.04 @@ -488,7 +488,7 @@ jobs: - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl - run: pip install -e glue/sample - run: pip install pytest pymatching fusion-blossom~=0.1.4 mwpf~=0.1.5 - - run: pytest glue/sample + - run: pytest --verbose glue/sample - run: dev/doctest_proper.py --module sinter - run: sinter help test_stimzx: @@ -506,7 +506,7 @@ jobs: - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl - run: pip install -e glue/zx - run: pip install pytest - - run: pytest glue/zx + - run: pytest --verbose glue/zx - run: dev/doctest_proper.py --module stimzx test_stimjs: runs-on: ubuntu-22.04 From 23b04b1cadbfef287a21dc1d90c9ecc40186f5dc Mon Sep 17 00:00:00 2001 From: Craig Gidney Date: Mon, 15 Jun 2026 22:37:29 -0700 Subject: [PATCH 03/13] add print debug lines --- src/stim/circuit/circuit_pybind_test.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/stim/circuit/circuit_pybind_test.py b/src/stim/circuit/circuit_pybind_test.py index be2c05446..c61282f55 100644 --- a/src/stim/circuit/circuit_pybind_test.py +++ b/src/stim/circuit/circuit_pybind_test.py @@ -13,6 +13,7 @@ # limitations under the License. import io import pathlib +import sys import tempfile from typing import cast @@ -1497,14 +1498,18 @@ def test_num_ticks(): def test_reference_sample(): + print("TEST PROGRESSION: A", file=sys.stderr) circuit = stim.Circuit( """ H 0 CNOT 0 1 """ ) + print("TEST PROGRESSION: B", file=sys.stderr) ref = circuit.reference_sample() + print("TEST PROGRESSION: C", file=sys.stderr) assert len(ref) == 0 + print("TEST PROGRESSION: D", file=sys.stderr) circuit = stim.Circuit( """ H 0 1 @@ -1512,16 +1517,27 @@ def test_reference_sample(): MPP X0*X1 Y0*Y1 Z0*Z1 """ ) + print("TEST PROGRESSION: E", file=sys.stderr) np.testing.assert_array_equal(circuit.reference_sample(), circuit.reference_sample()) + print("TEST PROGRESSION: F", file=sys.stderr) assert np.sum(circuit.reference_sample()) % 2 == 1 + print("TEST PROGRESSION: G", file=sys.stderr) circuit.append("X", (i for i in range(0, 100, 2))) + print("TEST PROGRESSION: H", file=sys.stderr) circuit.append("M", (i for i in range(100))) + print("TEST PROGRESSION: I", file=sys.stderr) ref_sample = circuit.reference_sample(bit_packed=True) + print("TEST PROGRESSION: J", file=sys.stderr) unpacked = np.unpackbits(ref_sample, bitorder="little") + print("TEST PROGRESSION: K", file=sys.stderr) expected = circuit.reference_sample(bit_packed=False) + print("TEST PROGRESSION: L", file=sys.stderr) expected_padded = np.zeros_like(unpacked) + print("TEST PROGRESSION: M", file=sys.stderr) expected_padded[:len(expected)] = expected + print("TEST PROGRESSION: N", file=sys.stderr) np.testing.assert_array_equal(unpacked, expected_padded) + print("TEST PROGRESSION: O", file=sys.stderr) def test_max_mix_depolarization_is_allowed_in_dem_conversion_without_args(): From f7b24297e3c8ceae985209fd8e576c10cfe669c0 Mon Sep 17 00:00:00 2001 From: Craig Gidney Date: Mon, 15 Jun 2026 22:56:02 -0700 Subject: [PATCH 04/13] --capture=no --- .github/workflows/ci.yml | 12 ++++++------ src/stim/simulators/frame_simulator_pybind_test.py | 2 -- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12058cc4c..c9676d60d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -110,7 +110,7 @@ jobs: CIBW_BUILD: "${{ matrix.os_dist.dist }}" CIBW_ARCHS_MACOS: "${{ matrix.os_dist.macosarch }}" CIBW_TEST_REQUIRES: cirq-core pytest - CIBW_TEST_COMMAND: pytest --verbose {project}/src {project}/glue/cirq && stim help + CIBW_TEST_COMMAND: pytest --capture=no --verbose {project}/src {project}/glue/cirq && stim help steps: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 @@ -437,7 +437,7 @@ jobs: - run: bazel build :stim_dev_wheel - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl - run: pip install pytest - - run: pytest --verbose src + - run: pytest --capture=no --verbose src - run: dev/doctest_proper.py --module stim test_stimcirq: runs-on: ubuntu-24.04 @@ -454,7 +454,7 @@ jobs: - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl - run: pip install -e glue/cirq - run: pip install pytest - - run: pytest --verbose glue/cirq + - run: pytest --capture=no --verbose glue/cirq - run: dev/doctest_proper.py --module stimcirq --import cirq sympy test_stimflow: runs-on: ubuntu-24.04 @@ -471,7 +471,7 @@ jobs: - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl - run: pip install -e glue/stimflow - run: pip install pytest - - run: pytest --verbose glue/stimflow + - run: pytest --capture=no --verbose glue/stimflow - run: dev/doctest_proper.py --module stimflow --suppress_examples_warning_for stimflow.str_svg stimflow.str_html stimflow.Viewable3dModelGLTF test_sinter: runs-on: ubuntu-24.04 @@ -488,7 +488,7 @@ jobs: - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl - run: pip install -e glue/sample - run: pip install pytest pymatching fusion-blossom~=0.1.4 mwpf~=0.1.5 - - run: pytest --verbose glue/sample + - run: pytest --capture=no --verbose glue/sample - run: dev/doctest_proper.py --module sinter - run: sinter help test_stimzx: @@ -506,7 +506,7 @@ jobs: - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl - run: pip install -e glue/zx - run: pip install pytest - - run: pytest --verbose glue/zx + - run: pytest --capture=no --verbose glue/zx - run: dev/doctest_proper.py --module stimzx test_stimjs: runs-on: ubuntu-22.04 diff --git a/src/stim/simulators/frame_simulator_pybind_test.py b/src/stim/simulators/frame_simulator_pybind_test.py index 4beddc4c6..6b59a227c 100644 --- a/src/stim/simulators/frame_simulator_pybind_test.py +++ b/src/stim/simulators/frame_simulator_pybind_test.py @@ -587,8 +587,6 @@ def test_generate_bernoulli_samples(): assert np.all(v == 0) sim.generate_bernoulli_samples(256 - 101, p=1, bit_packed=True, out=v[1:-11]) - for k in v: - print(k) assert np.all(v[1:-12] == 0xFF) assert v[-12] == 7 assert np.all(v[-11:] == 0) From f3930814984c898e1081b1be8ef5d9de1d5eb888 Mon Sep 17 00:00:00 2001 From: Craig Gidney Date: Mon, 15 Jun 2026 23:09:29 -0700 Subject: [PATCH 05/13] repro --- .github/workflows/ci.yml | 508 +-------------------------------------- mock.py | 25 ++ 2 files changed, 28 insertions(+), 505 deletions(-) create mode 100644 mock.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9676d60d..c2055b178 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,510 +23,8 @@ on: branches: - main jobs: - build_dist: - runs-on: ${{ matrix.os_dist.os }} - strategy: - fail-fast: false - matrix: - os_dist: [ - {os: ubuntu-24.04, dist: cp310-manylinux_x86_64}, - {os: ubuntu-24.04, dist: cp311-manylinux_x86_64}, - {os: ubuntu-24.04, dist: cp312-manylinux_x86_64}, - {os: ubuntu-24.04, dist: cp313-manylinux_x86_64}, - {os: ubuntu-24.04, dist: cp314-manylinux_x86_64}, - - # manylinux_i686 disabled because scipy isn't prebuilt and fails to build. - # - # The actual error seen in github actions: - # - # numpy.distutils.system_info.NotFoundError: No BLAS/LAPACK - # libraries found. To build Scipy from sources, BLAS & LAPACK - # libraries need to be installed. - # - #{os: ubuntu-latest, dist: cp310-manylinux_i686}, - - # pypy manylinux builds disabled because scipy isn't prebuilt and fails to build. - # - # The actual error seen in github actions: - # - # numpy.distutils.system_info.NotFoundError: No BLAS/LAPACK - # libraries found. To build Scipy from sources, BLAS & LAPACK - # libraries need to be installed. - # - # {os: ubuntu-latest, dist: pp39-manylinux_x86_64}, - # {os: ubuntu-latest, dist: pp39-manylinux_i686}, - - # musllinux builds disabled because scipy isn't prebuilt and fails to build. - # - # The actual error seen in github actions: - # - # numpy.distutils.system_info.NotFoundError: No BLAS/LAPACK - # libraries found. To build Scipy from sources, BLAS & LAPACK - # libraries need to be installed. - # - # {os: ubuntu-latest, dist: cp310-musllinux_x86_64}, - # {os: ubuntu-latest, dist: cp310-musllinux_i686}, - - {os: macos-14, dist: cp310-macosx_x86_64, macosarch: x86_64}, - {os: macos-14, dist: cp311-macosx_x86_64, macosarch: x86_64}, - {os: macos-14, dist: cp312-macosx_x86_64, macosarch: x86_64}, - {os: macos-14, dist: cp313-macosx_x86_64, macosarch: x86_64}, - {os: macos-14, dist: cp314-macosx_x86_64, macosarch: x86_64}, - - {os: macos-14, dist: cp310-macosx_arm64, macosarch: arm64}, - {os: macos-14, dist: cp311-macosx_arm64, macosarch: arm64}, - {os: macos-14, dist: cp312-macosx_arm64, macosarch: arm64}, - {os: macos-14, dist: cp313-macosx_arm64, macosarch: arm64}, - {os: macos-14, dist: cp314-macosx_arm64, macosarch: arm64}, - - # pypy OSX builds disabled because numpy isn't prebuilt and fails to build. - # - # The actual error seen in github actions: - # - # RuntimeError: Found /usr/lib/libcblas.dylib, but that file is a - # symbolic link to the MacOS Accelerate framework, which is not - # supported by NumPy. You must configure the build to use a - # different optimized library, or disable the use of optimized - # BLAS and LAPACK by setting the environment variables - # NPY_BLAS_ORDER="" and NPY_LAPACK_ORDER="" before building NumPy. - # - # {os: macOS-10.15, dist: pp39-macosx_x86_64}, - - {os: windows-2025, dist: cp310-win_amd64}, - {os: windows-2025, dist: cp311-win_amd64}, - {os: windows-2025, dist: cp312-win_amd64}, - {os: windows-2025, dist: cp313-win_amd64}, - {os: windows-2025, dist: cp314-win_amd64}, - - # cp310-win32 disabled because numpy isn't prebuilt and fails to build. - # - # The actual error seen in github actions: - # - # CCompiler_spawn() got an unexpected keyword argument 'env' - # - # {os: windows-2025, dist: cp310-win32}, - ] - env: - CIBW_BUILD: "${{ matrix.os_dist.dist }}" - CIBW_ARCHS_MACOS: "${{ matrix.os_dist.macosarch }}" - CIBW_TEST_REQUIRES: cirq-core pytest - CIBW_TEST_COMMAND: pytest --capture=no --verbose {project}/src {project}/glue/cirq && stim help - steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 - - run: python dev/overwrite_dev_versions_with_date.py - - run: python -m pip install pybind11~=2.11.1 cibuildwheel~=3.3.1 setuptools wheel - - run: python -m cibuildwheel --print-build-identifiers - - run: python -m cibuildwheel --output-dir dist - - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: "dist-stim-${{ matrix.os_dist.os }}-${{ matrix.os_dist.dist }}-${{ matrix.os_dist.macosarch }}" - path: dist/* - build_sdist: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 - - run: python -m pip install setuptools pybind11~=2.11.1 - - run: python dev/overwrite_dev_versions_with_date.py - - run: mkdir output - - run: python setup.py sdist - - run: cd glue/cirq && python setup.py sdist - - run: cd glue/cirq && python setup.py bdist_wheel - - run: cd glue/sample && python setup.py sdist - - run: cd glue/sample && python setup.py bdist_wheel - - run: cd glue/stimflow && python setup.py sdist - - run: cd glue/stimflow && python setup.py bdist_wheel - - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: "dist-sinter" - path: glue/sample/dist/*.tar.gz - - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: "bdist-sinter" - path: glue/sample/dist/*.whl - - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: "dist-stimcirq" - path: glue/cirq/dist/*.tar.gz - - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: "bdist-stimcirq" - path: glue/cirq/dist/*.whl - - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: "dist-stimflow" - path: glue/stimflow/dist/*.tar.gz - - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: "bdist-stimflow" - path: glue/stimflow/dist/*.whl - - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: "dist-stim-sdist" - path: dist/*.tar.gz - check_sdist_installs_stim: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 - - run: python -m pip install pybind11~=2.11.1 cibuildwheel~=3.3.1 setuptools wheel - - run: python setup.py sdist - - run: pip install dist/*.tar.gz - check_sdist_installs_sinter: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 - - run: python -m pip install setuptools - - run: cd glue/sample && python setup.py sdist - - run: pip install glue/sample/dist/* - - run: python -c "import sinter" - check_sdist_installs_stimflow: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 - - run: python -m pip install setuptools - - run: cd glue/stimflow && python setup.py sdist - - run: pip install glue/stimflow/dist/* - - run: python -c "import stimflow" - merge_upload_artifacts: - needs: ["build_dist", "build_sdist"] - runs-on: ubuntu-24.04 - steps: - - name: Merge Artifacts - uses: actions/upload-artifact/merge@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4 - with: - name: dist-stim - pattern: dist-stim-* - upload_dev_release_to_pypi: - needs: ["merge_upload_artifacts"] - if: github.ref == 'refs/heads/main' - runs-on: ubuntu-24.04 - steps: - - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 - with: - name: dist-stim - path: dist-stim - - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 - with: - name: dist-stimcirq - path: dist-stimcirq - - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 - with: - name: dist-sinter - path: dist-sinter - - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 - with: - name: dist-stimflow - path: dist-stimflow - - uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # release/v1 - with: - user: __token__ - packages_dir: dist-stim - password: ${{ secrets.pypi_token_stim }} - - uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # release/v1 - with: - user: __token__ - packages_dir: dist-stimcirq - password: ${{ secrets.pypi_token_stimcirq }} - - uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # release/v1 - with: - user: __token__ - packages_dir: dist-sinter - password: ${{ secrets.pypi_token_sinter }} - - uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # release/v1 - with: - user: __token__ - packages_dir: dist-stimflow - password: ${{ secrets.pypi_token_stimflow }} - run_main: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1 - - run: cmake . - - run: make stim -j 2 - - run: echo -e "H 0 \n CNOT 0 1 \n M 0 1" | out/stim --sample - build_bazel: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1 - - uses: bazel-contrib/setup-bazel@e403ad507104847c3539436f64a9e9eecc73eeec # 0.8.5 - with: - bazelisk-cache: true - disk-cache: ${{ github.workflow }} - repository-cache: true - bazelisk-version: 1.x - - run: bazel build :all - - run: bazel test :stim_test - build_clang_stim_test: - runs-on: 'ubuntu-24.04' - steps: - - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1 - - run: | - cd .. - git clone https://github.com/google/googletest.git -b release-1.12.1 - mkdir googletest/build && cd googletest/build - cmake .. -DBUILD_GMOCK=OFF - make - sudo make install - - uses: egor-tensin/setup-clang@ef434b41eb33a70396fb336b1bae39c76d740c3d # v1 - with: - version: latest - platform: x64 - - run: cmake . -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=c++ - - run: cmake --build . --target stim_test - build_clang_stim: - runs-on: 'ubuntu-24.04' - steps: - - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1 - - run: | - cd .. - git clone https://github.com/google/googletest.git -b release-1.12.1 - mkdir googletest/build && cd googletest/build - cmake .. -DBUILD_GMOCK=OFF - make - sudo make install - - uses: egor-tensin/setup-clang@ef434b41eb33a70396fb336b1bae39c76d740c3d # v1 - with: - version: latest - platform: x64 - - run: cmake . -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=c++ - - run: cmake --build . --target stim - build_clang_stim_perf: - runs-on: 'ubuntu-24.04' - steps: - - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1 - - run: | - cd .. - git clone https://github.com/google/googletest.git -b release-1.12.1 - mkdir googletest/build && cd googletest/build - cmake .. -DBUILD_GMOCK=OFF - make - sudo make install - - uses: egor-tensin/setup-clang@ef434b41eb33a70396fb336b1bae39c76d740c3d # v1 - with: - version: latest - platform: x64 - - run: cmake . -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=c++ - - run: cmake --build . --target stim_perf - build_lib: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1 - - run: cmake . - - run: make libstim -j 2 - - run: echo -e '#include "stim.h"\nint main(int argc,const char **argv) {return !stim::find_bool_argument("test", argc, argv);}' > test.cc - - run: g++ -std=c++20 test.cc out/libstim.a -I src - - run: ./a.out test - build_lib_install: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1 - - run: mkdir install_dir - - run: cmake . -DCMAKE_INSTALL_PREFIX=install_dir - - run: make -j 2 - - run: make install - - run: echo -e '#include "stim.h"\nint main(int argc,const char **argv) {return !stim::find_bool_argument("test", argc, argv);}' > test.cc - - run: g++ -std=c++20 test.cc install_dir/lib/libstim.a -I install_dir/include - - run: ./a.out test - - run: echo -e "H 0 \n CNOT 0 1 \n M 0 1" | install_dir/bin/stim --sample - benchmark_windows: + test_repro: runs-on: windows-2025 steps: - - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1 - - uses: microsoft/setup-msbuild@c26a08ba26249b81327e26f6ef381897b6a8754d # v1.0.2 - - run: cmake . - - run: MSBuild.exe stim_perf.vcxproj /p:Configuration=Release /p:OutDir=msbuild_out /p:O=2 - - run: msbuild_out/stim_perf.exe - benchmark: - runs-on: ubuntu-24.04 - strategy: - matrix: - simd_width: [64, 128, 256] - steps: - - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1 - - run: cmake . -DSIMD_WIDTH=${{ matrix.simd_width }} - - run: make stim_perf -j 2 - - run: out/stim_perf - test: - runs-on: ubuntu-24.04 - strategy: - matrix: - simd_width: [64, 128, 256] - steps: - - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1 - - run: | - cd .. - git clone https://github.com/google/googletest.git -b release-1.12.1 - mkdir googletest/build && cd googletest/build - cmake .. -DBUILD_GMOCK=OFF - make - sudo make install - - run: cmake . -DSIMD_WIDTH=${{ matrix.simd_width }} - - run: make stim_test -j 2 - - run: out/stim_test - test_o3: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1 - - run: | - cd .. - git clone https://github.com/google/googletest.git -b release-1.12.1 - mkdir googletest/build && cd googletest/build - cmake .. -DBUILD_GMOCK=OFF - make - sudo make install - - run: cmake . -DSIMD_WIDTH=256 - - run: make stim_test_o3 -j 2 - - run: out/stim_test_o3 - test_generated_docs_are_fresh: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 - - uses: bazel-contrib/setup-bazel@e403ad507104847c3539436f64a9e9eecc73eeec # 0.8.5 - with: - bazelisk-cache: true - disk-cache: ${{ github.workflow }} - repository-cache: true - bazelisk-version: 1.x - - uses: actions/setup-node@f1f314fca9dfce2769ece7d933488f076716723e # v1 - with: - node-version: 16.x - - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6 - with: - python-version: '3.13' - - run: bazel build :stim_dev_wheel - - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl - - run: diff <(python dev/gen_stim_api_reference.py -dev) doc/python_api_reference_vDev.md - - run: diff <(python dev/gen_stim_stub_file.py -dev) glue/python/src/stim/__init__.pyi - - run: diff <(python dev/gen_stim_stub_file.py -dev) doc/stim.pyi - - run: diff <(python -c "import stim; stim.main(command_line_args=['help', 'gates_markdown'])") doc/gates.md - - run: diff <(python -c "import stim; stim.main(command_line_args=['help', 'formats_markdown'])") doc/result_formats.md - - run: diff <(python -c "import stim; stim.main(command_line_args=['help', 'commands_markdown'])") doc/usage_command_line.md - - run: diff <(dev/gen_known_gates_for_js.sh) glue/crumble/test/generated_gate_name_list.test.js - - run: python doc/stim.pyi - - run: npm install -g rollup@3.21.2 uglify-js@3.17.4 - - run: diff <(dev/compile_crumble_into_cpp_string_file.sh) src/stim/diagram/crumble_data.cc - - run: pip install -e glue/sample - - run: diff <(python dev/gen_sinter_api_reference.py -dev) doc/sinter_api.md - - run: pip install -e glue/stimflow - - run: diff <(python glue/stimflow/tools/gen_api_reference.py -dev) glue/stimflow/doc/api.md - test_generated_file_lists_are_fresh: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - - run: dev/regen_file_lists.sh /tmp - - run: diff /tmp/perf_files file_lists/perf_files - - run: diff /tmp/pybind_files file_lists/pybind_files - - run: diff /tmp/source_files_no_main file_lists/source_files_no_main - - run: diff /tmp/test_files file_lists/test_files - test_pybind: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 - - uses: bazel-contrib/setup-bazel@e403ad507104847c3539436f64a9e9eecc73eeec # 0.8.5 - with: - bazelisk-cache: true - disk-cache: ${{ github.workflow }} - repository-cache: true - bazelisk-version: 1.x - - run: bazel build :stim_dev_wheel - - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl - - run: pip install pytest - - run: pytest --capture=no --verbose src - - run: dev/doctest_proper.py --module stim - test_stimcirq: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 - - uses: bazel-contrib/setup-bazel@e403ad507104847c3539436f64a9e9eecc73eeec # 0.8.5 - with: - bazelisk-cache: true - disk-cache: ${{ github.workflow }} - repository-cache: true - bazelisk-version: 1.x - - run: bazel build :stim_dev_wheel - - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl - - run: pip install -e glue/cirq - - run: pip install pytest - - run: pytest --capture=no --verbose glue/cirq - - run: dev/doctest_proper.py --module stimcirq --import cirq sympy - test_stimflow: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 - - uses: bazel-contrib/setup-bazel@e403ad507104847c3539436f64a9e9eecc73eeec # 0.8.5 - with: - bazelisk-cache: true - disk-cache: ${{ github.workflow }} - repository-cache: true - bazelisk-version: 1.x - - run: bazel build :stim_dev_wheel - - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl - - run: pip install -e glue/stimflow - - run: pip install pytest - - run: pytest --capture=no --verbose glue/stimflow - - run: dev/doctest_proper.py --module stimflow --suppress_examples_warning_for stimflow.str_svg stimflow.str_html stimflow.Viewable3dModelGLTF - test_sinter: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 - - uses: bazel-contrib/setup-bazel@e403ad507104847c3539436f64a9e9eecc73eeec # 0.8.5 - with: - bazelisk-cache: true - disk-cache: ${{ github.workflow }} - repository-cache: true - bazelisk-version: 1.x - - run: bazel build :stim_dev_wheel - - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl - - run: pip install -e glue/sample - - run: pip install pytest pymatching fusion-blossom~=0.1.4 mwpf~=0.1.5 - - run: pytest --capture=no --verbose glue/sample - - run: dev/doctest_proper.py --module sinter - - run: sinter help - test_stimzx: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 - - uses: bazel-contrib/setup-bazel@e403ad507104847c3539436f64a9e9eecc73eeec # 0.8.5 - with: - bazelisk-cache: true - disk-cache: ${{ github.workflow }} - repository-cache: true - bazelisk-version: 1.x - - run: bazel build :stim_dev_wheel - - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl - - run: pip install -e glue/zx - - run: pip install pytest - - run: pytest --capture=no --verbose glue/zx - - run: dev/doctest_proper.py --module stimzx - test_stimjs: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - - uses: mymindstorm/setup-emsdk@6ab9eb1bda2574c4ddb79809fc9247783eaf9021 # v14 - with: - version: 4.0.1 - actions-cache-folder: 'emsdk-cache' - - uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4 - with: - node-version: 18.x - - run: npm install - - run: bash glue/javascript/build_wasm.sh - - run: node puppeteer_run_tests.js - test_crumble: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - - uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3 - with: - node-version: 16 - - run: node glue/crumble/run_tests_headless.js + - run: pip install pytest stim~=1.17.dev + - run: python mock.py diff --git a/mock.py b/mock.py new file mode 100644 index 000000000..11539d31a --- /dev/null +++ b/mock.py @@ -0,0 +1,25 @@ +import sys + +import stim +import numpy as np + + +def main(): + circuit = stim.Circuit( + """ + H 0 1 + CX 0 2 1 3 + MPP X0*X1 Y0*Y1 Z0*Z1 + """ + ) + print("TEST PROGRESSION: A", file=sys.stderr) + aa = circuit.reference_sample() + print("TEST PROGRESSION: B", file=sys.stderr) + bb = circuit.reference_sample() + print("TEST PROGRESSION: C", file=sys.stderr) + np.testing.assert_array_equal(aa, bb) + print("TEST PROGRESSION: D", file=sys.stderr) + + +if __name__ == '__main__': + main() From 27e7c8f35f52211607d1c4e2b84d30c2f607cb13 Mon Sep 17 00:00:00 2001 From: Craig Gidney Date: Mon, 15 Jun 2026 23:11:06 -0700 Subject: [PATCH 06/13] typo --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c2055b178..7084b4c9a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,5 +26,5 @@ jobs: test_repro: runs-on: windows-2025 steps: - - run: pip install pytest stim~=1.17.dev - - run: python mock.py + - run: pip install stim~=1.17.dev + - run: python {project}/mock.py From a369d5d23f41381a73fee40ed61b826e0977fd45 Mon Sep 17 00:00:00 2001 From: Craig Gidney Date: Mon, 15 Jun 2026 23:13:05 -0700 Subject: [PATCH 07/13] python --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7084b4c9a..c2f03afa7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,4 +27,5 @@ jobs: runs-on: windows-2025 steps: - run: pip install stim~=1.17.dev + - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 - run: python {project}/mock.py From 5820a762ebfd6081a30368b699c3dc0b1ca5455b Mon Sep 17 00:00:00 2001 From: Craig Gidney Date: Mon, 15 Jun 2026 23:16:16 -0700 Subject: [PATCH 08/13] ...pytest? --- .github/workflows/ci.yml | 4 ++-- mock.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c2f03afa7..9e97338a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,6 @@ jobs: test_repro: runs-on: windows-2025 steps: - - run: pip install stim~=1.17.dev - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 - - run: python {project}/mock.py + - run: pip install stim~=1.17.dev pytest + - run: pytest --capture=no --verbose {project}/mock.py diff --git a/mock.py b/mock.py index 11539d31a..174dd8304 100644 --- a/mock.py +++ b/mock.py @@ -4,7 +4,8 @@ import numpy as np -def main(): +def test_x(): + print("TEST PROGRESSION: START", file=sys.stderr) circuit = stim.Circuit( """ H 0 1 @@ -22,4 +23,4 @@ def main(): if __name__ == '__main__': - main() + test_x() From 894ca16f1b65d5f60b7e3080cf70385fa605da91 Mon Sep 17 00:00:00 2001 From: Craig Gidney Date: Mon, 15 Jun 2026 23:22:15 -0700 Subject: [PATCH 09/13] ls --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e97338a6..76a98b51f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,5 +27,7 @@ jobs: runs-on: windows-2025 steps: - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 - - run: pip install stim~=1.17.dev pytest - - run: pytest --capture=no --verbose {project}/mock.py + - run: pip install stim~=1.17.dev + - run: ls + - run: pwd + - run: python mock.py From e7216e9ddcbb7e1b061aae7bfc99aecad92af2be Mon Sep 17 00:00:00 2001 From: Craig Gidney Date: Mon, 15 Jun 2026 23:23:31 -0700 Subject: [PATCH 10/13] checkout --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76a98b51f..7356ea7a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,8 +26,7 @@ jobs: test_repro: runs-on: windows-2025 steps: + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 - run: pip install stim~=1.17.dev - - run: ls - - run: pwd - run: python mock.py From 4c2ffb0483a816013ef4068827e7f68f3a77d777 Mon Sep 17 00:00:00 2001 From: Craig Gidney Date: Mon, 15 Jun 2026 23:25:13 -0700 Subject: [PATCH 11/13] pytest --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7356ea7a3..991de55c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,5 +28,6 @@ jobs: steps: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 - - run: pip install stim~=1.17.dev - - run: python mock.py + - run: pip install stim~=1.17.dev pytest + - run: pytest --verbose --capture=no mock.py + - run: pytest --verbose --capture=no src From 60f327c27698cab509ea754ff4c063a21b368b74 Mon Sep 17 00:00:00 2001 From: Craig Gidney Date: Tue, 23 Jun 2026 19:53:43 -0700 Subject: [PATCH 12/13] x --- glue/stimflow/src/stimflow/_chunk/_stabilizer_code.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glue/stimflow/src/stimflow/_chunk/_stabilizer_code.py b/glue/stimflow/src/stimflow/_chunk/_stabilizer_code.py index 8f10bf8b6..bde5e9658 100644 --- a/glue/stimflow/src/stimflow/_chunk/_stabilizer_code.py +++ b/glue/stimflow/src/stimflow/_chunk/_stabilizer_code.py @@ -269,7 +269,7 @@ def x_basis_subset(self) -> StabilizerCode: def z_basis_subset(self) -> StabilizerCode: return StabilizerCode( - stabilizers=self.stabilizers.with_only_x_tiles(), + stabilizers=self.stabilizers.with_only_z_tiles(), logicals=self.list_pure_basis_observables("Z"), ) From 481e89d79b331d26b467acf6a0b70faff9a1ebba Mon Sep 17 00:00:00 2001 From: Craig Gidney Date: Fri, 26 Jun 2026 14:15:48 -0700 Subject: [PATCH 13/13] Move windows debugging to a separate branch --- .github/workflows/ci.yml | 509 +++++++++++++++++++++++- mock.py | 26 -- src/stim/circuit/circuit_pybind_test.py | 16 - 3 files changed, 504 insertions(+), 47 deletions(-) delete mode 100644 mock.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 991de55c1..d6e41e752 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,11 +23,510 @@ on: branches: - main jobs: - test_repro: - runs-on: windows-2025 + build_dist: + runs-on: ${{ matrix.os_dist.os }} + strategy: + fail-fast: false + matrix: + os_dist: [ + {os: ubuntu-24.04, dist: cp310-manylinux_x86_64}, + {os: ubuntu-24.04, dist: cp311-manylinux_x86_64}, + {os: ubuntu-24.04, dist: cp312-manylinux_x86_64}, + {os: ubuntu-24.04, dist: cp313-manylinux_x86_64}, + {os: ubuntu-24.04, dist: cp314-manylinux_x86_64}, + + # manylinux_i686 disabled because scipy isn't prebuilt and fails to build. + # + # The actual error seen in github actions: + # + # numpy.distutils.system_info.NotFoundError: No BLAS/LAPACK + # libraries found. To build Scipy from sources, BLAS & LAPACK + # libraries need to be installed. + # + #{os: ubuntu-latest, dist: cp310-manylinux_i686}, + + # pypy manylinux builds disabled because scipy isn't prebuilt and fails to build. + # + # The actual error seen in github actions: + # + # numpy.distutils.system_info.NotFoundError: No BLAS/LAPACK + # libraries found. To build Scipy from sources, BLAS & LAPACK + # libraries need to be installed. + # + # {os: ubuntu-latest, dist: pp39-manylinux_x86_64}, + # {os: ubuntu-latest, dist: pp39-manylinux_i686}, + + # musllinux builds disabled because scipy isn't prebuilt and fails to build. + # + # The actual error seen in github actions: + # + # numpy.distutils.system_info.NotFoundError: No BLAS/LAPACK + # libraries found. To build Scipy from sources, BLAS & LAPACK + # libraries need to be installed. + # + # {os: ubuntu-latest, dist: cp310-musllinux_x86_64}, + # {os: ubuntu-latest, dist: cp310-musllinux_i686}, + + {os: macos-14, dist: cp310-macosx_x86_64, macosarch: x86_64}, + {os: macos-14, dist: cp311-macosx_x86_64, macosarch: x86_64}, + {os: macos-14, dist: cp312-macosx_x86_64, macosarch: x86_64}, + {os: macos-14, dist: cp313-macosx_x86_64, macosarch: x86_64}, + {os: macos-14, dist: cp314-macosx_x86_64, macosarch: x86_64}, + + {os: macos-14, dist: cp310-macosx_arm64, macosarch: arm64}, + {os: macos-14, dist: cp311-macosx_arm64, macosarch: arm64}, + {os: macos-14, dist: cp312-macosx_arm64, macosarch: arm64}, + {os: macos-14, dist: cp313-macosx_arm64, macosarch: arm64}, + {os: macos-14, dist: cp314-macosx_arm64, macosarch: arm64}, + + # pypy OSX builds disabled because numpy isn't prebuilt and fails to build. + # + # The actual error seen in github actions: + # + # RuntimeError: Found /usr/lib/libcblas.dylib, but that file is a + # symbolic link to the MacOS Accelerate framework, which is not + # supported by NumPy. You must configure the build to use a + # different optimized library, or disable the use of optimized + # BLAS and LAPACK by setting the environment variables + # NPY_BLAS_ORDER="" and NPY_LAPACK_ORDER="" before building NumPy. + # + # {os: macOS-10.15, dist: pp39-macosx_x86_64}, + + {os: windows-2025, dist: cp310-win_amd64}, + {os: windows-2025, dist: cp311-win_amd64}, + {os: windows-2025, dist: cp312-win_amd64}, + {os: windows-2025, dist: cp313-win_amd64}, + {os: windows-2025, dist: cp314-win_amd64}, + + # cp310-win32 disabled because numpy isn't prebuilt and fails to build. + # + # The actual error seen in github actions: + # + # CCompiler_spawn() got an unexpected keyword argument 'env' + # + # {os: windows-2025, dist: cp310-win32}, + ] + env: + CIBW_BUILD: "${{ matrix.os_dist.dist }}" + CIBW_ARCHS_MACOS: "${{ matrix.os_dist.macosarch }}" + CIBW_TEST_REQUIRES: cirq-core pytest + CIBW_TEST_COMMAND: pytest {project}/src {project}/glue/cirq && stim help + steps: + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 + - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 + - run: python dev/overwrite_dev_versions_with_date.py + - run: python -m pip install pybind11~=2.11.1 cibuildwheel~=3.3.1 setuptools wheel + - run: python -m cibuildwheel --print-build-identifiers + - run: python -m cibuildwheel --output-dir dist + - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: "dist-stim-${{ matrix.os_dist.os }}-${{ matrix.os_dist.dist }}-${{ matrix.os_dist.macosarch }}" + path: dist/* + build_sdist: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 + - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 + - run: python -m pip install setuptools pybind11~=2.11.1 + - run: python dev/overwrite_dev_versions_with_date.py + - run: mkdir output + - run: python setup.py sdist + - run: cd glue/cirq && python setup.py sdist + - run: cd glue/cirq && python setup.py bdist_wheel + - run: cd glue/sample && python setup.py sdist + - run: cd glue/sample && python setup.py bdist_wheel + - run: cd glue/stimflow && python setup.py sdist + - run: cd glue/stimflow && python setup.py bdist_wheel + - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: "dist-sinter" + path: glue/sample/dist/*.tar.gz + - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: "bdist-sinter" + path: glue/sample/dist/*.whl + - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: "dist-stimcirq" + path: glue/cirq/dist/*.tar.gz + - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: "bdist-stimcirq" + path: glue/cirq/dist/*.whl + - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: "dist-stimflow" + path: glue/stimflow/dist/*.tar.gz + - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: "bdist-stimflow" + path: glue/stimflow/dist/*.whl + - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: "dist-stim-sdist" + path: dist/*.tar.gz + check_sdist_installs_stim: + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 - - run: pip install stim~=1.17.dev pytest - - run: pytest --verbose --capture=no mock.py - - run: pytest --verbose --capture=no src + - run: python -m pip install pybind11~=2.11.1 cibuildwheel~=3.3.1 setuptools wheel + - run: python setup.py sdist + - run: pip install dist/*.tar.gz + check_sdist_installs_sinter: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 + - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 + - run: python -m pip install setuptools + - run: cd glue/sample && python setup.py sdist + - run: pip install glue/sample/dist/* + - run: python -c "import sinter" + check_sdist_installs_stimflow: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 + - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 + - run: python -m pip install setuptools + - run: cd glue/stimflow && python setup.py sdist + - run: pip install glue/stimflow/dist/* + - run: python -c "import stimflow" + merge_upload_artifacts: + needs: ["build_dist", "build_sdist"] + runs-on: ubuntu-24.04 + steps: + - name: Merge Artifacts + uses: actions/upload-artifact/merge@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4 + with: + name: dist-stim + pattern: dist-stim-* + upload_dev_release_to_pypi: + needs: ["merge_upload_artifacts"] + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-24.04 + steps: + - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + with: + name: dist-stim + path: dist-stim + - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + with: + name: dist-stimcirq + path: dist-stimcirq + - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + with: + name: dist-sinter + path: dist-sinter + - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + with: + name: dist-stimflow + path: dist-stimflow + - uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # release/v1 + with: + user: __token__ + packages_dir: dist-stim + password: ${{ secrets.pypi_token_stim }} + - uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # release/v1 + with: + user: __token__ + packages_dir: dist-stimcirq + password: ${{ secrets.pypi_token_stimcirq }} + - uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # release/v1 + with: + user: __token__ + packages_dir: dist-sinter + password: ${{ secrets.pypi_token_sinter }} + - uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # release/v1 + with: + user: __token__ + packages_dir: dist-stimflow + password: ${{ secrets.pypi_token_stimflow }} + run_main: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1 + - run: cmake . + - run: make stim -j 2 + - run: echo -e "H 0 \n CNOT 0 1 \n M 0 1" | out/stim --sample + build_bazel: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1 + - uses: bazel-contrib/setup-bazel@e403ad507104847c3539436f64a9e9eecc73eeec # 0.8.5 + with: + bazelisk-cache: true + disk-cache: ${{ github.workflow }} + repository-cache: true + bazelisk-version: 1.x + - run: bazel build :all + - run: bazel test :stim_test + build_clang_stim_test: + runs-on: 'ubuntu-24.04' + steps: + - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1 + - run: | + cd .. + git clone https://github.com/google/googletest.git -b release-1.12.1 + mkdir googletest/build && cd googletest/build + cmake .. -DBUILD_GMOCK=OFF + make + sudo make install + - uses: egor-tensin/setup-clang@ef434b41eb33a70396fb336b1bae39c76d740c3d # v1 + with: + version: latest + platform: x64 + - run: cmake . -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=c++ + - run: cmake --build . --target stim_test + build_clang_stim: + runs-on: 'ubuntu-24.04' + steps: + - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1 + - run: | + cd .. + git clone https://github.com/google/googletest.git -b release-1.12.1 + mkdir googletest/build && cd googletest/build + cmake .. -DBUILD_GMOCK=OFF + make + sudo make install + - uses: egor-tensin/setup-clang@ef434b41eb33a70396fb336b1bae39c76d740c3d # v1 + with: + version: latest + platform: x64 + - run: cmake . -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=c++ + - run: cmake --build . --target stim + build_clang_stim_perf: + runs-on: 'ubuntu-24.04' + steps: + - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1 + - run: | + cd .. + git clone https://github.com/google/googletest.git -b release-1.12.1 + mkdir googletest/build && cd googletest/build + cmake .. -DBUILD_GMOCK=OFF + make + sudo make install + - uses: egor-tensin/setup-clang@ef434b41eb33a70396fb336b1bae39c76d740c3d # v1 + with: + version: latest + platform: x64 + - run: cmake . -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=c++ + - run: cmake --build . --target stim_perf + build_lib: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1 + - run: cmake . + - run: make libstim -j 2 + - run: echo -e '#include "stim.h"\nint main(int argc,const char **argv) {return !stim::find_bool_argument("test", argc, argv);}' > test.cc + - run: g++ -std=c++20 test.cc out/libstim.a -I src + - run: ./a.out test + build_lib_install: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1 + - run: mkdir install_dir + - run: cmake . -DCMAKE_INSTALL_PREFIX=install_dir + - run: make -j 2 + - run: make install + - run: echo -e '#include "stim.h"\nint main(int argc,const char **argv) {return !stim::find_bool_argument("test", argc, argv);}' > test.cc + - run: g++ -std=c++20 test.cc install_dir/lib/libstim.a -I install_dir/include + - run: ./a.out test + - run: echo -e "H 0 \n CNOT 0 1 \n M 0 1" | install_dir/bin/stim --sample + benchmark_windows: + runs-on: windows-2025 + steps: + - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1 + - uses: microsoft/setup-msbuild@c26a08ba26249b81327e26f6ef381897b6a8754d # v1.0.2 + - run: cmake . + - run: MSBuild.exe stim_perf.vcxproj /p:Configuration=Release /p:OutDir=msbuild_out /p:O=2 + - run: msbuild_out/stim_perf.exe + benchmark: + runs-on: ubuntu-24.04 + strategy: + matrix: + simd_width: [64, 128, 256] + steps: + - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1 + - run: cmake . -DSIMD_WIDTH=${{ matrix.simd_width }} + - run: make stim_perf -j 2 + - run: out/stim_perf + test: + runs-on: ubuntu-24.04 + strategy: + matrix: + simd_width: [64, 128, 256] + steps: + - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1 + - run: | + cd .. + git clone https://github.com/google/googletest.git -b release-1.12.1 + mkdir googletest/build && cd googletest/build + cmake .. -DBUILD_GMOCK=OFF + make + sudo make install + - run: cmake . -DSIMD_WIDTH=${{ matrix.simd_width }} + - run: make stim_test -j 2 + - run: out/stim_test + test_o3: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1 + - run: | + cd .. + git clone https://github.com/google/googletest.git -b release-1.12.1 + mkdir googletest/build && cd googletest/build + cmake .. -DBUILD_GMOCK=OFF + make + sudo make install + - run: cmake . -DSIMD_WIDTH=256 + - run: make stim_test_o3 -j 2 + - run: out/stim_test_o3 + test_generated_docs_are_fresh: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 + - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 + - uses: bazel-contrib/setup-bazel@e403ad507104847c3539436f64a9e9eecc73eeec # 0.8.5 + with: + bazelisk-cache: true + disk-cache: ${{ github.workflow }} + repository-cache: true + bazelisk-version: 1.x + - uses: actions/setup-node@f1f314fca9dfce2769ece7d933488f076716723e # v1 + with: + node-version: 16.x + - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6 + with: + python-version: '3.13' + - run: bazel build :stim_dev_wheel + - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl + - run: diff <(python dev/gen_stim_api_reference.py -dev) doc/python_api_reference_vDev.md + - run: diff <(python dev/gen_stim_stub_file.py -dev) glue/python/src/stim/__init__.pyi + - run: diff <(python dev/gen_stim_stub_file.py -dev) doc/stim.pyi + - run: diff <(python -c "import stim; stim.main(command_line_args=['help', 'gates_markdown'])") doc/gates.md + - run: diff <(python -c "import stim; stim.main(command_line_args=['help', 'formats_markdown'])") doc/result_formats.md + - run: diff <(python -c "import stim; stim.main(command_line_args=['help', 'commands_markdown'])") doc/usage_command_line.md + - run: diff <(dev/gen_known_gates_for_js.sh) glue/crumble/test/generated_gate_name_list.test.js + - run: python doc/stim.pyi + - run: npm install -g rollup@3.21.2 uglify-js@3.17.4 + - run: diff <(dev/compile_crumble_into_cpp_string_file.sh) src/stim/diagram/crumble_data.cc + - run: pip install -e glue/sample + - run: diff <(python dev/gen_sinter_api_reference.py -dev) doc/sinter_api.md + - run: pip install -e glue/stimflow + - run: diff <(python glue/stimflow/tools/gen_api_reference.py -dev) glue/stimflow/doc/api.md + test_generated_file_lists_are_fresh: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 + - run: dev/regen_file_lists.sh /tmp + - run: diff /tmp/perf_files file_lists/perf_files + - run: diff /tmp/pybind_files file_lists/pybind_files + - run: diff /tmp/source_files_no_main file_lists/source_files_no_main + - run: diff /tmp/test_files file_lists/test_files + test_pybind: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 + - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 + - uses: bazel-contrib/setup-bazel@e403ad507104847c3539436f64a9e9eecc73eeec # 0.8.5 + with: + bazelisk-cache: true + disk-cache: ${{ github.workflow }} + repository-cache: true + bazelisk-version: 1.x + - run: bazel build :stim_dev_wheel + - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl + - run: pip install pytest + - run: pytest src + - run: dev/doctest_proper.py --module stim + test_stimcirq: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 + - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 + - uses: bazel-contrib/setup-bazel@e403ad507104847c3539436f64a9e9eecc73eeec # 0.8.5 + with: + bazelisk-cache: true + disk-cache: ${{ github.workflow }} + repository-cache: true + bazelisk-version: 1.x + - run: bazel build :stim_dev_wheel + - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl + - run: pip install -e glue/cirq + - run: pip install pytest + - run: pytest glue/cirq + - run: dev/doctest_proper.py --module stimcirq --import cirq sympy + test_stimflow: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 + - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 + - uses: bazel-contrib/setup-bazel@e403ad507104847c3539436f64a9e9eecc73eeec # 0.8.5 + with: + bazelisk-cache: true + disk-cache: ${{ github.workflow }} + repository-cache: true + bazelisk-version: 1.x + - run: bazel build :stim_dev_wheel + - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl + - run: pip install -e glue/stimflow + - run: pip install pytest + - run: pytest glue/stimflow + - run: dev/doctest_proper.py --module stimflow --suppress_examples_warning_for stimflow.str_svg stimflow.str_html stimflow.Viewable3dModelGLTF + test_sinter: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 + - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 + - uses: bazel-contrib/setup-bazel@e403ad507104847c3539436f64a9e9eecc73eeec # 0.8.5 + with: + bazelisk-cache: true + disk-cache: ${{ github.workflow }} + repository-cache: true + bazelisk-version: 1.x + - run: bazel build :stim_dev_wheel + - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl + - run: pip install -e glue/sample + - run: pip install pytest pymatching fusion-blossom~=0.1.4 mwpf~=0.1.5 + - run: pytest glue/sample + - run: dev/doctest_proper.py --module sinter + - run: sinter help + test_stimzx: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 + - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 + - uses: bazel-contrib/setup-bazel@e403ad507104847c3539436f64a9e9eecc73eeec # 0.8.5 + with: + bazelisk-cache: true + disk-cache: ${{ github.workflow }} + repository-cache: true + bazelisk-version: 1.x + - run: bazel build :stim_dev_wheel + - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl + - run: pip install -e glue/zx + - run: pip install pytest + - run: pytest glue/zx + - run: dev/doctest_proper.py --module stimzx + test_stimjs: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 + - uses: mymindstorm/setup-emsdk@6ab9eb1bda2574c4ddb79809fc9247783eaf9021 # v14 + with: + version: 4.0.1 + actions-cache-folder: 'emsdk-cache' + - uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4 + with: + node-version: 18.x + - run: npm install + - run: bash glue/javascript/build_wasm.sh + - run: node puppeteer_run_tests.js + test_crumble: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 + - uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3 + with: + node-version: 16 + - run: node glue/crumble/run_tests_headless.js diff --git a/mock.py b/mock.py deleted file mode 100644 index 174dd8304..000000000 --- a/mock.py +++ /dev/null @@ -1,26 +0,0 @@ -import sys - -import stim -import numpy as np - - -def test_x(): - print("TEST PROGRESSION: START", file=sys.stderr) - circuit = stim.Circuit( - """ - H 0 1 - CX 0 2 1 3 - MPP X0*X1 Y0*Y1 Z0*Z1 - """ - ) - print("TEST PROGRESSION: A", file=sys.stderr) - aa = circuit.reference_sample() - print("TEST PROGRESSION: B", file=sys.stderr) - bb = circuit.reference_sample() - print("TEST PROGRESSION: C", file=sys.stderr) - np.testing.assert_array_equal(aa, bb) - print("TEST PROGRESSION: D", file=sys.stderr) - - -if __name__ == '__main__': - test_x() diff --git a/src/stim/circuit/circuit_pybind_test.py b/src/stim/circuit/circuit_pybind_test.py index c61282f55..be2c05446 100644 --- a/src/stim/circuit/circuit_pybind_test.py +++ b/src/stim/circuit/circuit_pybind_test.py @@ -13,7 +13,6 @@ # limitations under the License. import io import pathlib -import sys import tempfile from typing import cast @@ -1498,18 +1497,14 @@ def test_num_ticks(): def test_reference_sample(): - print("TEST PROGRESSION: A", file=sys.stderr) circuit = stim.Circuit( """ H 0 CNOT 0 1 """ ) - print("TEST PROGRESSION: B", file=sys.stderr) ref = circuit.reference_sample() - print("TEST PROGRESSION: C", file=sys.stderr) assert len(ref) == 0 - print("TEST PROGRESSION: D", file=sys.stderr) circuit = stim.Circuit( """ H 0 1 @@ -1517,27 +1512,16 @@ def test_reference_sample(): MPP X0*X1 Y0*Y1 Z0*Z1 """ ) - print("TEST PROGRESSION: E", file=sys.stderr) np.testing.assert_array_equal(circuit.reference_sample(), circuit.reference_sample()) - print("TEST PROGRESSION: F", file=sys.stderr) assert np.sum(circuit.reference_sample()) % 2 == 1 - print("TEST PROGRESSION: G", file=sys.stderr) circuit.append("X", (i for i in range(0, 100, 2))) - print("TEST PROGRESSION: H", file=sys.stderr) circuit.append("M", (i for i in range(100))) - print("TEST PROGRESSION: I", file=sys.stderr) ref_sample = circuit.reference_sample(bit_packed=True) - print("TEST PROGRESSION: J", file=sys.stderr) unpacked = np.unpackbits(ref_sample, bitorder="little") - print("TEST PROGRESSION: K", file=sys.stderr) expected = circuit.reference_sample(bit_packed=False) - print("TEST PROGRESSION: L", file=sys.stderr) expected_padded = np.zeros_like(unpacked) - print("TEST PROGRESSION: M", file=sys.stderr) expected_padded[:len(expected)] = expected - print("TEST PROGRESSION: N", file=sys.stderr) np.testing.assert_array_equal(unpacked, expected_padded) - print("TEST PROGRESSION: O", file=sys.stderr) def test_max_mix_depolarization_is_allowed_in_dem_conversion_without_args():