iqm-client 31.8.0__tar.gz → 32.0.0__tar.gz

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 (109) hide show
  1. {iqm_client-31.8.0 → iqm_client-32.0.0}/CHANGELOG.rst +9 -0
  2. {iqm_client-31.8.0 → iqm_client-32.0.0}/INTEGRATION_GUIDE.rst +3 -16
  3. {iqm_client-31.8.0 → iqm_client-32.0.0}/PKG-INFO +1 -1
  4. {iqm_client-31.8.0 → iqm_client-32.0.0}/docs/index.rst +0 -3
  5. {iqm_client-31.8.0 → iqm_client-32.0.0}/docs/user_guide_cirq.rst +2 -13
  6. {iqm_client-31.8.0 → iqm_client-32.0.0}/docs/user_guide_qiskit.rst +14 -45
  7. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/iqm_client/authentication.py +0 -3
  8. iqm_client-31.8.0/src/iqm/qiskit_iqm/examples/resonance_example.py → iqm_client-32.0.0/src/iqm/qiskit_iqm/examples/bell_measure.py +23 -26
  9. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm_client.egg-info/PKG-INFO +1 -1
  10. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm_client.egg-info/SOURCES.txt +0 -7
  11. iqm_client-32.0.0/version.txt +1 -0
  12. iqm_client-31.8.0/docs/user_guide_cli.rst +0 -137
  13. iqm_client-31.8.0/src/iqm/iqm_client/cli/__init__.py +0 -14
  14. iqm_client-31.8.0/src/iqm/iqm_client/cli/auth.py +0 -168
  15. iqm_client-31.8.0/src/iqm/iqm_client/cli/cli.py +0 -798
  16. iqm_client-31.8.0/src/iqm/iqm_client/cli/models.py +0 -40
  17. iqm_client-31.8.0/src/iqm/iqm_client/cli/token_manager.py +0 -196
  18. iqm_client-31.8.0/src/iqm/qiskit_iqm/examples/bell_measure.py +0 -55
  19. iqm_client-31.8.0/version.txt +0 -1
  20. {iqm_client-31.8.0 → iqm_client-32.0.0}/AUTHORS.rst +0 -0
  21. {iqm_client-31.8.0 → iqm_client-32.0.0}/CHANGELOG_cirq-iqm.rst +0 -0
  22. {iqm_client-31.8.0 → iqm_client-32.0.0}/CHANGELOG_cortex-cli.rst +0 -0
  23. {iqm_client-31.8.0 → iqm_client-32.0.0}/CHANGELOG_qiskit-iqm.rst +0 -0
  24. {iqm_client-31.8.0 → iqm_client-32.0.0}/LICENSE.txt +0 -0
  25. {iqm_client-31.8.0 → iqm_client-32.0.0}/MANIFEST.in +0 -0
  26. {iqm_client-31.8.0 → iqm_client-32.0.0}/README.rst +0 -0
  27. {iqm_client-31.8.0 → iqm_client-32.0.0}/docbuild +0 -0
  28. {iqm_client-31.8.0 → iqm_client-32.0.0}/docs/API.rst +0 -0
  29. {iqm_client-31.8.0 → iqm_client-32.0.0}/docs/_static/images/favicon.ico +0 -0
  30. {iqm_client-31.8.0 → iqm_client-32.0.0}/docs/_static/images/logo.png +0 -0
  31. {iqm_client-31.8.0 → iqm_client-32.0.0}/docs/_templates/autosummary-class-template.rst +0 -0
  32. {iqm_client-31.8.0 → iqm_client-32.0.0}/docs/_templates/autosummary-module-template.rst +0 -0
  33. {iqm_client-31.8.0 → iqm_client-32.0.0}/docs/authors.rst +0 -0
  34. {iqm_client-31.8.0 → iqm_client-32.0.0}/docs/changelog.rst +0 -0
  35. {iqm_client-31.8.0 → iqm_client-32.0.0}/docs/conf.py +0 -0
  36. {iqm_client-31.8.0 → iqm_client-32.0.0}/docs/integration_guide.rst +0 -0
  37. {iqm_client-31.8.0 → iqm_client-32.0.0}/docs/license.rst +0 -0
  38. {iqm_client-31.8.0 → iqm_client-32.0.0}/docs/readme.rst +0 -0
  39. {iqm_client-31.8.0 → iqm_client-32.0.0}/pyproject.toml +0 -0
  40. {iqm_client-31.8.0 → iqm_client-32.0.0}/pytest.ini +0 -0
  41. {iqm_client-31.8.0 → iqm_client-32.0.0}/requirements/base.in +0 -0
  42. {iqm_client-31.8.0 → iqm_client-32.0.0}/requirements/base.in.internal +0 -0
  43. {iqm_client-31.8.0 → iqm_client-32.0.0}/requirements/base.txt +0 -0
  44. {iqm_client-31.8.0 → iqm_client-32.0.0}/requirements/cirq.in +0 -0
  45. {iqm_client-31.8.0 → iqm_client-32.0.0}/requirements/cirq.txt +0 -0
  46. {iqm_client-31.8.0 → iqm_client-32.0.0}/requirements/cli.in +0 -0
  47. {iqm_client-31.8.0 → iqm_client-32.0.0}/requirements/cli.txt +0 -0
  48. {iqm_client-31.8.0 → iqm_client-32.0.0}/requirements/qiskit.in +0 -0
  49. {iqm_client-31.8.0 → iqm_client-32.0.0}/requirements/qiskit.txt +0 -0
  50. {iqm_client-31.8.0 → iqm_client-32.0.0}/setup.cfg +0 -0
  51. {iqm_client-31.8.0 → iqm_client-32.0.0}/setup.py +0 -0
  52. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/cirq_iqm/__init__.py +0 -0
  53. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/cirq_iqm/devices/__init__.py +0 -0
  54. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/cirq_iqm/devices/adonis.py +0 -0
  55. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/cirq_iqm/devices/aphrodite.py +0 -0
  56. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/cirq_iqm/devices/apollo.py +0 -0
  57. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/cirq_iqm/devices/iqm_device.py +0 -0
  58. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/cirq_iqm/devices/iqm_device_metadata.py +0 -0
  59. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/cirq_iqm/examples/demo_adonis.py +0 -0
  60. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/cirq_iqm/examples/demo_apollo.py +0 -0
  61. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/cirq_iqm/examples/demo_common.py +0 -0
  62. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/cirq_iqm/examples/demo_iqm_execution.py +0 -0
  63. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/cirq_iqm/examples/usage.ipynb +0 -0
  64. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/cirq_iqm/extended_qasm_parser.py +0 -0
  65. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/cirq_iqm/iqm_gates.py +0 -0
  66. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/cirq_iqm/iqm_sampler.py +0 -0
  67. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/cirq_iqm/optimizers.py +0 -0
  68. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/cirq_iqm/py.typed +0 -0
  69. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/cirq_iqm/serialize.py +0 -0
  70. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/cirq_iqm/transpiler.py +0 -0
  71. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/iqm_client/__init__.py +0 -0
  72. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/iqm_client/api.py +0 -0
  73. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/iqm_client/errors.py +0 -0
  74. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/iqm_client/iqm_client.py +0 -0
  75. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/iqm_client/models.py +0 -0
  76. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/iqm_client/py.typed +0 -0
  77. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/iqm_client/transpile.py +0 -0
  78. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/iqm_client/util.py +0 -0
  79. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/iqm_client/validation.py +0 -0
  80. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/qiskit_iqm/__init__.py +0 -0
  81. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/qiskit_iqm/examples/__init__.py +0 -0
  82. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/qiskit_iqm/examples/transpile_example.py +0 -0
  83. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/qiskit_iqm/fake_backends/__init__.py +0 -0
  84. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/qiskit_iqm/fake_backends/fake_adonis.py +0 -0
  85. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/qiskit_iqm/fake_backends/fake_aphrodite.py +0 -0
  86. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/qiskit_iqm/fake_backends/fake_apollo.py +0 -0
  87. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/qiskit_iqm/fake_backends/fake_deneb.py +0 -0
  88. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/qiskit_iqm/fake_backends/fake_garnet.py +0 -0
  89. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/qiskit_iqm/fake_backends/iqm_fake_backend.py +0 -0
  90. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/qiskit_iqm/iqm_backend.py +0 -0
  91. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/qiskit_iqm/iqm_circuit.py +0 -0
  92. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/qiskit_iqm/iqm_circuit_validation.py +0 -0
  93. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/qiskit_iqm/iqm_job.py +0 -0
  94. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/qiskit_iqm/iqm_move_layout.py +0 -0
  95. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/qiskit_iqm/iqm_naive_move_pass.py +0 -0
  96. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/qiskit_iqm/iqm_provider.py +0 -0
  97. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/qiskit_iqm/iqm_target.py +0 -0
  98. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/qiskit_iqm/iqm_transpilation.py +0 -0
  99. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/qiskit_iqm/move_gate.py +0 -0
  100. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/qiskit_iqm/py.typed +0 -0
  101. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/qiskit_iqm/qiskit_to_iqm.py +0 -0
  102. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm/qiskit_iqm/transpiler_plugins.py +0 -0
  103. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm_client.egg-info/dependency_links.txt +0 -0
  104. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm_client.egg-info/entry_points.txt +0 -0
  105. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm_client.egg-info/requires.txt +0 -0
  106. {iqm_client-31.8.0 → iqm_client-32.0.0}/src/iqm_client.egg-info/top_level.txt +0 -0
  107. {iqm_client-31.8.0 → iqm_client-32.0.0}/test +0 -0
  108. {iqm_client-31.8.0 → iqm_client-32.0.0}/tests/__init__.py +0 -0
  109. {iqm_client-31.8.0 → iqm_client-32.0.0}/tests/conftest.py +0 -0
