iqm-client 32.1.1__py3-none-any.whl → 33.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. iqm/cirq_iqm/devices/iqm_device_metadata.py +2 -1
  2. iqm/cirq_iqm/examples/demo_common.py +1 -1
  3. iqm/cirq_iqm/examples/demo_iqm_execution.py +3 -3
  4. iqm/cirq_iqm/iqm_sampler.py +47 -29
  5. iqm/cirq_iqm/serialize.py +1 -1
  6. iqm/cirq_iqm/transpiler.py +3 -1
  7. iqm/iqm_client/__init__.py +0 -2
  8. iqm/iqm_client/errors.py +6 -17
  9. iqm/iqm_client/iqm_client.py +199 -602
  10. iqm/iqm_client/models.py +20 -611
  11. iqm/iqm_client/transpile.py +11 -8
  12. iqm/iqm_client/validation.py +18 -9
  13. iqm/iqm_server_client/__init__.py +14 -0
  14. iqm/iqm_server_client/errors.py +6 -0
  15. iqm/iqm_server_client/iqm_server_client.py +755 -0
  16. iqm/iqm_server_client/models.py +179 -0
  17. iqm/iqm_server_client/py.typed +0 -0
  18. iqm/qiskit_iqm/__init__.py +8 -0
  19. iqm/qiskit_iqm/examples/bell_measure.py +2 -2
  20. iqm/qiskit_iqm/examples/transpile_example.py +9 -4
  21. iqm/qiskit_iqm/fake_backends/fake_adonis.py +2 -1
  22. iqm/qiskit_iqm/fake_backends/fake_aphrodite.py +2 -1
  23. iqm/qiskit_iqm/fake_backends/fake_apollo.py +2 -1
  24. iqm/qiskit_iqm/fake_backends/fake_deneb.py +2 -1
  25. iqm/qiskit_iqm/fake_backends/iqm_fake_backend.py +8 -7
  26. iqm/qiskit_iqm/iqm_backend.py +3 -4
  27. iqm/qiskit_iqm/iqm_circuit_validation.py +8 -7
  28. iqm/qiskit_iqm/iqm_job.py +106 -88
  29. iqm/qiskit_iqm/iqm_move_layout.py +2 -1
  30. iqm/qiskit_iqm/iqm_naive_move_pass.py +114 -55
  31. iqm/qiskit_iqm/iqm_provider.py +49 -36
  32. iqm/qiskit_iqm/iqm_target.py +4 -6
  33. iqm/qiskit_iqm/qiskit_to_iqm.py +62 -25
  34. {iqm_client-32.1.1.dist-info → iqm_client-33.0.0.dist-info}/METADATA +4 -14
  35. iqm_client-33.0.0.dist-info/RECORD +63 -0
  36. iqm/iqm_client/api.py +0 -90
  37. iqm/iqm_client/authentication.py +0 -206
  38. iqm_client-32.1.1.dist-info/RECORD +0 -60
  39. {iqm_client-32.1.1.dist-info → iqm_client-33.0.0.dist-info}/AUTHORS.rst +0 -0
  40. {iqm_client-32.1.1.dist-info → iqm_client-33.0.0.dist-info}/LICENSE.txt +0 -0
  41. {iqm_client-32.1.1.dist-info → iqm_client-33.0.0.dist-info}/WHEEL +0 -0
  42. {iqm_client-32.1.1.dist-info → iqm_client-33.0.0.dist-info}/entry_points.txt +0 -0
  43. {iqm_client-32.1.1.dist-info → iqm_client-33.0.0.dist-info}/top_level.txt +0 -0
@@ -60,15 +60,18 @@ from __future__ import annotations
60
60
  from collections.abc import Collection, Iterable, Sequence
61
61
  from enum import Enum
62
62
 
63
- from iqm.iqm_client import (
64
- CircuitTranspilationError,
65
- CircuitValidationError,
66
- DynamicQuantumArchitecture,
67
- )
68
- from iqm.iqm_client.models import GateImplementationInfo, GateInfo, Locus, _op_is_symmetric
63
+ from iqm.iqm_client import CircuitTranspilationError, CircuitValidationError
64
+ from iqm.iqm_client.models import _op_is_symmetric
69
65
  from iqm.iqm_client.validation import validate_circuit_moves, validate_instruction
70
66
 
71
67
  from iqm.pulse import Circuit, CircuitOperation
68
+ from iqm.station_control.interface.models import (
69
+ DynamicQuantumArchitecture,
70
+ GateImplementationInfo,
71
+ GateInfo,
72
+ Locus,
73
+ QubitMapping,
74
+ )
72
75
 
73
76
  Resolution = tuple[str, str, str]
74
77
  """A (gate qubit, move qubit, resonator) triple that represents a resolution of a fictional
@@ -94,7 +97,7 @@ class ExistingMoveHandlingOptions(str, Enum):
94
97
 
95
98
  def _map_loci(
96
99
  instructions: Iterable[CircuitOperation],
97
- qubit_mapping: dict[str, str],
100
+ qubit_mapping: QubitMapping,
98
101
  inverse: bool = False,
99
102
  ) -> tuple[CircuitOperation, ...]:
100
103
  """Map the loci of the given instructions using the given qubit mapping, or its inverse.
