azure-quantum 2.5.0.dev0__py3-none-any.whl → 2.5.0.dev1__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.
@@ -2,31 +2,25 @@
2
2
  # --------------------------------------------------------------------------
3
3
  # Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  # Licensed under the MIT License. See License.txt in the project root for license information.
5
- # Code generated by Microsoft (R) Python Code Generator.
5
+ # Code generated by Microsoft (R) AutoRest Code Generator.
6
6
  # Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
  # --------------------------------------------------------------------------
8
- # pylint: disable=wrong-import-position
9
8
 
10
- from typing import TYPE_CHECKING
11
-
12
- if TYPE_CHECKING:
13
- from ._patch import * # pylint: disable=unused-wildcard-import
14
-
15
- from ._client import ServicesClient # type: ignore
9
+ from ._client import QuantumClient
16
10
  from ._version import VERSION
17
11
 
18
12
  __version__ = VERSION
19
13
 
20
14
  try:
21
15
  from ._patch import __all__ as _patch_all
22
- from ._patch import *
16
+ from ._patch import * # pylint: disable=unused-wildcard-import
23
17
  except ImportError:
24
18
  _patch_all = []
25
19
  from ._patch import patch_sdk as _patch_sdk
26
20
 
27
21
  __all__ = [
28
- "ServicesClient",
22
+ "QuantumClient",
29
23
  ]
30
- __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
24
+ __all__.extend([p for p in _patch_all if p not in __all__])
31
25
 
32
26
  _patch_sdk()
@@ -2,20 +2,19 @@
2
2
  # --------------------------------------------------------------------------
3
3
  # Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  # Licensed under the MIT License. See License.txt in the project root for license information.
5
- # Code generated by Microsoft (R) Python Code Generator.
5
+ # Code generated by Microsoft (R) AutoRest Code Generator.
6
6
  # Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
  # --------------------------------------------------------------------------
8
8
 
9
9
  from copy import deepcopy
10
- from typing import Any, TYPE_CHECKING, Union
11
- from typing_extensions import Self
10
+ from typing import Any, TYPE_CHECKING
12
11
 
13
12
  from azure.core import PipelineClient
14
- from azure.core.credentials import AzureKeyCredential
15
13
  from azure.core.pipeline import policies
16
14
  from azure.core.rest import HttpRequest, HttpResponse
17
15
 
18
- from ._configuration import ServicesClientConfiguration
16
+ from . import models as _models
17
+ from ._configuration import QuantumClientConfiguration
19
18
  from ._serialization import Deserializer, Serializer
20
19
  from .operations import (
21
20
  JobsOperations,
@@ -27,50 +26,59 @@ from .operations import (
27
26
  )
28
27
 
29
28
  if TYPE_CHECKING:
29
+ # pylint: disable=unused-import,ungrouped-imports
30
30
  from azure.core.credentials import TokenCredential
31
31
 
32
32
 
33
- class ServicesClient:
34
- """Azure Quantum Workspace Services.
33
+ class QuantumClient: # pylint: disable=client-accepts-api-version-keyword
34
+ """Azure Quantum REST API client.
35
35
 
36
36
  :ivar jobs: JobsOperations operations
37
- :vartype jobs: azure.quantum.operations.JobsOperations
38
- :ivar sessions: SessionsOperations operations
39
- :vartype sessions: azure.quantum.operations.SessionsOperations
37
+ :vartype jobs: azure.quantum._client.operations.JobsOperations
40
38
  :ivar providers: ProvidersOperations operations
41
- :vartype providers: azure.quantum.operations.ProvidersOperations
39
+ :vartype providers: azure.quantum._client.operations.ProvidersOperations
42
40
  :ivar storage: StorageOperations operations
43
- :vartype storage: azure.quantum.operations.StorageOperations
41
+ :vartype storage: azure.quantum._client.operations.StorageOperations
44
42
  :ivar quotas: QuotasOperations operations
45
- :vartype quotas: azure.quantum.operations.QuotasOperations
43
+ :vartype quotas: azure.quantum._client.operations.QuotasOperations
44
+ :ivar sessions: SessionsOperations operations
45
+ :vartype sessions: azure.quantum._client.operations.SessionsOperations
46
46
  :ivar top_level_items: TopLevelItemsOperations operations
47
- :vartype top_level_items: azure.quantum.operations.TopLevelItemsOperations
48
- :param region: The Azure region where the Azure Quantum Workspace is located. Required.
49
- :type region: str
50
- :param credential: Credential used to authenticate requests to the service. Is either a
51
- TokenCredential type or a AzureKeyCredential type. Required.
52
- :type credential: ~azure.core.credentials.TokenCredential or
53
- ~azure.core.credentials.AzureKeyCredential
54
- :keyword service_base_url: The Azure Quantum service base url. Default value is
55
- "quantum.azure.com".
56
- :paramtype service_base_url: str
57
- :keyword api_version: The API version to use for this operation. Default value is
58
- "2024-10-01-preview". Note that overriding this default value may result in unsupported
59
- behavior.
47
+ :vartype top_level_items: azure.quantum._client.operations.TopLevelItemsOperations
48
+ :param azure_region: Supported Azure regions for Azure Quantum Services. For example, "eastus".
49
+ Required.
50
+ :type azure_region: str
51
+ :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g.
52
+ 00000000-0000-0000-0000-000000000000). Required.
53
+ :type subscription_id: str
54
+ :param resource_group_name: Name of an Azure resource group. Required.
55
+ :type resource_group_name: str
56
+ :param workspace_name: Name of the workspace. Required.
57
+ :type workspace_name: str
58
+ :param credential: Credential needed for the client to connect to Azure. Required.
59
+ :type credential: ~azure.core.credentials.TokenCredential
60
+ :keyword api_version: Api Version. Default value is "2023-11-13-preview". Note that overriding
61
+ this default value may result in unsupported behavior.
60
62
  :paramtype api_version: str