@@ -2,6 +2,15 @@
2
2
  Changelog
3
3
  =========
4
4
 
5
+ Version 32.0.0 (2025-10-09)
6
+ ===========================
7
+
8
+ Breaking changes
9
+ ----------------
10
+
11
+ - Remove the Cortex CLI authentication utility. See the updated user guides.
12
+ - Remove :mod:`iqm.qiskit_iqm.examples.resonance_example`.
13
+
5
14
  Version 31.8.0 (2025-10-06)
6
15
  ===========================
7
16
 
@@ -100,22 +100,9 @@ Authentication
100
100
  --------------
101
101
 
102
102
  IQM uses bearer token authentication to manage access to quantum computers.
103
- Currently, there are three mutually exclusive ways of providing an authentication
104
- token to IQM client:
105
-
106
- 1. The recommended way is to use :ref:`IQM Client CLI <User guide CLI>`
107
- to manage the authentication tokens and store them into a file. IQM client can then read
108
- the token from the file and use it for authentication. The file path can be provided to
109
- IQM client in environment variable :envvar:`IQM_TOKENS_FILE`.
110
- Alternatively, the tokens file path can be provided as argument ``tokens_file`` to
111
- :class:`.IQMClient` constructor.
112
-
113
- 2. It is also possible to use plaintext token obtained from a server dashboard. These
114
- tokens may have longer lifespan than access tokens generated by IQM Client CLI, and thus
115
- IQM client won't attempt to refresh them. The generated token can be provided to IQM
116
- client in environment variable :envvar:`IQM_TOKEN`.
117
- Alternatively, the token can be provided as argument ``token`` to :class:`.IQMClient`
118
- constructor.
103
+ Get your personal token from the web dashboard. The generated token can be provided to IQM
104
+ client via an environment variable :envvar:`IQM_TOKEN`.
105
+ Alternatively, the token can be provided as argument ``token`` to :class:`.IQMClient` constructor.
119
106
 
