From f0f95abab409e663624c253f13f98b280aafd42d Mon Sep 17 00:00:00 2001 From: Thierry Martinez Date: Wed, 23 Sep 2026 14:22:18 +0200 Subject: [PATCH 1/3] Fix for TeamGraphix/graphix#608: Ensure consistency for instruction qubits `CZ` is now a `ControlledSingleTargetInstruction` and takes a control and a target instead of a pair of targets. --- graphix_qasm_parser/parser.py | 2 +- pyproject.toml | 3 ++- tests/test_parser.py | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/graphix_qasm_parser/parser.py b/graphix_qasm_parser/parser.py index f873c05..814ea28 100644 --- a/graphix_qasm_parser/parser.py +++ b/graphix_qasm_parser/parser.py @@ -387,7 +387,7 @@ def _u3( "cz": # https://openqasm.com/language/standard_library.html#cz _Gate( qubit_count=2, - instructions=(Instruction.CZ(targets=(0, 1)),), + instructions=(Instruction.CZ(control=0, target=1),), ), "swap": # https://openqasm.com/language/standard_library.html#swap _Gate( diff --git a/pyproject.toml b/pyproject.toml index 3672d82..5ce4ae3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,4 +86,5 @@ reportUnknownLambdaType = "information" # reportUnknownVariableType = "information" [tool.uv.sources] -graphix = { git = "https://github.com/TeamGraphix/graphix.git" } +# TeamGraphix/graphix#608: Ensure consistency for instruction qubits +graphix = { git = "https://github.com/TeamGraphix/graphix.git", branch = "refs/pull/608/head" } diff --git a/tests/test_parser.py b/tests/test_parser.py index fa8d521..d0e5594 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -93,7 +93,8 @@ def test_parse_all_instructions() -> None: # noqa: PLR0915 assert instruction.control == 0 instruction = next(iterator) assert isinstance(instruction, Instruction.CZ) - assert instruction.targets == (0, 1) + assert instruction.target == 1 + assert instruction.control == 0 instruction = next(iterator) assert isinstance(instruction, Instruction.SWAP) assert instruction.targets == (0, 1) From 68489f5cc478ff60394841e0592c27fff7efe04a Mon Sep 17 00:00:00 2001 From: Thierry Martinez Date: Fri, 23 Oct 2026 23:23:35 +0200 Subject: [PATCH 2/3] Replace branch by rev --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5ce4ae3..6fd0134 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,4 +87,4 @@ reportUnknownLambdaType = "information" [tool.uv.sources] # TeamGraphix/graphix#608: Ensure consistency for instruction qubits -graphix = { git = "https://github.com/TeamGraphix/graphix.git", branch = "refs/pull/608/head" } +graphix = { git = "https://github.com/TeamGraphix/graphix.git", rev = "refs/pull/608/head" } From ac346df66a78916bf510d26f7aef2757b53d84f6 Mon Sep 17 00:00:00 2001 From: Thierry Martinez Date: Sat, 24 Oct 2026 12:27:00 +0200 Subject: [PATCH 3/3] Use graphix master --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6fd0134..3672d82 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,5 +86,4 @@ reportUnknownLambdaType = "information" # reportUnknownVariableType = "information" [tool.uv.sources] -# TeamGraphix/graphix#608: Ensure consistency for instruction qubits -graphix = { git = "https://github.com/TeamGraphix/graphix.git", rev = "refs/pull/608/head" } +graphix = { git = "https://github.com/TeamGraphix/graphix.git" }