@@ -733,7 +736,7 @@ def transpile_insert_moves(
733
736
  arch: DynamicQuantumArchitecture,
734
737
  *,
735
738
  existing_moves: ExistingMoveHandlingOptions = ExistingMoveHandlingOptions.KEEP,
736
- qubit_mapping: dict[str, str] | None = None,
739
+ qubit_mapping: QubitMapping | None = None,
737
740
  restore_states: bool = True,
738
741
  ) -> Circuit:
739
742
  """Convert a simplified architecture circuit into an equivalent Star architecture circuit with
@@ -11,21 +11,23 @@ from collections.abc import Iterable
11
11
  import itertools
12
12
 
13
13
  from iqm.iqm_client.errors import CircuitValidationError
14
- from iqm.iqm_client.models import (
15
- _SUPPORTED_OPERATIONS,
14
+ from iqm.iqm_client.models import _SUPPORTED_OPERATIONS
15
+
16
+ from iqm.pulse import Circuit, CircuitOperation
17
+ from iqm.station_control.interface.models import (
16
18
  CircuitBatch,
17
19
  DynamicQuantumArchitecture,
18
20
  MoveGateValidationMode,
19
21
  QIRCode,
22
+ QubitMapping,
20
23
  )
21
-
22
- from iqm.pulse import Circuit, CircuitOperation
24
+ from iqm.station_control.interface.models.circuit import _Circuit
23
25
 
24
26
 
25
27
  def validate_qubit_mapping(
26
28
  architecture: DynamicQuantumArchitecture,
27
29
  circuits: CircuitBatch,
28
- qubit_mapping: dict[str, str] | None = None,
30
+ qubit_mapping: QubitMapping | None = None,
29
31
  ) -> None:
30
32
  """Validate the given qubit mapping.
31
33
 
@@ -50,8 +52,12 @@ def validate_qubit_mapping(
50
52
 
51
53
  # check if qubit mapping covers all qubits in the circuits
52
54
  for i, circuit in enumerate(circuits):
53
- if isinstance(circuit, (QIRCode)):
55
+ if isinstance(circuit, _Circuit):
56
+ raise CircuitValidationError(f"Circuit {i}: obsolete circuit type.")
57
+ if isinstance(circuit, QIRCode):
58
+ # do not validate
54
59
  continue
60
+
55
61
  diff = circuit.all_locus_components() - set(qubit_mapping)
56
62
  if diff:
57
63
  raise CircuitValidationError(
@@ -68,7 +74,7 @@ def validate_qubit_mapping(
68
74
  def validate_circuit_instructions(
69
75
  architecture: DynamicQuantumArchitecture,
70
76
  circuits: CircuitBatch,
71
- qubit_mapping: dict[str, str] | None = None,
77
+ qubit_mapping: QubitMapping | None = None,
72
78
  validate_moves: MoveGateValidationMode = MoveGateValidationMode.STRICT,
73
79
  *,
74
80
  must_close_sandwiches: bool = True,
@@ -89,7 +95,10 @@ def validate_circuit_instructions(
89
95
 
90
96
  """
91
97
  for index, circuit in enumerate(circuits):
98
+ if isinstance(circuit, _Circuit):
99
+ raise CircuitValidationError(f"Circuit {index}: obsolete circuit type.")
92
100
  if isinstance(circuit, QIRCode):
101
+ # do not validate
93
102
  continue
94
103
 
95
104
  measurement_keys: set[str] = set()
@@ -113,7 +122,7 @@ def validate_circuit_instructions(
113
122
  def validate_instruction(
114
123
  architecture: DynamicQuantumArchitecture,
115
124
  instruction: CircuitOperation,
116
- qubit_mapping: dict[str, str] | None = None,
125
+ qubit_mapping: QubitMapping | None = None,
117
126
  ) -> None:
118
127
  """Validate an instruction against the dynamic quantum architecture.
119
128
 
@@ -200,7 +209,7 @@ def validate_instruction(
200
209
  def validate_circuit_moves( # noqa: PLR0912
201
210
  architecture: DynamicQuantumArchitecture,
202
211
  circuit: Circuit,
203
- qubit_mapping: dict[str, str] | None = None,
212
+ qubit_mapping: QubitMapping | None = None,
204
213
  validate_moves: MoveGateValidationMode = MoveGateValidationMode.STRICT,
205
214
  *,
206
215
  must_close_sandwiches: bool = True,
@@ -0,0 +1,14 @@
1
+ # Copyright 2025 IQM client developers
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """Client-side library for connecting to IQM Server API."""
@@ -0,0 +1,6 @@
1
+ class ClientAuthenticationError(RuntimeError):
2
+ """Something went wrong with user authentication."""
3
+
4
+
5
+ class ClientConfigurationError(RuntimeError):
6
+ """Wrong configuration provided."""