120
107
  Circuit transpilation
121
108
  ---------------------
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iqm-client
3
- Version: 31.8.0
3
+ Version: 32.0.0
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
@@ -10,8 +10,6 @@ Includes `Qiskit <https://qiskit.org/>`_ and `Cirq <https://quantumai.google/cir
10
10
  `IQM's <https://www.meetiqm.com>`_ quantum computers. See user guides for :ref:`Qiskit <User guide Qiskit>` and
11
11
  :ref:`Cirq <User guide Cirq>` for introductions on how to install and use the adapters.
12
12
 
13
- Also includes a :ref:`CLI utility <User guide CLI>` for managing user authentication when using IQM quantum computers.
14
-
15
13
  Contents
16
14
  ========
17
15
 
@@ -21,7 +19,6 @@ Contents
21
19
  readme
22
20
  API
23
21
  integration_guide
24
- user_guide_cli
25
22
  user_guide_qiskit
26
23
  user_guide_cirq
27
24
  license
@@ -435,23 +435,12 @@ as explained in the :ref:`routing` section above.
435
435
  Authentication
436
436
  ^^^^^^^^^^^^^^
437
437
 
438
- IQM Resonance
439
- """""""""""""
438
+ There are two options to authenticate:
440
439
 
441
- If you are using IQM Resonance, you have two options to authenticate:
442
-
443
- 1. Set the :envvar:`IQM_TOKEN` environment variable with the API token obtained from the Resonance dashboard.
440
+ 1. Set the :envvar:`IQM_TOKEN` environment variable with the API token obtained from the web dashboard.
444
441
  2. Pass the ``token`` parameter to :class:`.IQMSampler`. This will be forwarded to
445
442
  :class:`~iqm.iqm_client.iqm_client.IQMClient`.
446
443
 
447
- On-premises devices
448
- """""""""""""""""""
449
-
450
- If the IQM server you are connecting to requires authentication, you may use
451
- :ref:`IQM Client CLI <User guide CLI>` to retrieve and automatically refresh access tokens,
452
- then set the :envvar:`IQM_TOKENS_FILE` environment variable, as instructed, to point to the tokens file.
453
- See IQM Client CLI's `documentation <https://docs.meetiqm.com/iqm-client/user_guide_cli.html>`__ for details.
454
-
455
444
  Batch execution
456
445
  ^^^^^^^^^^^^^^^
457
446
 
@@ -16,26 +16,22 @@ Hello, world!
16
16
  -------------
17
17
 
18
18
  Here's a quick and easy way to run a small computation on an IQM quantum computer to check that
19
- things are set up correctly, either
20
- through the IQM cloud service Resonance, or using an on-premises quantum computer.
19
+ things are set up correctly.
21
20
 
22
- IQM Resonance
23
- ~~~~~~~~~~~~~
24
-
25
- 1. Login to `IQM Resonance <https://resonance.meetiqm.com>`_ with your credentials.
26
- 2. Upon your first visit to IQM Resonance, you can generate your unique, non-recoverable API token
21
+ 1. Login to the web dashboard with your credentials. If you're using the IQM Resonance cloud service, go to
22
+ `IQM Resonance <https://resonance.meetiqm.com>`_.
23
+ 2. Upon your first visit, you can generate your unique, non-recoverable API token
27
24
  directly from the Dashboard page by selecting ``Generate token``. It's important to copy the token
