iqm-client 31.2.0__tar.gz → 31.4.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.2.0 → iqm_client-31.4.0}/CHANGELOG.rst +16 -0
  2. {iqm_client-31.2.0 → iqm_client-31.4.0}/INTEGRATION_GUIDE.rst +0 -10
  3. {iqm_client-31.2.0 → iqm_client-31.4.0}/PKG-INFO +1 -1
  4. {iqm_client-31.2.0 → iqm_client-31.4.0}/docs/user_guide_cirq.rst +0 -6
  5. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/cirq_iqm/devices/iqm_device.py +1 -1
  6. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/cirq_iqm/devices/iqm_device_metadata.py +1 -1
  7. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/cirq_iqm/iqm_sampler.py +1 -1
  8. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/iqm_client/authentication.py +7 -113
  9. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/iqm_client/iqm_client.py +7 -24
  10. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/iqm_provider.py +1 -1
  11. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm_client.egg-info/PKG-INFO +1 -1
  12. iqm_client-31.4.0/version.txt +1 -0
  13. iqm_client-31.2.0/version.txt +0 -1
  14. {iqm_client-31.2.0 → iqm_client-31.4.0}/AUTHORS.rst +0 -0
  15. {iqm_client-31.2.0 → iqm_client-31.4.0}/CHANGELOG_cirq-iqm.rst +0 -0
  16. {iqm_client-31.2.0 → iqm_client-31.4.0}/CHANGELOG_cortex-cli.rst +0 -0
  17. {iqm_client-31.2.0 → iqm_client-31.4.0}/CHANGELOG_qiskit-iqm.rst +0 -0
  18. {iqm_client-31.2.0 → iqm_client-31.4.0}/LICENSE.txt +0 -0
  19. {iqm_client-31.2.0 → iqm_client-31.4.0}/MANIFEST.in +0 -0
  20. {iqm_client-31.2.0 → iqm_client-31.4.0}/README.rst +0 -0
  21. {iqm_client-31.2.0 → iqm_client-31.4.0}/docbuild +0 -0
  22. {iqm_client-31.2.0 → iqm_client-31.4.0}/docs/API.rst +0 -0
  23. {iqm_client-31.2.0 → iqm_client-31.4.0}/docs/_static/images/favicon.ico +0 -0
  24. {iqm_client-31.2.0 → iqm_client-31.4.0}/docs/_static/images/logo.png +0 -0
  25. {iqm_client-31.2.0 → iqm_client-31.4.0}/docs/_templates/autosummary-class-template.rst +0 -0
  26. {iqm_client-31.2.0 → iqm_client-31.4.0}/docs/_templates/autosummary-module-template.rst +0 -0
  27. {iqm_client-31.2.0 → iqm_client-31.4.0}/docs/authors.rst +0 -0
  28. {iqm_client-31.2.0 → iqm_client-31.4.0}/docs/changelog.rst +0 -0
  29. {iqm_client-31.2.0 → iqm_client-31.4.0}/docs/conf.py +0 -0
  30. {iqm_client-31.2.0 → iqm_client-31.4.0}/docs/index.rst +0 -0
  31. {iqm_client-31.2.0 → iqm_client-31.4.0}/docs/integration_guide.rst +0 -0
  32. {iqm_client-31.2.0 → iqm_client-31.4.0}/docs/license.rst +0 -0
  33. {iqm_client-31.2.0 → iqm_client-31.4.0}/docs/readme.rst +0 -0
  34. {iqm_client-31.2.0 → iqm_client-31.4.0}/docs/user_guide_cli.rst +0 -0
  35. {iqm_client-31.2.0 → iqm_client-31.4.0}/docs/user_guide_qiskit.rst +0 -0
  36. {iqm_client-31.2.0 → iqm_client-31.4.0}/pyproject.toml +0 -0
  37. {iqm_client-31.2.0 → iqm_client-31.4.0}/pytest.ini +0 -0
  38. {iqm_client-31.2.0 → iqm_client-31.4.0}/requirements/base.in +0 -0
  39. {iqm_client-31.2.0 → iqm_client-31.4.0}/requirements/base.in.internal +0 -0
  40. {iqm_client-31.2.0 → iqm_client-31.4.0}/requirements/base.txt +0 -0
  41. {iqm_client-31.2.0 → iqm_client-31.4.0}/requirements/cirq.in +0 -0
  42. {iqm_client-31.2.0 → iqm_client-31.4.0}/requirements/cirq.txt +0 -0
  43. {iqm_client-31.2.0 → iqm_client-31.4.0}/requirements/cli.in +0 -0
  44. {iqm_client-31.2.0 → iqm_client-31.4.0}/requirements/cli.txt +0 -0
  45. {iqm_client-31.2.0 → iqm_client-31.4.0}/requirements/qiskit.in +0 -0
  46. {iqm_client-31.2.0 → iqm_client-31.4.0}/requirements/qiskit.txt +0 -0
  47. {iqm_client-31.2.0 → iqm_client-31.4.0}/setup.cfg +0 -0
  48. {iqm_client-31.2.0 → iqm_client-31.4.0}/setup.py +0 -0
  49. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/cirq_iqm/__init__.py +0 -0
  50. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/cirq_iqm/devices/__init__.py +0 -0
  51. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/cirq_iqm/devices/adonis.py +0 -0
  52. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/cirq_iqm/devices/aphrodite.py +0 -0
  53. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/cirq_iqm/devices/apollo.py +0 -0
  54. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/cirq_iqm/examples/demo_adonis.py +0 -0
  55. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/cirq_iqm/examples/demo_apollo.py +0 -0
  56. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/cirq_iqm/examples/demo_common.py +0 -0
  57. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/cirq_iqm/examples/demo_iqm_execution.py +0 -0
  58. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/cirq_iqm/examples/usage.ipynb +0 -0
  59. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/cirq_iqm/extended_qasm_parser.py +0 -0
  60. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/cirq_iqm/iqm_gates.py +0 -0
  61. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/cirq_iqm/optimizers.py +0 -0
  62. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/cirq_iqm/py.typed +0 -0
  63. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/cirq_iqm/serialize.py +0 -0
  64. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/cirq_iqm/transpiler.py +0 -0
  65. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/iqm_client/__init__.py +0 -0
  66. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/iqm_client/api.py +0 -0
  67. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/iqm_client/cli/__init__.py +0 -0
  68. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/iqm_client/cli/auth.py +0 -0
  69. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/iqm_client/cli/cli.py +0 -0
  70. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/iqm_client/cli/models.py +0 -0
  71. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/iqm_client/cli/token_manager.py +0 -0
  72. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/iqm_client/errors.py +0 -0
  73. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/iqm_client/models.py +0 -0
  74. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/iqm_client/py.typed +0 -0
  75. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/iqm_client/transpile.py +0 -0
  76. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/iqm_client/util.py +0 -0
  77. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/iqm_client/validation.py +0 -0
  78. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/__init__.py +0 -0
  79. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/examples/__init__.py +0 -0
  80. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/examples/bell_measure.py +0 -0
  81. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/examples/resonance_example.py +0 -0
  82. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/examples/transpile_example.py +0 -0
  83. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/fake_backends/__init__.py +0 -0
  84. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/fake_backends/fake_adonis.py +0 -0
  85. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/fake_backends/fake_aphrodite.py +0 -0
  86. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/fake_backends/fake_apollo.py +0 -0
  87. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/fake_backends/fake_deneb.py +0 -0
  88. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/fake_backends/fake_garnet.py +0 -0
  89. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/fake_backends/iqm_fake_backend.py +0 -0
  90. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/iqm_backend.py +0 -0
  91. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/iqm_circuit.py +0 -0
  92. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/iqm_circuit_validation.py +0 -0
  93. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/iqm_job.py +0 -0
  94. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/iqm_move_layout.py +0 -0
  95. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/iqm_naive_move_pass.py +0 -0
  96. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/iqm_target.py +0 -0
  97. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/iqm_transpilation.py +0 -0
  98. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/move_gate.py +0 -0
  99. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/py.typed +0 -0
  100. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/qiskit_to_iqm.py +0 -0
  101. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm/qiskit_iqm/transpiler_plugins.py +0 -0
  102. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm_client.egg-info/SOURCES.txt +0 -0
  103. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm_client.egg-info/dependency_links.txt +0 -0
  104. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm_client.egg-info/entry_points.txt +0 -0
  105. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm_client.egg-info/requires.txt +0 -0
  106. {iqm_client-31.2.0 → iqm_client-31.4.0}/src/iqm_client.egg-info/top_level.txt +0 -0
  107. {iqm_client-31.2.0 → iqm_client-31.4.0}/test +0 -0
  108. {iqm_client-31.2.0 → iqm_client-31.4.0}/tests/__init__.py +0 -0
  109. {iqm_client-31.2.0 → iqm_client-31.4.0}/tests/conftest.py +0 -0