61
63
  """
62
64
 
63
65
  def __init__(
64
66
  self,
65
- region: str,
66
- credential: Union["TokenCredential", AzureKeyCredential],
67
- *,
68
- service_base_url: str = "quantum.azure.com",
67
+ azure_region: str,
68
+ subscription_id: str,
69
+ resource_group_name: str,
70
+ workspace_name: str,
71
+ credential: "TokenCredential",
69
72
  **kwargs: Any
70
73
  ) -> None:
71
- _endpoint = "https://{region}.{serviceBaseUrl}"
72
- self._config = ServicesClientConfiguration(
73
- region=region, credential=credential, service_base_url=service_base_url, **kwargs
74
+ _endpoint = kwargs.pop("endpoint", f"https://{azure_region}.quantum.azure.com")
75
+ self._config = QuantumClientConfiguration(
76
+ azure_region=azure_region,
77
+ subscription_id=subscription_id,
78
+ resource_group_name=resource_group_name,
79
+ workspace_name=workspace_name,
80
+ credential=credential,
81
+ **kwargs
74
82
  )
75
83
  _policies = kwargs.pop("policies", None)
76
84
  if _policies is None:
@@ -91,14 +99,16 @@ class ServicesClient:
91
99
  ]
92
100
  self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
93
101
 
94
- self._serialize = Serializer()
95
- self._deserialize = Deserializer()
102
+ client_models = {k: v for k, v in _models._models.__dict__.items() if isinstance(v, type)}
103
+ client_models.update({k: v for k, v in _models.__dict__.items() if isinstance(v, type)})
104
+ self._serialize = Serializer(client_models)
105
+ self._deserialize = Deserializer(client_models)
96
106
  self._serialize.client_side_validation = False
97
107
  self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize)
98
- self.sessions = SessionsOperations(self._client, self._config, self._serialize, self._deserialize)
99
108
  self.providers = ProvidersOperations(self._client, self._config, self._serialize, self._deserialize)
100
109
  self.storage = StorageOperations(self._client, self._config, self._serialize, self._deserialize)
101
110
  self.quotas = QuotasOperations(self._client, self._config, self._serialize, self._deserialize)
111
+ self.sessions = SessionsOperations(self._client, self._config, self._serialize, self._deserialize)
102
112
  self.top_level_items = TopLevelItemsOperations(self._client, self._config, self._serialize, self._deserialize)
103
113
 
104
114
  def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
@@ -121,9 +131,8 @@ class ServicesClient:
121
131
 
122
132
  request_copy = deepcopy(request)
123
133
  path_format_arguments = {
124
- "region": self._serialize.url("self._config.region", self._config.region, "str"),
125
- "serviceBaseUrl": self._serialize.url(
126
- "self._config.service_base_url", self._config.service_base_url, "str"
134
+ "azureRegion": self._serialize.url(
135
+ "self._config.azure_region", self._config.azure_region, "str", skip_quote=True
127
136
  ),
128
137
  }
129
138
 
@@ -133,7 +142,7 @@ class ServicesClient:
133
142
  def close(self) -> None:
134
143
  self._client.close()
135
144
 
136
- def __enter__(self) -> Self:
145
+ def __enter__(self) -> "QuantumClient":
137
146
  self._client.__enter__()
138
147
  return self
139
148
 
@@ -2,72 +2,77 @@
2
2
  # --------------------------------------------------------------------------
3
3
  # Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  # Licensed under the MIT License. See License.txt in the project root for license information.
5
- # Code generated by Microsoft (R) Python Code Generator.
5
+ # Code generated by Microsoft (R) AutoRest Code Generator.
6
6
  # Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
  # --------------------------------------------------------------------------
8
8
 
9
- from typing import Any, TYPE_CHECKING, Union
9
+ from typing import Any, TYPE_CHECKING
10
10
 
11
- from azure.core.credentials import AzureKeyCredential
12
11
  from azure.core.pipeline import policies
13
12
 
14
13
  from ._version import VERSION
15
14
 
16
15
  if TYPE_CHECKING:
16
+ # pylint: disable=unused-import,ungrouped-imports
17
17
  from azure.core.credentials import TokenCredential
18
18
 
19
19
 
20
- class ServicesClientConfiguration: # pylint: disable=too-many-instance-attributes
21
- """Configuration for ServicesClient.
20
+ class QuantumClientConfiguration: # pylint: disable=too-many-instance-attributes
21
+ """Configuration for QuantumClient.
22
22
 
23
23
  Note that all parameters used to create this instance are saved as instance
24
24
  attributes.
25
25
 
26
- :param region: The Azure region where the Azure Quantum Workspace is located. Required.
27
- :type region: str
28
- :param credential: Credential used to authenticate requests to the service. Is either a
29
- TokenCredential type or a AzureKeyCredential type. Required.
30
- :type credential: ~azure.core.credentials.TokenCredential or
31
- ~azure.core.credentials.AzureKeyCredential
32
- :param service_base_url: The Azure Quantum service base url. Default value is
33
- "quantum.azure.com".
34
- :type service_base_url: str
35
- :keyword api_version: The API version to use for this operation. Default value is
36
- "2024-10-01-preview". Note that overriding this default value may result in unsupported
37
- behavior.
26
+ :param azure_region: Supported Azure regions for Azure Quantum Services. For example, "eastus".
27
+ Required.
28
+ :type azure_region: str
29
+ :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g.
30
+ 00000000-0000-0000-0000-000000000000). Required.
31
+ :type subscription_id: str
32
+ :param resource_group_name: Name of an Azure resource group. Required.
33
+ :type resource_group_name: str
34
+ :param workspace_name: Name of the workspace. Required.
35
+ :type workspace_name: str
36
+ :param credential: Credential needed for the client to connect to Azure. Required.
37
+ :type credential: ~azure.core.credentials.TokenCredential
38
+ :keyword api_version: Api Version. Default value is "2023-11-13-preview". Note that overriding
39
+ this default value may result in unsupported behavior.
38
40
  :paramtype api_version: str
39
41
  """