28
25
  immediately from the window, as you won't be able to do so once the window is closed. If you lose
29
26
  your token, you have the option to regenerate it at any time. However, be aware that regenerating
30
27
  your API token will invalidate any previously generated token.
31
- 3. Download one of the demo notebooks from `IQM Academy <https://www.iqmacademy.com/tutorials/>`_ or the
32
- `resonance_example.py example file <https://raw.githubusercontent.com/iqm-finland/sdk/refs/heads/main/iqm_client/src/iqm/qiskit_iqm/examples/resonance_example.py>`_
28
+ 3. Store your API token in the environment variable :envvar:`IQM_TOKEN`.
29
+ 4. Download one of the demo notebooks from `IQM Academy <https://www.iqmacademy.com/tutorials/>`_ or the
30
+ `bell_measure.py example file <https://raw.githubusercontent.com/iqm-finland/sdk/refs/heads/main/iqm_client/src/iqm/qiskit_iqm/examples/bell_measure.py>`_
33
31
  (Save Page As...)
34
- 4. Install Qiskit on IQM as instructed below.
35
- 5. Add your API token to the example (either as the parameter ``token`` to the :class:`.IQMProvider`
36
- constructor, or by setting the environment variable :envvar:`IQM_TOKEN`)
32
+ 5. Install Qiskit on IQM as instructed below.
37
33
  6. Run the Jupyter notebook (or run
38
- ``python resonance_example.py --url https://cocos.resonance.meetiqm.com/<RESONANCE QC NAME>``
34
+ ``python bell_measure.py --url https://<IQM server URL>``
39
35
  if you decided to go for the Python script).
40
36
  7. If you're connecting to a real quantum computer, the output should show almost half of the
41
37
  measurements resulting in '00000' and almost half in '11111' - if this is the case, things are
@@ -45,20 +41,6 @@ You can find a video guide on how to set things up `here <https://www.iqmacademy
45
41
  More ready-to-run examples can also be found at `IQM Academy <https://www.iqmacademy.com/tutorials/>`_.
46
42
 
47
43
 
48
- On-premises device
49
- ~~~~~~~~~~~~~~~~~~
50
-
51
- 1. Download the `bell_measure.py example file <https://raw.githubusercontent.com/iqm-finland/sdk/refs/heads/main/iqm_client/src/iqm/qiskit_iqm/examples/bell_measure.py>`_ (Save Page As...).
52
- 2. Install Qiskit on IQM as instructed below.
53
- 3. Install IQM Client CLI and log in as instructed in the
54
- `documentation <https://docs.meetiqm.com/iqm-client/user_guide_cli.html#installing-iqm-client-cli>`__
55
- 4. Set the environment variable as instructed by IQM Client CLI after logging in.
56
- 5. Run ``$ python bell_measure.py --url https://<YOUR IQM SERVER>`` - replace the example URL with the correct one.
57
- 6. If you're connecting to a real quantum computer, the output should show almost half of the
58
- measurements resulting in '00' and almost half in '11' - if this is the case, things are set up
59
- correctly!
60
-
61
-
62
44
  Installation
63
45
  ------------
64
46
 
@@ -86,25 +68,13 @@ After installation, Qiskit on IQM can be imported in your Python code as follows
86
68
  Authentication
87
69
  --------------
88
70
 
89
- IQM Resonance
90
- ~~~~~~~~~~~~~
71
+ There are two options to authenticate:
91
72
 
92
- If you are using IQM Resonance, you have two options to authenticate:
93
-
94
- 1. Set the :envvar:`IQM_TOKEN` environment variable to the API token obtained from the Resonance dashboard.
73
+ 1. Set the :envvar:`IQM_TOKEN` environment variable to the API token obtained from the web dashboard.
95
74
  2. Pass the ``token`` parameter to :class:`.IQMProvider`. This will be forwarded to
96
- :class:`~iqm.iqm_client.iqm_client.IQMClient`. For an example, see the `resonance_example.py file
97
- <https://raw.githubusercontent.com/iqm-finland/sdk/refs/heads/main/iqm_client/src/iqm/qiskit_iqm/examples/resonance_example.py>`_
98
-
99
- On-premises devices
100
- ~~~~~~~~~~~~~~~~~~~
101
-
102
- If the IQM server you are connecting to requires authentication, you may use
103
- :ref:`IQM Client CLI <User guide CLI>` to retrieve and automatically refresh access tokens,
104
- then set the :envvar:`IQM_TOKENS_FILE` environment variable, as instructed, to point to the tokens file.
105
- See IQM Client CLI's `documentation <https://docs.meetiqm.com/iqm-client/user_guide_cli.html>`__ for details.
75
+ :class:`~iqm.iqm_client.iqm_client.IQMClient`. For an example, see
76
+ `bell_measure.py <https://raw.githubusercontent.com/iqm-finland/sdk/refs/heads/main/iqm_client/src/iqm/qiskit_iqm/examples/bell_measure.py>`_
106
77
 