@@ -2,6 +2,22 @@
2
2
  Changelog
3
3
  =========
4
4
 
5
+ Version 31.4.0 (2025-09-19)
6
+ ===========================
7
+
8
+ Bug fixes
9
+ ---------
10
+
11
+ - Fix networkx import statement for cirq
12
+
13
+ Version 31.3.0 (2025-09-17)
14
+ ===========================
15
+
16
+ Features
17
+ --------
18
+
19
+ - Remove old way of authenticating
20
+
5
21
  Version 31.2.0 (2025-09-12)
6
22
  ===========================
7
23
 
@@ -117,16 +117,6 @@ token to IQM client:
117
117
  Alternatively, the token can be provided as argument ``token`` to :class:`.IQMClient`
118
118
  constructor.
119
119
 
120
- 3. The third way is to provide server URL, username and password for obtaining the
121
- token from an authentication server. IQM client will maintain a login session with
122
- the authentication server and read and refresh the token as needed. The server URL,
123
- username and password can be provided to IQM client in environment variables
124
- :envvar:`IQM_AUTH_SERVER`, :envvar:`IQM_AUTH_USERNAME` and :envvar:`IQM_AUTH_PASSWORD`.
125
- Alternatively, the values can be provided as arguments ``auth_server_url``,
126
- ``username`` and ``password`` to :class:`.IQMClient` constructor.
127
- Note, that all the values must be provided as either environment variables or
128
- as constructor arguments, not mixed.
129
-
130
120
  Circuit transpilation
