iqm-client 33.0.0__py3-none-any.whl → 33.0.2__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.
@@ -31,7 +31,6 @@ from urllib.parse import urlparse
31
31
  from uuid import UUID
32
32
  import warnings
33
33
 
34
- from iqm.iqm_server_client.errors import ClientConfigurationError
35
34
  from iqm.iqm_server_client.models import (
36
35
  CalibrationSet,
37
36
  JobData,
@@ -48,7 +47,7 @@ import requests
48
47
 
49
48
  from exa.common.data.setting_node import SettingNode
50
49
  from exa.common.errors.station_control_errors import map_from_status_code_to_error
51
- from iqm.station_control.client.authentication import TokenManager
50
+ from iqm.station_control.client.authentication import ClientConfigurationError, TokenManager
52
51
  from iqm.station_control.client.list_models import (
53
52
  DutList,
54
53
  ListModel,
@@ -13,8 +13,8 @@
13
13
  # limitations under the License.
14
14
  """An example on using Qiskit on IQM to run a simple quantum circuit on an IQM quantum computer.
15
15
 
16
- See the Qiskit on IQM user guide for instructions:
17
- https://docs.meetiqm.com/iqm-client/user_guide_qiskit.html
16
+ See the Qiskit on IQM user guide for instructions, found in the documentation at
17
+ https://docs.meetiqm.com/iqm-client/
18
18
  """
19
19
 
20
20
  import argparse
@@ -72,7 +72,7 @@ if __name__ == "__main__":
72
72
  "--token",
73
73
  help="API token for authentication",
74
74
  # Provide the API token explicitly or set it as an environment variable
75
- # following the https://docs.meetiqm.com/iqm-client/user_guide_qiskit.html#authentication
75
+ # following the Qiskit user guide at https://docs.meetiqm.com/iqm-client/
76
76
  )
77
77
 
78
78
  args = argparser.parse_args()
@@ -12,8 +12,10 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  """This file is an example of using Qiskit on IQM to run a simple but non-trivial quantum circuit on an IQM quantum
15
- computer. See the Qiskit on IQM user guide for instructions:
16
- https://docs.meetiqm.com/iqm-client/user_guide_qiskit.html
15
+ computer.
16
+
17
+ See the Qiskit on IQM user guide for instructions, found in the documentation at
18
+ https://docs.meetiqm.com/iqm-client/
17
19
  """
18
20
 
19
21
  import argparse
iqm/qiskit_iqm/iqm_job.py CHANGED
@@ -30,7 +30,7 @@ from iqm.iqm_client import (
30
30
  from iqm.iqm_client import (
31
31
  JobStatus as IQMJobStatus,
32
32
  )
33
- from iqm.iqm_client.errors import APITimeoutError
33
+ from iqm.iqm_client.errors import APITimeoutError, CircuitExecutionError
34
34
  from iqm.qiskit_iqm.qiskit_to_iqm import MeasurementKey
35
35
  import numpy as np
36
36
  from qiskit.providers import JobStatus, JobV1
@@ -147,7 +147,7 @@ class IQMJob(JobV1):
147
147
  for s in range(shots)
148
148
  ]
149
149
 
150
- def submit(self): # noqa: ANN201
150
+ def submit(self) -> None:
151
151
  raise NotImplementedError(
152
152
  "You should never have to submit jobs by calling this method. When running circuits through "
153
153
  "RemoteIQMBackend, the submission will happen under the hood. The job instance that you get is only for "
@@ -183,10 +183,11 @@ class IQMJob(JobV1):
183
183
 
184
184
  """
185
185
  job = self._iqm_job
186
- # TODO we might want to cache these
186
+ # TODO we might want to cache these as well
187
187
  circuits, job_parameters = job.payload()
188
+
189
+ # wait for job to finish if it hasn't already
188
190
  if job.status not in IQMJobStatus.terminal_statuses():
189
- # wait for job to finish and cache the result
190
191
  status = job.wait_for_completion(timeout_secs=timeout)
191
192
  if status not in IQMJobStatus.terminal_statuses():
192
193
  msg = f"The job {job.job_id} didn't finish in {timeout} seconds."
@@ -196,9 +197,29 @@ class IQMJob(JobV1):
196
197
  msg += " Cancelled."
197
198
  raise APITimeoutError(msg)
198
199
 
199
- # retrieve the results if job completed successfully
200
- if status == IQMJobStatus.COMPLETED and (result_batch := job.result()) is not None:
201
- # now job has up-to-date information
200
+ # job has reached a terminal status, which means no status update is necessary, and we can return a Result
201
+ result_dict: dict[str, Any] = {
202
+ "backend_name": self.backend().name,
203
+ "backend_version": "",
204
+ "qobj_id": "",
205
+ "job_id": str(job.job_id),
206
+ "success": False,
207
+ "date": date.today().isoformat(),
208
+ "results": [],
209
+ # the ones below go into result._metadata
210
+ "circuits": circuits,
211
+ "parameters": job_parameters,
212
+ "timeline": job.data.timeline.copy(),
213
+ }
214
+
215
+ # try to return results if job completed successfully
216
+ if job.status == IQMJobStatus.COMPLETED:
217
+ if self._iqm_result is None:
218
+ # retrieve and cache the results
219
+ if (result_batch := job.result()) is None:
220
+ raise CircuitExecutionError(
221
+ f"No results were available for job {job.job_id} even though it is completed."
222
+ )
202
223
  # IQMBackend.run() populates IQMJob.circuit_metadata, so it may be None if this IQMJob
203
224
  # was created manually from a job_id. In that case retrieve circuit metadata from
204
225
  # the job payload which we just retrieved.
@@ -214,21 +235,7 @@ class IQMJob(JobV1):
214
235
  job_parameters.heralding_mode == HeraldingMode.NONE,
215
236
  )
216
237
 
217
- # job has reached a terminal status, which means we can return a Result
218
- result_dict: dict[str, Any] = {
219
- "backend_name": self.backend().name,
220
- "backend_version": "",
221
- "qobj_id": "",
222
- "job_id": str(job.job_id),
223
- "success": False,
224
- "date": date.today().isoformat(),
225
- "results": [],
226
- # the ones below go into result._metadata
227
- "circuits": circuits,
228
- "parameters": job_parameters,
229
- "timeline": job.data.timeline.copy(),
230
- }
231
- if self._iqm_result:
238
+ # return the results
232
239
  result_dict["success"] = True # job is successful iff it is IQMJobStatus.COMPLETED (and we got result data)
233
240
  result_dict["results"] = [
234
241
  {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iqm-client
3
- Version: 33.0.0
3
+ Version: 33.0.2
4
4
  Summary: Client library for accessing an IQM quantum computer
5
5
  Author-email: IQM Finland Oy <developers@meetiqm.com>
6
6
  License: Apache License
@@ -220,8 +220,8 @@ Requires-Dist: numpy <3.0,>=1.26.4
220
220
  Requires-Dist: packaging ==24.1
221
221
  Requires-Dist: pydantic <3.0,>=2.9.2
222
222
  Requires-Dist: requests ==2.32.3
223
- Requires-Dist: iqm-pulse
224
- Requires-Dist: iqm-station-control-client
223
+ Requires-Dist: iqm-pulse <13,>=12.7.2
224
+ Requires-Dist: iqm-station-control-client <13,>=12.0.2
225
225
  Provides-Extra: cirq
226
226
  Requires-Dist: cirq-core[contrib] ~=1.2 ; extra == 'cirq'
227
227
  Requires-Dist: ply ==3.11 ; extra == 'cirq'
@@ -250,16 +250,15 @@ adapters for `IQM's <https://www.meetiqm.com>`_ quantum computers, which allow y
250
250
  (currently only the Qiskit adapter contains IQM noise models)
251
251
  * Run quantum circuits on an IQM quantum computer
252
252
 
253
- Also includes a `CLI utility <https://docs.meetiqm.com/iqm-client/user_guide_cli.html>`_ for managing user
254
- authentication when using IQM quantum computers.
253
+ Also includes a CLI utility for managing user authentication when using IQM quantum computers.
255
254
 
256
255
  Installation
257
256
  ============
258
257
 
259
- For executing code on an IQM quantum computer, you can use for example
260
- `Qiskit on IQM <https://docs.meetiqm.com/iqm-client/user_guide_qiskit.html>`_ or
261
- `Cirq on IQM <https://docs.meetiqm.com/iqm-client/user_guide_cirq.html>`_, which can be installed as optional
262
- features of IQM Client from the Python Package Index (PyPI), e.g.:
258
+ For executing code on an IQM quantum computer, you can use for example the
259
+ Qiskit on IQM or Cirq on IQM user guides found in the documentation.
260
+ Qiskit on IQM and Cirq on IQM are optional features that can be installed alongside the base IQM Client library.
261
+ An example showing how to install from the public Python Package Index (PyPI):
263
262
 
264
263
  .. code-block:: bash
265
264
 
@@ -271,8 +270,7 @@ features of IQM Client from the Python Package Index (PyPI), e.g.:
271
270
  Python environment, you should first uninstall them with ``$ pip uninstall qiskit-iqm cirq-iqm``.
272
271
  In this case, you should also include the ``--force-reinstall`` option in the ``iqm-client`` installation command.
273
272
 
274
- The `CLI utility <https://docs.meetiqm.com/iqm-client/user_guide_cli.html>`_ for managing user authentication can also
275
- be installed as an optional feature:
273
+ The CLI utility for managing user authentication can also be installed as an optional feature:
276
274
 
277
275
  .. code-block:: bash
278
276
 
@@ -294,10 +292,15 @@ Documentation
294
292
 
295
293
  Documentation for the latest version is `available online <https://docs.meetiqm.com/iqm-client/>`_.
296
294
  You can build documentation for any older version locally by downloading the corresponding package from PyPI,
297
- and running the docs builder. For versions 20.12 and later this is done by running ``./docbuild`` in the
298
- ``iqm-client`` root directory, and for earlier versions by running ``tox run -e docs``.
295
+ and running the docs builder. For versions greater than equal to 20.12 but less than 33.0.0 this is done by
296
+ running ``./docbuild`` in the ``iqm-client`` root directory, and for earlier versions by running ``tox run -e docs``.
299
297
 
300
298
  ``./docbuild`` or ``tox run -e docs`` will build the documentation at ``./build/sphinx/html``.
299
+
300
+ Versions greater than or equal to 33.0.0 use the command:
301
+ ``sphinx-build -q -d build/.doctrees/iqm-client iqm-client/docs build/docs/iqm-client``
302
+ (``build/docs/`` directory has to be created first).
303
+
301
304
  These commands require installing the ``sphinx`` and ``sphinx-book-theme`` Python packages and
302
305
  `graphviz <https://graphviz.org/>`_.
303
306
 
@@ -26,15 +26,14 @@ iqm/iqm_client/transpile.py,sha256=ZicsOJiT5zEaaYMWuFddnJT2e4e9Oyu7B5pO8Z_ah7M,3
26
26
  iqm/iqm_client/util.py,sha256=obzh1g6PNEXOj7k3gUkiylNUhyqutbWlxlEpfyyU_fk,1505
27
27
  iqm/iqm_client/validation.py,sha256=SyshUOxmnlwb0haWEAVkgynGOYUMV7Os281sUe29tpE,12621
28
28
  iqm/iqm_server_client/__init__.py,sha256=hqfe65DmdYu5qDbYsg3Uq94DRe2zkbMJP_XFYsMbGSQ,645
29
- iqm/iqm_server_client/errors.py,sha256=I48dRY_Sies2vQzyjzQxhHm_J5RopyL5hqAmlnBy67w,192
30
- iqm/iqm_server_client/iqm_server_client.py,sha256=en2C4hZ4VzHtg07EtxpuC-cFEw2kzTi1_GzfYKk-NWY,31365
29
+ iqm/iqm_server_client/iqm_server_client.py,sha256=ROcz3sCg4smAyB1vzxAU00BxuYTf0getcz8SEc8Fx04,31325
31
30
  iqm/iqm_server_client/models.py,sha256=YpyppxEu2obSIaUvuc3_mRKcGscs8YLrcWrTk7EHKzM,5597
32
31
  iqm/iqm_server_client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
32
  iqm/qiskit_iqm/__init__.py,sha256=VPmcMV5nBOEIhVsOceIUkdZtWJ3tGlaKrDFP-FRuOCs,1667
34
33
  iqm/qiskit_iqm/iqm_backend.py,sha256=3ydSroylh_Us-5RJfOQgOkL7eqF4fWe5ejXueDTcAj8,5584
35
34
  iqm/qiskit_iqm/iqm_circuit.py,sha256=jaPo3zc5FC0vAIumh5d56fr44fDaJXXwcquBzQEy1Yg,1400
36
35
  iqm/qiskit_iqm/iqm_circuit_validation.py,sha256=SzfCJclUh1kK6Kcz5puKlCtE0hZfWxYYKF35EagU204,1750
37
- iqm/qiskit_iqm/iqm_job.py,sha256=SdyZeQi5CoGxBeJyfIvOM7DA0ONJ5tbTHpk4hajpUFk,12395
36
+ iqm/qiskit_iqm/iqm_job.py,sha256=K-gM3fWYmpVh8e7inljn17sofpyf0YMyPyENuwAzSpE,12675
38
37
  iqm/qiskit_iqm/iqm_move_layout.py,sha256=vFdba0DStu8Pebi3qxZBYOLCYC2Atl28YlSzbSGER4Y,10557
39
38
  iqm/qiskit_iqm/iqm_naive_move_pass.py,sha256=GcS2DyYWwG-qMyczXqTXxMxNqRB4IVeWNP3CzguKpBw,15639
40
39
  iqm/qiskit_iqm/iqm_provider.py,sha256=pK1CcAOQKG5jXYfjxshuVSmMLWQG1-k0cyghRmGpWN8,19273
@@ -45,8 +44,8 @@ iqm/qiskit_iqm/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
45
44
  iqm/qiskit_iqm/qiskit_to_iqm.py,sha256=imMmuOi_tuujIrGzBFnGOtxpGHcIkncXutr5QFekJl4,20677
46
45
  iqm/qiskit_iqm/transpiler_plugins.py,sha256=BrCkUFQUdi0m8K8V0ERYgtPAkvoX4VlYIJwnFKyCN9Q,8831
47
46
  iqm/qiskit_iqm/examples/__init__.py,sha256=M4ElQHCo-WxtVXK39bF3QiFT3IGXPtZ1khqexHiTBEc,20
48
- iqm/qiskit_iqm/examples/bell_measure.py,sha256=-20oihBKuK4s9rA_9fuyJBM3Du8NWZUTZ8YhI3Q4TpM,3064
49
- iqm/qiskit_iqm/examples/transpile_example.py,sha256=vGcs2OpsYTVcWyX-qzmfjio4JcIBi_Dk-hrQRGO4oGs,2401
47
+ iqm/qiskit_iqm/examples/bell_measure.py,sha256=pwSGeggb8HuUWh4SYUkbLDeZI00gxRmVw0svA_hbn-Y,3056
48
+ iqm/qiskit_iqm/examples/transpile_example.py,sha256=FNpHy6nxJgaXhgbl7_SavHRNaNMyk4lSkd_0a2GSKh4,2410
50
49
  iqm/qiskit_iqm/fake_backends/__init__.py,sha256=fkw2UHT-3aJbAKvR1WYUN7_4N5Gdwpx9bm6vlWj1tm0,874
51
50
  iqm/qiskit_iqm/fake_backends/fake_adonis.py,sha256=DWftCPu6ElE4P47Z-y3bojg0unDJ6F5ur2aDqfoY85s,2248
52
51
  iqm/qiskit_iqm/fake_backends/fake_aphrodite.py,sha256=oB5wFtZ2VYy0TxoL-eBgYnVAwamGPYlzIQK89npwQUg,15533
@@ -54,10 +53,10 @@ iqm/qiskit_iqm/fake_backends/fake_apollo.py,sha256=C05u3knnCsA8DCuWU31EwUvJ6xile
54
53
  iqm/qiskit_iqm/fake_backends/fake_deneb.py,sha256=HstlV-PSbyCttY1uEyWr-YgsMNkv9Ntf6zffav837_4,3216
55
54
  iqm/qiskit_iqm/fake_backends/fake_garnet.py,sha256=GI0xafTCj1Um09qVuccO6GPOGBm6ygul_O40Wu220Ys,5555
56
55
  iqm/qiskit_iqm/fake_backends/iqm_fake_backend.py,sha256=IfVKxlPlAVCHTgli2scRP1gkVCXIiSuL6-QjjsZp83Q,16808
57
- iqm_client-33.0.0.dist-info/AUTHORS.rst,sha256=qsxeK5A3-B_xK3hNbhFHEIkoHNpo7sdzYyRTs7Bdtm8,795
58
- iqm_client-33.0.0.dist-info/LICENSE.txt,sha256=2DXrmQtVVUV9Fc9RBFJidMiTEaQlG2oAtlC9PMrEwTk,11333
59
- iqm_client-33.0.0.dist-info/METADATA,sha256=7caTuL76eOR8Gh87dPMW9WpRecywAmFiss3E6T8Pe9Q,17290
60
- iqm_client-33.0.0.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
61
- iqm_client-33.0.0.dist-info/entry_points.txt,sha256=Kk2qfRwk8vbIJ7qCAvmaUogfRRn6t92_hBFhe6kqAE4,1317
62
- iqm_client-33.0.0.dist-info/top_level.txt,sha256=NB4XRfyDS6_wG9gMsyX-9LTU7kWnTQxNvkbzIxGv3-c,4
63
- iqm_client-33.0.0.dist-info/RECORD,,
56
+ iqm_client-33.0.2.dist-info/AUTHORS.rst,sha256=qsxeK5A3-B_xK3hNbhFHEIkoHNpo7sdzYyRTs7Bdtm8,795
57
+ iqm_client-33.0.2.dist-info/LICENSE.txt,sha256=2DXrmQtVVUV9Fc9RBFJidMiTEaQlG2oAtlC9PMrEwTk,11333
58
+ iqm_client-33.0.2.dist-info/METADATA,sha256=HTAgR7k_oF95p7vDuoIYkcW4hvfSXPiSU2wYhuCt7Q8,17435
59
+ iqm_client-33.0.2.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
60
+ iqm_client-33.0.2.dist-info/entry_points.txt,sha256=Kk2qfRwk8vbIJ7qCAvmaUogfRRn6t92_hBFhe6kqAE4,1317
61
+ iqm_client-33.0.2.dist-info/top_level.txt,sha256=NB4XRfyDS6_wG9gMsyX-9LTU7kWnTQxNvkbzIxGv3-c,4
62
+ iqm_client-33.0.2.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- class ClientAuthenticationError(RuntimeError):
2
- """Something went wrong with user authentication."""
3
-
4
-
5
- class ClientConfigurationError(RuntimeError):
6
- """Wrong configuration provided."""