107
- You may also authenticate yourself by setting the access token in the the :envvar:`IQM_TOKEN` variable
108
78
 
109
79
  Running quantum circuits on an IQM quantum computer
110
80
  ---------------------------------------------------
@@ -180,10 +150,9 @@ circuit(s) are sampled:
180
150
 
181
151
  As of ``iqm-client >= 30.1.0``, structured quality metrics and calibration data are available to
182
152
  ``IQMTarget`` for improved transpilation. To import the latest valid quality metric data corresponding
183
- to the default calibration set into ``IQMTarget``, set ``use_metrics`` to ``True`` when initializing the
153
+ to the default calibration set into ``IQMTarget``, set ``use_metrics`` to ``True`` when initializing the
184
154
  class. For Resonance users, this data is not yet available via the Resonance API, so use the default setting
185
155
  of ``use_metrics`` of ``False``.
186
-
187
156
 
188
157
  You can optionally provide IQMBackend specific options as additional keyword arguments to
189
158
  :meth:`.IQMBackend.run`, documented at :meth:`.IQMBackend.create_run_request`.
@@ -22,9 +22,6 @@ from typing import Any
22
22
 
23
23
  from iqm.iqm_client.errors import ClientAuthenticationError, ClientConfigurationError
24
24
 
25
- AUTH_CLIENT_ID = "iqm_client"
26
- AUTH_REALM = "cortex"
27
- AUTH_REQUESTS_TIMEOUT = float(os.environ.get("IQM_CLIENT_REQUESTS_TIMEOUT", 60.0))
28
25
  REFRESH_MARGIN_SECONDS = 60
29
26
 
30
27
 
@@ -1,4 +1,4 @@
1
- # Copyright 2024 Qiskit on IQM developers
1
+ # Copyright 2023 Qiskit on IQM developers
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -11,44 +11,45 @@
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
- """This file is an example of using Qiskit on IQM to run a simple but non-trivial quantum circuit on
15
- Resonance, the IQM quantum cloud service.
14
+ """An example on using Qiskit on IQM to run a simple quantum circuit on an IQM quantum computer.
15
+
16
16
  See the Qiskit on IQM user guide for instructions:
17
17
  https://docs.meetiqm.com/iqm-client/user_guide_qiskit.html
18
18
  """
19
19
 
20
20
  import argparse
21
21
 
22
- from iqm.qiskit_iqm import IQMProvider
22
+ from iqm.qiskit_iqm.iqm_provider import IQMProvider
23
23
  from qiskit import QuantumCircuit, transpile
24
24
 
25
25
 
26
- def resonance_example(server_url: str, api_token: str | None) -> dict[str, int]:
27
- """Run a circuit via IQM Resonance.
26
+ def bell_measure(server_url: str, token: str | None = None, shots: int = 1000) -> dict[str, int]:
27
+ """Execute a quantum circuit that prepares and measures a generalized Bell (aka GHZ) state.
28
28
 
29
29
  Args:
30
- server_url: URL of the IQM Resonance QC used for execution
31
- api_token: IQM Resonance API token for authentication
30
+ server_url: URL of the IQM server used for execution
31
+ token: API token for authentication. If not given, uses :env:`IQM_TOKEN`.
32
+ shots: Requested number of shots.
32
33
 
33
34
  Returns:
34
- a mapping of bitstrings representing qubit measurement results to counts for each result
35
+ Mapping of bitstrings representing qubit measurement results to counts for each result.
35
36
 
36
37
  """
37
- SHOTS = 1000
38
-
38
+ print(f"Executing a circuit on {server_url}")
39
39
  # Initialize a backend without metrics as IQMClient._get_calibration_quality_metrics is not supported by resonance
40
- backend = IQMProvider(server_url, token=api_token).get_backend()
40
+ backend = IQMProvider(server_url, token=token).get_backend()
41
+ if backend.num_qubits < 2:
42
+ raise ValueError("We need two qubits for the Bell state.")
41
43
 
42
44
  # Just to make sure that "get_static_quantum_architecture" method works
43
45
  static_quantum_architecture = backend.client.get_static_quantum_architecture()
44
46
  print(f"static_quantum_architecture={static_quantum_architecture}")
45
47
 
46
- # Define a quantum circuit
47
- num_qb = min(backend.num_qubits, 5) # use at most 5 qubits
48
- qc = QuantumCircuit(num_qb)
49
-
48
+ # Define a quantum circuit for a GHZ state
49
+ n_qubits = min(backend.num_qubits, 5) # use at most 5 qubits
50
+ qc = QuantumCircuit(n_qubits)
50
51
  qc.h(0)
51
- for qb in range(1, num_qb):
52
+ for qb in range(1, n_qubits):
52
53
  qc.cx(0, qb)
53
54
  qc.barrier()
54
55
  qc.measure_all()
@@ -58,26 +59,22 @@ def resonance_example(server_url: str, api_token: str | None) -> dict[str, int]:
58
59
  print(qc_transpiled.draw(output="text"))
59
60
 