131
121
  ---------------------
132
122
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iqm-client
3
- Version: 31.2.0
3
+ Version: 31.4.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
@@ -452,12 +452,6 @@ If the IQM server you are connecting to requires authentication, you may use
452
452
  then set the :envvar:`IQM_TOKENS_FILE` environment variable, as instructed, to point to the tokens file.
453
453
  See IQM Client CLI's `documentation <https://docs.meetiqm.com/iqm-client/user_guide_cli.html>`__ for details.
454
454
 
455
- Alternatively, you may authenticate yourself using the :envvar:`IQM_AUTH_SERVER`,
456
- :envvar:`IQM_AUTH_USERNAME` and :envvar:`IQM_AUTH_PASSWORD` environment variables, or pass them as
457
- arguments to :class:`.IQMSampler`, but this approach is less secure and
458
- considered deprecated.
459
-
460
-
461
455
  Batch execution
462
456
  ^^^^^^^^^^^^^^^
463
457
 
@@ -26,9 +26,9 @@ from typing import cast
26
26
 
27
27
  import cirq
28
28
  from cirq import devices, ops, protocols
29
- from cirq.contrib.routing.router import nx
30
29
  from iqm.cirq_iqm.iqm_gates import IQMMoveGate
31
30
  from iqm.cirq_iqm.transpiler import transpile_insert_moves_into_circuit
31
+ import networkx as nx
32
32
 
33
33
  from .iqm_device_metadata import IQMDeviceMetadata