40
42
 
41
43
  def __init__(
42
44
  self,
43
- region: str,
44
- credential: Union["TokenCredential", AzureKeyCredential],
45
- service_base_url: str = "quantum.azure.com",
46
- **kwargs: Any,
45
+ azure_region: str,
46
+ subscription_id: str,
47
+ resource_group_name: str,
48
+ workspace_name: str,
49
+ credential: "TokenCredential",
50
+ **kwargs: Any
47
51
  ) -> None:
48
- api_version: str = kwargs.pop("api_version", "2024-10-01-preview")
52
+ api_version: str = kwargs.pop("api_version", "2022-09-12-preview")
49
53
 
50
- if region is None:
51
- raise ValueError("Parameter 'region' must not be None.")
54
+ if azure_region is None:
55
+ raise ValueError("Parameter 'azure_region' must not be None.")
56
+ if subscription_id is None:
57
+ raise ValueError("Parameter 'subscription_id' must not be None.")
58
+ if resource_group_name is None:
59
+ raise ValueError("Parameter 'resource_group_name' must not be None.")
60
+ if workspace_name is None:
61
+ raise ValueError("Parameter 'workspace_name' must not be None.")
52
62
  if credential is None:
53
63
  raise ValueError("Parameter 'credential' must not be None.")
54
64
 
55
- self.region = region
65
+ self.azure_region = azure_region
66
+ self.subscription_id = subscription_id
67
+ self.resource_group_name = resource_group_name
68
+ self.workspace_name = workspace_name
56
69
  self.credential = credential
57
- self.service_base_url = service_base_url
58
70
  self.api_version = api_version
59
71
  self.credential_scopes = kwargs.pop("credential_scopes", ["https://quantum.microsoft.com/.default"])
60
72
  kwargs.setdefault("sdk_moniker", "quantum/{}".format(VERSION))
61
73
  self.polling_interval = kwargs.get("polling_interval", 30)
62
74
  self._configure(**kwargs)
63
75
 
64
- def _infer_policy(self, **kwargs):
65
- if hasattr(self.credential, "get_token"):
66
- return policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
67
- if isinstance(self.credential, AzureKeyCredential):
68
- return policies.AzureKeyCredentialPolicy(self.credential, "x-ms-quantum-api-key", **kwargs)
69
- raise TypeError(f"Unsupported credential: {self.credential}")
70
-
71
76
  def _configure(self, **kwargs: Any) -> None:
72
77
  self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
73
78
  self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
@@ -79,4 +84,6 @@ class ServicesClientConfiguration: # pylint: disable=too-many-instance-attribut
79
84
  self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
80
85
  self.authentication_policy = kwargs.get("authentication_policy")
81
86
  if self.credential and not self.authentication_policy:
82
- self.authentication_policy = self._infer_policy(**kwargs)
87
+ self.authentication_policy = policies.BearerTokenCredentialPolicy(
88
+ self.credential, *self.credential_scopes, **kwargs
89
+ )