60
61
  # Run the circuit
61
- job = backend.run(qc_transpiled, shots=SHOTS)
62
+ job = backend.run(qc_transpiled, shots=shots)
62
63
  return job.result().get_counts()
63
64
 
64
65
 
65
66
  if __name__ == "__main__":
66
67
  argparser = argparse.ArgumentParser()
67
68
  argparser.add_argument(
68
- "--url",
69
- help="URL of the IQM Resonance QC",
70
- # For example https://cocos.resonance.meetiqm.com/garnet
71
- default="https://cocos.resonance.meetiqm.com/<RESONANCE QC NAME>",
69
+ "--url", required=True, help='IQM server URL, for example "https://cocos.resonance.meetiqm.com/garnet"'
72
70
  )
73
71
  argparser.add_argument(
74
72
  "--token",
75
- help="IQM Resonance access token",
73
+ help="API token for authentication",
76
74
  # Provide the API token explicitly or set it as an environment variable
77
75
  # following the https://docs.meetiqm.com/iqm-client/user_guide_qiskit.html#authentication
78
- default="<INSERT YOUR TOKEN>",
79
76
  )
80
77
 
81
78
  args = argparser.parse_args()
82
- results = resonance_example(args.url, args.token)
83
- print(results)
79
+ counts = bell_measure(args.url, args.token)
80
+ print(counts)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iqm-client
3
- Version: 31.8.0
3
+ Version: 32.0.0
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
@@ -22,7 +22,6 @@ docs/integration_guide.rst
22
22
  docs/license.rst
23
23
  docs/readme.rst
24
24
  docs/user_guide_cirq.rst
25
- docs/user_guide_cli.rst
26
25
  docs/user_guide_qiskit.rst
27
26
  docs/_static/images/favicon.ico
28
27
  docs/_static/images/logo.png
@@ -66,11 +65,6 @@ src/iqm/iqm_client/py.typed
66
65
  src/iqm/iqm_client/transpile.py
67
66
  src/iqm/iqm_client/util.py
68
67
  src/iqm/iqm_client/validation.py
69
- src/iqm/iqm_client/cli/__init__.py
70
- src/iqm/iqm_client/cli/auth.py
71
- src/iqm/iqm_client/cli/cli.py
72
- src/iqm/iqm_client/cli/models.py
73
- src/iqm/iqm_client/cli/token_manager.py
74
68
  src/iqm/qiskit_iqm/__init__.py
75
69
  src/iqm/qiskit_iqm/iqm_backend.py
76
70
  src/iqm/qiskit_iqm/iqm_circuit.py
@@ -87,7 +81,6 @@ src/iqm/qiskit_iqm/qiskit_to_iqm.py
87
81
  src/iqm/qiskit_iqm/transpiler_plugins.py
88
82
  src/iqm/qiskit_iqm/examples/__init__.py
89
83
  src/iqm/qiskit_iqm/examples/bell_measure.py
90
- src/iqm/qiskit_iqm/examples/resonance_example.py
91
84
  src/iqm/qiskit_iqm/examples/transpile_example.py
92
85
  src/iqm/qiskit_iqm/fake_backends/__init__.py
93
86
  src/iqm/qiskit_iqm/fake_backends/fake_adonis.py