34
34
 
@@ -19,9 +19,9 @@ from collections.abc import Iterable
19
19
 
20
20
  import cirq
21
21
  from cirq import Gate, NamedQid, devices, ops
22
- from cirq.contrib.routing.router import nx
23
22
  from iqm.cirq_iqm.serialize import _IQM_CIRQ_OP_MAP
24
23
  from iqm.iqm_client import DynamicQuantumArchitecture
24
+ import networkx as nx
25
25
 
26
26
 
27
27
  @cirq.value.value_equality
@@ -58,7 +58,7 @@ class IQMSampler(cirq.work.Sampler):
58
58
  calibration_set_id: UUID | None = None,
59
59
  run_sweep_timeout: int | None = None,
60
60
  compiler_options: CircuitCompilationOptions | None = None,
61
- **user_auth_args, # contains keyword args auth_server_url, username and password
61
+ **user_auth_args, # contains keyword args token or tokens_file
62
62
  ):
63
63
  self._client = IQMClient(url, **user_auth_args)
64
64
  dqa = self._client.get_dynamic_quantum_architecture(calibration_set_id)
@@ -21,7 +21,6 @@ import time
21
21
  from typing import Any
22
22
 
23
23
  from iqm.iqm_client.errors import ClientAuthenticationError, ClientConfigurationError
24
- import requests
25
24
 
26
25
  AUTH_CLIENT_ID = "iqm_client"
27
26
  AUTH_REALM = "cortex"
@@ -35,13 +34,10 @@ class TokenManager:
35
34
  Args:
36
35
  token: Long-lived IQM token in plain text format
37
36
  tokens_file: Path to a tokens file used for authentication
38
- auth_server_url: Base URL of the authentication server
39
- username: Username to log in to authentication server
40
- password: Password to log in to authentication server
41
37
 
42
- The parameters can also be read from the environment variables IQM_TOKEN, IQM_TOKENS_FILE,
43
- IQM_AUTH_SERVER, IQM_AUTH_USERNAME, IQM_AUTH_PASSWORD. Environment variables can not be
44
- mixed with initialisation arguments. All parameters must come from the same source.
38
+ The parameters can also be read from the environment variables IQM_TOKEN or IQM_TOKENS_FILE.
39
+ Environment variables can not be mixed with initialisation arguments.
40
+ All parameters must come from the same source.
45
41
 
46
42
  """
47
43
 
@@ -66,36 +62,17 @@ class TokenManager:
66
62
  except (UnicodeDecodeError, json.decoder.JSONDecodeError, ValueError, TypeError):
67
63
  return 0
68
64
 
69
- def __init__(
70
- self,
71
- token: str | None = None,
72
- tokens_file: str | None = None,
73
- auth_server_url: str | None = None,
74
- username: str | None = None,
75
- password: str | None = None,
76
- ):
65
+ def __init__(self, token: str | None = None, tokens_file: str | None = None):
77
66
  def _format_names(variable_names: list[str]) -> str:
78
67
  """Format a list of variable names"""
79
68
  return ", ".join(f'"{name}"' for name in variable_names)
80
69
 
81
70
  auth_parameters: dict[str, str] = {}
82
71
 
83
- init_parameters = {
84
- "token": token,
85
- "tokens_file": tokens_file,
86
- "auth_server_url": auth_server_url,
87
- "username": username,
88
- "password": password,
89
- }
72
+ init_parameters = {"token": token, "tokens_file": tokens_file}
90
73
  init_params_given = [key for key, value in init_parameters.items() if value]
91
74
 
92
- env_variables = {
93
- "token": "IQM_TOKEN",
94
- "tokens_file": "IQM_TOKENS_FILE",
95
- "auth_server_url": "IQM_AUTH_SERVER",
96
- "username": "IQM_AUTH_USERNAME",
97
- "password": "IQM_AUTH_PASSWORD",
98
- }
75
+ env_variables = {"token": "IQM_TOKEN", "tokens_file": "IQM_TOKENS_FILE"}
99
76
  env_vars_given = [name for name in env_variables.values() if os.environ.get(name)]
100
77
 
101
78
  if init_params_given and env_vars_given:
@@ -121,17 +98,9 @@ class TokenManager:
121
98
  self._token_provider = ExternalToken(auth_parameters["token"])
122
99
  elif set(auth_parameters) == {"tokens_file"}:
123
100
  self._token_provider = TokensFileReader(auth_parameters["tokens_file"])
124
- elif set(auth_parameters) == {"auth_server_url", "username", "password"}:
125
- self._token_provider = TokenClient(
126
- auth_parameters["auth_server_url"],
127
- AUTH_REALM,
128
- auth_parameters["username"],
129
- auth_parameters["password"],
130
- )
131
101
  else:
132
102
  raise ClientConfigurationError(
133
- f"""Invalid combination of authentication parameters specified: {list(auth_parameters)},
134
- Use either ['token'] or ['username', 'password'].""",
103
+ f"Missing authentication parameters, neither token or tokens_file is available, {list(auth_parameters)}"
135
104
  )
136
105
 
137
106
  def get_bearer_token(self, retries: int = 1) -> str | None:
@@ -238,78 +207,3 @@ class TokensFileReader(TokenProviderInterface):
238
207
  def close(self) -> None:
239
208
  self._path = None
240
209
  raise ClientAuthenticationError("Can not close externally managed auth session")
241
-
242
-
243
- class TokenClient(TokenProviderInterface):
244
- """Requests new token from an authentication server"""
245
-
246
- PASSWORD_GRANT_TYPE = "password"
247
- REFRESH_TOKEN_GRANT_TYPE = "refresh_token"
248
-
249
- def __init__(self, auth_server_url: str, realm: str, username: str, password: str):
250
- """Initialize the client"""
251
- self._token_url = f"{auth_server_url}/realms/{realm}/protocol/openid-connect/token"
252
- self._logout_url = f"{auth_server_url}/realms/{realm}/protocol/openid-connect/logout"
253
- self._username = username
254
- self._password = password
255
- self._refresh_token: str | None = None
256
-
257
- def _get_access_token_from_server(self, grant_type: str) -> str | None:
258
- """Get new access token from the server and update refresh token."""
259
- if grant_type == TokenClient.REFRESH_TOKEN_GRANT_TYPE:
260
- # Update tokens using existing refresh_token
261
- data = {
262
- "client_id": AUTH_CLIENT_ID,
263
- "grant_type": TokenClient.REFRESH_TOKEN_GRANT_TYPE,
264
- "refresh_token": str(self._refresh_token),
265
- }
266
- else:
267
- # There is no valid refresh token or refresh token has expired, start a new session
268
- data = {
269
- "client_id": AUTH_CLIENT_ID,
270
- "grant_type": TokenClient.PASSWORD_GRANT_TYPE,
271
- "username": self._username,
272
- "password": self._password,
273
- }
274
-
275
- # Request new tokens from the server
276
- access_token: str | None = None
277
- result = requests.post(self._token_url, data=data, timeout=AUTH_REQUESTS_TIMEOUT)
278
- if result.status_code == 200:
279
- tokens = result.json()
280
- self._refresh_token = tokens.get("refresh_token")
281
- if TokenManager.time_left_seconds(self._refresh_token) <= 0:
282
- self._refresh_token = None
283
- access_token = tokens.get("access_token")
284
- if TokenManager.time_left_seconds(access_token) <= 0:
285
- access_token = None
286
- return access_token
287
-
288
- def get_token(self) -> str:
289
- """Get new access token and refresh token from the server"""
290
- if not self._token_url:
291
- raise ClientConfigurationError("No auth server configured")
292
-
293
- access_token: str | None = None
294
- if TokenManager.time_left_seconds(self._refresh_token) > REFRESH_MARGIN_SECONDS:
295
- # There is a valid refresh token, try to update tokens using it
296
- access_token = self._get_access_token_from_server(TokenClient.REFRESH_TOKEN_GRANT_TYPE)
297
- if access_token is None:
298
- # Failed to get valid access token using refresh token, start a new session
299
- access_token = self._get_access_token_from_server(TokenClient.PASSWORD_GRANT_TYPE)
300
- if access_token is None:
301
- # Failed to get valid access token using username and password, raise an error
302
- raise ClientAuthenticationError("Getting access token from auth server failed")
303
- return str(access_token) # access token can not be None here
304
-
305
- def close(self) -> None:
306
- """Close authentication session"""
307
- if not self._refresh_token:
308
- raise ClientAuthenticationError("No auth session active")
309
-
310
- data = {"client_id": AUTH_CLIENT_ID, "refresh_token": self._refresh_token}
311
- self._refresh_token = None
312
-
313
- result = requests.post(self._logout_url, data=data, timeout=AUTH_REQUESTS_TIMEOUT)
314
- if result.status_code not in [200, 204]:
315
- raise ClientAuthenticationError(f"Logout failed, {result.text}")
@@ -94,39 +94,22 @@ class IQMClient:
94
94
  If ``token`` is given no other user authentication parameters should be given.
95
95
  tokens_file: Path to a tokens file used for authentication.
96
96
  If ``tokens_file`` is given no other user authentication parameters should be given.
97
- auth_server_url: Base URL of the authentication server.
98
- If ``auth_server_url`` is given also ``username`` and ``password`` must be given.
99
- username: Username to log in to authentication server.
100
- password: Password to log in to authentication server.
101
97
 
102
98
  Alternatively, the user authentication related keyword arguments can also be given in
103
- environment variables :envvar:`IQM_TOKEN`, :envvar:`IQM_TOKENS_FILE`, :envvar:`IQM_AUTH_SERVER`,
104
- :envvar:`IQM_AUTH_USERNAME` and :envvar:`IQM_AUTH_PASSWORD`. All parameters must be given either
105
- as keyword arguments or as environment variables. Same combination restrictions apply
106
- for values given as environment variables as for keyword arguments.
99
+ environment variables :envvar:`IQM_TOKEN`, :envvar:`IQM_TOKENS_FILE`.
100
+
101
+ All parameters must be given either as keyword arguments or as environment variables.
102
+ Same combination restrictions apply for values given as environment variables as for
103
+ keyword arguments.
107
104
 
108
105
  """