@@ -0,0 +1 @@
1
+ 32.0.0
@@ -1,137 +0,0 @@
1
- .. _User guide CLI:
2
-
3
- =========================
4
- IQM Client CLI User Guide
5
- =========================
6
-
7
- Command-line interface (CLI) for managing user authentication when using IQM quantum computers.
8
-
9
- Installing IQM Client CLI
10
- -------------------------
11
-
12
- .. code-block:: bash
13
-
14
- $ pip install iqm-client[cli]
15
-
16
- Using IQM Client CLI
17
- --------------------
18
-
19
- For general usage instructions, run
20
-
21
- .. code-block:: bash
22
-
23
- $ iqmclient --help
24
-
25
- Initialization
26
- ^^^^^^^^^^^^^^
27
-
28
- First, IQM Client CLI needs initialization, which produces a configuration file:
29
-
30
- .. code-block:: bash
31
-
32
- $ iqmclient init
33
-
34
- IQM Client CLI will ask a few questions. You can also pass the values via command line to avoid having an interactive
35
- prompt. See ``iqmclient init --help`` for details.
36
-
37
- Login
38
- ^^^^^
39
-
40
- To log in, use
41
-
42
- .. code-block:: bash
43
-
44
- $ iqmclient auth login
45
-
46
- This will ask you to enter your username and password. If you have a temporary password you will be asked to go to the
47
- authentication server and enter a new password. URL of the authentication server will be provided.
48
-
49
- After a successful authentication, tokens will be saved into a tokens file (path specified in the configuration file),
50
- and a token manager daemon will start in the background. Token manager will periodically refresh the session and
51
- re-write the tokens file.
52
-
53
- To use the token manager in a foreground mode (not as daemon), run ``iqmclient auth login --no-daemon``. This requires
54
- keeping the shell session alive. However, you can start the process in the background by adding ``&`` after the
55
- command: ``iqmclient auth login --no-daemon &``. This applies to Bash, zsh and similar shells, but may not be available
56
- on all shells.
57
-
58
- To login and get tokens once, without starting a token manager at all, run ``iqmclient auth login --no-refresh``.
59
-
60
- If the tokens file already exists, then running ``iqmclient auth login`` will first attempt to refresh the session
61
- without asking you for a username and password. If that fails (because existing tokens may already have expired), you'll
62
- be asked to re-enter your credentials.
63
-
64
- See ``iqmclient auth login --help`` for more details.
65
-
66
- Use with Cirq on IQM, Qiskit on IQM, etc.
67
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
68
-
69
- Adapters based on IQM Client, such as Cirq on IQM and Qiskit on IQM, can take advantage of the tokens file maintained by
70
- IQM Client CLI. This way you won't need to provide the authentication server URL, username, or password to the adapter
71
- library itself. To achieve this, follow the instructions printed on the screen after running ``iqmclient auth login``.
72
- Namely, set the ``IQM_TOKENS_FILE`` environment variable to point to your tokens file.
73
-
74
- On Linux:
75
-
76
- .. code-block:: bash
77
-
78
- $ export IQM_TOKENS_FILE=/home/<username>/tokens.json
79
-
80
- On Windows:
81
-
82
- .. code-block:: batch
83
-
84
- set IQM_TOKENS_FILE=C:\Users\<username>\.cache\iqm-client-cli\tokens.json
85
-
86
- Once set, this environment variable is read by the instance of IQM Client associated with the adapter. As a result,
87
- from the point of view of the adapter it looks like authentication is simply not required (i.e. no
88
- authentication-related information has to be provided to the adapter).
89
-
90
- Status
91
- ^^^^^^
92
-
93
- To see the current status of the token manager, use:
94
-
95
- .. code-block:: bash
96
-
97
- $ iqmclient auth status
98
-
99
- If the tokens file exists, ``iqmclient auth status`` will report whether the corresponding token
100
- manager is running. It will also print the time of the last successful refresh request, and
101
- how much time is left until current tokens expire.
102
-
103
- See ``iqmclient auth status --help`` for more details.
104
-
105
- Logout
106
- ^^^^^^
107
-
108
- To log out, run
109
-
110
- .. code-block:: bash
111
-
112
- $ iqmclient auth logout
113
-
114
- This will send a logout request to the authentication server, kill the token manager daemon (if any), and delete the
115
- tokens file.
116
-
117
- You may want to stop the token manager, but maintain the session on the server and keep the tokens file intact.
118
- To do so, run:
119
-
120
- .. code-block:: bash
121
-
122
- $ iqmclient auth logout --keep-tokens
123
-
124
- See ``iqmclient auth logout --help`` for more details.
125
-
126
- Multiple configuration files
127
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
128
-
129
- By default, all IQM Client CLI commands read the configuration file from the default location
130
- ``~/.config/iqm-client-cli/config.json``. You can specify a different filepath by providing the ``--config-file`` value,
131
- for example:
132
-
133
- .. code-block:: bash
134
-
135
- $ iqmclient auth status --config-file /home/joe/config.json
136
- $ iqmclient auth login --config-file /home/joe/config.json
137
- $ iqmclient auth logout --config-file /home/joe/config.json
@@ -1,14 +0,0 @@
1
- # Copyright 2021-2023 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
- """Command-line interface (CLI) for managing user authentication when using IQM quantum computers."""
@@ -1,168 +0,0 @@
1
- # Copyright 2021-2023 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
- """Authorization and session management for IQM Client CLI."""
15
-
16
- from base64 import b64decode
17
- from enum import Enum
18
- import json
19
- import time
20
-
21
- from pydantic import BaseModel, Field
22
- import requests
23
-
24
- REFRESH_MARGIN_SECONDS = 15
25
- AUTH_REQUESTS_TIMEOUT = 20
26
-
27
-
28
- class ClientAuthenticationError(RuntimeError):
29
- """Something went wrong with user authentication."""
30
-
31
-
32
- class ClientAccountSetupError(RuntimeError):
33
- """User's account has not been fully set up yet."""
34
-
35
-
36
- class GrantType(str, Enum):
37
- """Type of token request."""
38
-
39
- PASSWORD = "password"
40
- REFRESH = "refresh_token"
41
-
42
-
43
- class AuthRequest(BaseModel):
44
- """Request sent to authentication server for access token and refresh token, or for terminating the session.
45
-
46
- * Token request with grant type ``'password'`` starts a new session in the authentication server.
47
- It uses fields ``client_id``, ``grant_type``, ``username`` and ``password``.
48
- * Token request with grant type ``'refresh_token'`` is used for maintaining an existing session.
49
- It uses field ``client_id``, ``grant_type``, ``refresh_token``.
50
- * Logout request uses only fields ``client_id`` and ``refresh_token``.
51
- """
52
-
53
- client_id: str = Field(...)
54
- "name of the client for all request types"
55
- grant_type: GrantType | None = Field(None)
56
- "type of token request, in ``{'password', 'refresh_token'}``"
57
- username: str | None = Field(None)
58
- "username for grant type ``'password'``"
59
- password: str | None = Field(None)
60
- "password for grant type ``'password'``"
61
- refresh_token: str | None = Field(None)
62
- "refresh token for grant type ``'refresh_token'`` and logout request"
63
-
64
-
65
- def slash_join(a: str, b: str) -> str:
66
- """Join two URL segments together, ensuring a single slash between them."""
67
- return a.rstrip("/") + "/" + b.lstrip("/")
68
-
69
-
70
- def login_request(url: str, realm: str, client_id: str, username: str, password: str) -> dict[str, str]:
71
- """Sends login request to the authentication server.
72
-
73
- Raises:
74
- ClientAuthenticationError: obtaining the tokens failed
75
-
76
- Returns:
77
- Tokens dictionary
78
-
79
- """
80
- data = AuthRequest(
81
- client_id=client_id, grant_type=GrantType.PASSWORD, username=username, password=password, refresh_token=None
82
- )
83
-
84
- request_url = slash_join(url, f"realms/{realm}/protocol/openid-connect/token")
85
- result = requests.post(request_url, data=data.model_dump(exclude_none=True), timeout=AUTH_REQUESTS_TIMEOUT)
86
- if result.status_code == 404:
87
- raise ClientAuthenticationError(f"token endpoint is not available at {url}")
88
- if result.status_code == 400 and result.json().get("error_description", "") == "Account is not fully set up":
89
- raise ClientAccountSetupError("Account is not fully set up")
90
- if result.status_code != 200:
91
- raise ClientAuthenticationError("invalid username and/or password")
92
- tokens = result.json()
93
- tokens = {key: tokens.get(key, "") for key in ["access_token", "refresh_token"]}
94
- return tokens
95
-
96
-
97
- def refresh_request(url: str, realm: str, client_id: str, refresh_token: str) -> dict[str, str] | None:
98
- """Sends refresh request to the authentication server.
99
-
100
- Raises:
101
- Timeout: no response from auth server within the timeout period
102
- ConnectionError: connecting the auth server failed on all retries
103
- ClientAuthenticationError: updating the tokens failed
104
-
105
- Returns:
106
- Tokens dictionary, or None if refresh_token is expired.
107
-
108
- """
109
- if not token_is_valid(refresh_token):
110
- raise ClientAuthenticationError("Refresh token has expired")
111
-
112
- # Update tokens using existing refresh_token
113
- data = AuthRequest(
114
- client_id=client_id, grant_type=GrantType.REFRESH, username=None, password=None, refresh_token=refresh_token
115
- )
116
-
117
- request_url = slash_join(url, f"realms/{realm}/protocol/openid-connect/token")
118
- result = requests.post(request_url, data=data.model_dump(exclude_none=True), timeout=AUTH_REQUESTS_TIMEOUT)
119
- if result.status_code != 200:
120
- raise ClientAuthenticationError(f"Failed to update tokens, {result.text}")
121
- tokens = result.json()
122
- if not tokens or "access_token" not in tokens or "refresh_token" not in tokens:
123
- raise ClientAuthenticationError("Failed to get new tokens")
124
- tokens = {key: tokens.get(key, "") for key in ["access_token", "refresh_token"]}
125
- return tokens
126
-
127
-
128
- def logout_request(url: str, realm: str, client_id: str, refresh_token: str) -> bool:
129
- """Sends logout request to the authentication server.
130
-
131
- Raises:
132
- ClientAuthenticationError: updating the tokens failed
133
-
134
- Returns:
135
- True if logout was successful
136
-
137
- """
138
- data = AuthRequest(client_id=client_id, grant_type=None, username=None, password=None, refresh_token=refresh_token)
139
- request_url = slash_join(url, f"realms/{realm}/protocol/openid-connect/logout")
140
- result = requests.post(request_url, data=data.model_dump(exclude_none=True), timeout=AUTH_REQUESTS_TIMEOUT)
141
-
142
- if result.status_code != 204:
143
- raise ClientAuthenticationError(f"Failed to logout, {result.text}")
144
- return True
145
-
146
-
147
- def time_left_seconds(token: str) -> int:
148
- """Check how much time is left until the token expires.
149
-
150
- Returns:
151
- Time left on token in seconds.
152
-
153
- """
154
- _, body, _ = token.split(".", 2)
155
- # Add padding to adjust body length to a multiple of 4 chars as required by base64 decoding
156
- body += "=" * (-len(body) % 4)
157
- exp_time = int(json.loads(b64decode(body)).get("exp", "0"))
158
- return max(0, exp_time - int(time.time()))
159
-
160
-
161
- def token_is_valid(refresh_token: str) -> bool:
162
- """Check if token is not about to expire.
163
-
164
- Returns:
165
- True if token is still valid, False otherwise.
166
-
167
- """
168
- return time_left_seconds(refresh_token) > REFRESH_MARGIN_SECONDS