109
106
 
110
107
  def __init__(
111
- self,
112
- url: str,
113
- *,
114
- client_signature: str | None = None,
115
- token: str | None = None,
116
- tokens_file: str | None = None,
117
- auth_server_url: str | None = None,
118
- username: str | None = None,
119
- password: str | None = None,
108
+ self, url: str, *, client_signature: str | None = None, token: str | None = None, tokens_file: str | None = None
120
109
  ):
121
110
  if not url.startswith(("http:", "https:")):
122
111
  raise ClientConfigurationError(f"The URL schema has to be http or https. Incorrect schema in URL: {url}")
123
- self._token_manager = TokenManager(
124
- token,
125
- tokens_file,
126
- auth_server_url,
127
- username,
128
- password,
129
- )
112
+ self._token_manager = TokenManager(token, tokens_file)
130
113
  version_string = "iqm-client"
131
114
  self._signature = f"{platform.platform(terse=True)}"
132
115
  self._signature += f", python {platform.python_version()}"
@@ -366,7 +366,7 @@ class IQMProvider:
366
366
 
367
367
  """
368
368
 
369
- def __init__(self, url: str, **user_auth_args): # contains keyword args auth_server_url, username, password
369
+ def __init__(self, url: str, **user_auth_args): # contains keyword args token or tokens_file
370
370
  self.url = url
371
371
  self.user_auth_args = user_auth_args
372
372
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iqm-client
3
- Version: 31.2.0
3
+ Version: 31.4.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
@@ -0,0 +1 @@
1
+ 31.4.0
@@ -1 +0,0 @@
1
- 31.2.0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes