@planqk/planqk-service-sdk 2.6.0 → 2.7.0

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 (52) hide show
  1. package/.fossa.yml +1 -1
  2. package/dist/sdk/Client.d.ts +2 -2
  3. package/dist/sdk/Client.js +1 -1
  4. package/dist/sdk/api/resources/serviceApi/client/Client.d.ts +4 -4
  5. package/dist/sdk/api/resources/serviceApi/client/Client.js +6 -2
  6. package/dist/sdk/api/types/LogEntry.d.ts +8 -0
  7. package/dist/sdk/api/types/LogEntry.js +5 -0
  8. package/dist/sdk/api/types/index.d.ts +1 -0
  9. package/dist/sdk/api/types/index.js +1 -0
  10. package/fern/fern.config.json +1 -1
  11. package/fern/generators.yml +6 -4
  12. package/fern/openapi/openapi.yml +104 -80
  13. package/notebooks/python-sdk.ipynb +10 -4
  14. package/package.json +1 -1
  15. package/planqk/service/_version.py +1 -1
  16. package/planqk/service/auth.py +6 -1
  17. package/planqk/service/client.py +4 -6
  18. package/planqk/service/sdk/__init__.py +58 -8
  19. package/planqk/service/sdk/client.py +27 -7
  20. package/planqk/service/sdk/core/__init__.py +80 -20
  21. package/planqk/service/sdk/core/client_wrapper.py +8 -6
  22. package/planqk/service/sdk/core/force_multipart.py +4 -2
  23. package/planqk/service/sdk/core/http_response.py +1 -1
  24. package/planqk/service/sdk/core/http_sse/__init__.py +42 -0
  25. package/planqk/service/sdk/core/http_sse/_api.py +112 -0
  26. package/planqk/service/sdk/core/http_sse/_decoders.py +61 -0
  27. package/planqk/service/sdk/core/http_sse/_exceptions.py +7 -0
  28. package/planqk/service/sdk/core/http_sse/_models.py +17 -0
  29. package/planqk/service/sdk/core/pydantic_utilities.py +5 -2
  30. package/planqk/service/sdk/core/unchecked_base_model.py +341 -0
  31. package/planqk/service/sdk/service_api/__init__.py +0 -3
  32. package/planqk/service/sdk/service_api/client.py +17 -21
  33. package/planqk/service/sdk/service_api/raw_client.py +36 -40
  34. package/planqk/service/sdk/types/__init__.py +54 -4
  35. package/planqk/service/sdk/types/hal_link.py +3 -2
  36. package/planqk/service/sdk/types/log_entry.py +23 -0
  37. package/planqk/service/sdk/types/request_body.py +5 -0
  38. package/planqk/service/sdk/types/result_response.py +27 -0
  39. package/planqk/service/sdk/{service_api/types/get_result_response_embedded.py → types/result_response_embedded.py} +4 -3
  40. package/planqk/service/sdk/{service_api/types/get_result_response_links.py → types/result_response_links.py} +4 -3
  41. package/planqk/service/sdk/types/service_execution.py +3 -2
  42. package/pyproject.toml +1 -1
  43. package/requirements-dev.txt +367 -288
  44. package/requirements.txt +156 -113
  45. package/src/sdk/Client.ts +2 -2
  46. package/src/sdk/api/resources/serviceApi/client/Client.ts +15 -7
  47. package/src/sdk/api/types/LogEntry.ts +9 -0
  48. package/src/sdk/api/types/index.ts +1 -0
  49. package/uv.lock +395 -301
  50. package/planqk/__init__.py +0 -0
  51. package/planqk/service/sdk/service_api/types/__init__.py +0 -9
  52. package/planqk/service/sdk/service_api/types/get_result_response.py +0 -26
@@ -8,10 +8,12 @@ from ..core.api_error import ApiError
8
8
  from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
9
  from ..core.http_response import AsyncHttpResponse, HttpResponse
10
10
  from ..core.jsonable_encoder import jsonable_encoder
11
- from ..core.pydantic_utilities import parse_obj_as
12
11
  from ..core.request_options import RequestOptions
12
+ from ..core.unchecked_base_model import construct_type
13
+ from ..types.log_entry import LogEntry
14
+ from ..types.request_body import RequestBody
15
+ from ..types.result_response import ResultResponse
13
16
  from ..types.service_execution import ServiceExecution
14
- from .types.get_result_response import GetResultResponse
15
17
 
16
18
  # this is used as the default value for optional parameters
17
19
  OMIT = typing.cast(typing.Any, ...)
@@ -46,7 +48,7 @@ class RawServiceApiClient:
46
48
  if 200 <= _response.status_code < 300:
47
49
  _data = typing.cast(
48
50
  typing.List[ServiceExecution],
49
- parse_obj_as(
51
+ construct_type(
50
52
  type_=typing.List[ServiceExecution], # type: ignore
51
53
  object_=_response.json(),
52
54
  ),
@@ -58,10 +60,7 @@ class RawServiceApiClient:
58
60
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
59
61
 
60
62
  def start_execution(
61
- self,
62
- *,
63
- request: typing.Dict[str, typing.Optional[typing.Any]],
64
- request_options: typing.Optional[RequestOptions] = None,
63
+ self, *, request: RequestBody, request_options: typing.Optional[RequestOptions] = None
65
64
  ) -> HttpResponse[ServiceExecution]:
66
65
  """
67
66
  Starts a service execution, which in turn is processed asynchronously.
@@ -69,7 +68,7 @@ class RawServiceApiClient:
69
68
 
70
69
  Parameters
71
70
  ----------
72
- request : typing.Dict[str, typing.Optional[typing.Any]]
71
+ request : RequestBody
73
72
 
74
73
  request_options : typing.Optional[RequestOptions]
75
74
  Request-specific configuration.
@@ -92,7 +91,7 @@ class RawServiceApiClient:
92
91
  if 200 <= _response.status_code < 300:
93
92
  _data = typing.cast(
94
93
  ServiceExecution,
95
- parse_obj_as(
94
+ construct_type(
96
95
  type_=ServiceExecution, # type: ignore
97
96
  object_=_response.json(),
98
97
  ),
@@ -132,7 +131,7 @@ class RawServiceApiClient:
132
131
  if 200 <= _response.status_code < 300:
133
132
  _data = typing.cast(
134
133
  ServiceExecution,
135
- parse_obj_as(
134
+ construct_type(
136
135
  type_=ServiceExecution, # type: ignore
137
136
  object_=_response.json(),
138
137
  ),
@@ -145,7 +144,7 @@ class RawServiceApiClient:
145
144
 
146
145
  def get_result(
147
146
  self, id: str, *, request_options: typing.Optional[RequestOptions] = None
148
- ) -> HttpResponse[GetResultResponse]:
147
+ ) -> HttpResponse[ResultResponse]:
149
148
  """
150
149
  Retrieves the result of a service execution.
151
150
  The result is returned as a JSON object containing the status and any additional data.
@@ -161,7 +160,7 @@ class RawServiceApiClient:
161
160
 
162
161
  Returns
163
162
  -------
164
- HttpResponse[GetResultResponse]
163
+ HttpResponse[ResultResponse]
165
164
  The service execution result
166
165
  """
167
166
  _response = self._client_wrapper.httpx_client.request(
@@ -172,9 +171,9 @@ class RawServiceApiClient:
172
171
  try:
173
172
  if 200 <= _response.status_code < 300:
174
173
  _data = typing.cast(
175
- GetResultResponse,
176
- parse_obj_as(
177
- type_=GetResultResponse, # type: ignore
174
+ ResultResponse,
175
+ construct_type(
176
+ type_=ResultResponse, # type: ignore
178
177
  object_=_response.json(),
179
178
  ),
180
179
  )
@@ -234,7 +233,7 @@ class RawServiceApiClient:
234
233
 
235
234
  def get_logs(
236
235
  self, id: str, *, request_options: typing.Optional[RequestOptions] = None
237
- ) -> HttpResponse[typing.List[str]]:
236
+ ) -> HttpResponse[typing.List[LogEntry]]:
238
237
  """
239
238
  Returns a list of log entries for a service execution in chronological order, where the first entry is the oldest.
240
239
 
@@ -248,7 +247,7 @@ class RawServiceApiClient:
248
247
 
249
248
  Returns
250
249
  -------
251
- HttpResponse[typing.List[str]]
250
+ HttpResponse[typing.List[LogEntry]]
252
251
  List of log entries
253
252
  """
254
253
  _response = self._client_wrapper.httpx_client.request(
@@ -259,9 +258,9 @@ class RawServiceApiClient:
259
258
  try:
260
259
  if 200 <= _response.status_code < 300:
261
260
  _data = typing.cast(
262
- typing.List[str],
263
- parse_obj_as(
264
- type_=typing.List[str], # type: ignore
261
+ typing.List[LogEntry],
262
+ construct_type(
263
+ type_=typing.List[LogEntry], # type: ignore
265
264
  object_=_response.json(),
266
265
  ),
267
266
  )
@@ -299,7 +298,7 @@ class RawServiceApiClient:
299
298
  if 200 <= _response.status_code < 300:
300
299
  _data = typing.cast(
301
300
  ServiceExecution,
302
- parse_obj_as(
301
+ construct_type(
303
302
  type_=ServiceExecution, # type: ignore
304
303
  object_=_response.json(),
305
304
  ),
@@ -340,7 +339,7 @@ class AsyncRawServiceApiClient:
340
339
  if 200 <= _response.status_code < 300:
341
340
  _data = typing.cast(
342
341
  typing.List[ServiceExecution],
343
- parse_obj_as(
342
+ construct_type(
344
343
  type_=typing.List[ServiceExecution], # type: ignore
345
344
  object_=_response.json(),
346
345
  ),
@@ -352,10 +351,7 @@ class AsyncRawServiceApiClient:
352
351
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
353
352
 
354
353
  async def start_execution(
355
- self,
356
- *,
357
- request: typing.Dict[str, typing.Optional[typing.Any]],
358
- request_options: typing.Optional[RequestOptions] = None,
354
+ self, *, request: RequestBody, request_options: typing.Optional[RequestOptions] = None
359
355
  ) -> AsyncHttpResponse[ServiceExecution]:
360
356
  """
361
357
  Starts a service execution, which in turn is processed asynchronously.
@@ -363,7 +359,7 @@ class AsyncRawServiceApiClient:
363
359
 
364
360
  Parameters
365
361
  ----------
366
- request : typing.Dict[str, typing.Optional[typing.Any]]
362
+ request : RequestBody
367
363
 
368
364
  request_options : typing.Optional[RequestOptions]
369
365
  Request-specific configuration.
@@ -386,7 +382,7 @@ class AsyncRawServiceApiClient:
386
382
  if 200 <= _response.status_code < 300:
387
383
  _data = typing.cast(
388
384
  ServiceExecution,
389
- parse_obj_as(
385
+ construct_type(
390
386
  type_=ServiceExecution, # type: ignore
391
387
  object_=_response.json(),
392
388
  ),
@@ -426,7 +422,7 @@ class AsyncRawServiceApiClient:
426
422
  if 200 <= _response.status_code < 300:
427
423
  _data = typing.cast(
428
424
  ServiceExecution,
429
- parse_obj_as(
425
+ construct_type(
430
426
  type_=ServiceExecution, # type: ignore
431
427
  object_=_response.json(),
432
428
  ),
@@ -439,7 +435,7 @@ class AsyncRawServiceApiClient:
439
435
 
440
436
  async def get_result(
441
437
  self, id: str, *, request_options: typing.Optional[RequestOptions] = None
442
- ) -> AsyncHttpResponse[GetResultResponse]:
438
+ ) -> AsyncHttpResponse[ResultResponse]:
443
439
  """
444
440
  Retrieves the result of a service execution.
445
441
  The result is returned as a JSON object containing the status and any additional data.
@@ -455,7 +451,7 @@ class AsyncRawServiceApiClient:
455
451
 
456
452
  Returns
457
453
  -------
458
- AsyncHttpResponse[GetResultResponse]
454
+ AsyncHttpResponse[ResultResponse]
459
455
  The service execution result
460
456
  """
461
457
  _response = await self._client_wrapper.httpx_client.request(
@@ -466,9 +462,9 @@ class AsyncRawServiceApiClient:
466
462
  try:
467
463
  if 200 <= _response.status_code < 300:
468
464
  _data = typing.cast(
469
- GetResultResponse,
470
- parse_obj_as(
471
- type_=GetResultResponse, # type: ignore
465
+ ResultResponse,
466
+ construct_type(
467
+ type_=ResultResponse, # type: ignore
472
468
  object_=_response.json(),
473
469
  ),
474
470
  )
@@ -529,7 +525,7 @@ class AsyncRawServiceApiClient:
529
525
 
530
526
  async def get_logs(
531
527
  self, id: str, *, request_options: typing.Optional[RequestOptions] = None
532
- ) -> AsyncHttpResponse[typing.List[str]]:
528
+ ) -> AsyncHttpResponse[typing.List[LogEntry]]:
533
529
  """
534
530
  Returns a list of log entries for a service execution in chronological order, where the first entry is the oldest.
535
531
 
@@ -543,7 +539,7 @@ class AsyncRawServiceApiClient:
543
539
 
544
540
  Returns
545
541
  -------
546
- AsyncHttpResponse[typing.List[str]]
542
+ AsyncHttpResponse[typing.List[LogEntry]]
547
543
  List of log entries
548
544
  """
549
545
  _response = await self._client_wrapper.httpx_client.request(
@@ -554,9 +550,9 @@ class AsyncRawServiceApiClient:
554
550
  try:
555
551
  if 200 <= _response.status_code < 300:
556
552
  _data = typing.cast(
557
- typing.List[str],
558
- parse_obj_as(
559
- type_=typing.List[str], # type: ignore
553
+ typing.List[LogEntry],
554
+ construct_type(
555
+ type_=typing.List[LogEntry], # type: ignore
560
556
  object_=_response.json(),
561
557
  ),
562
558
  )
@@ -594,7 +590,7 @@ class AsyncRawServiceApiClient:
594
590
  if 200 <= _response.status_code < 300:
595
591
  _data = typing.cast(
596
592
  ServiceExecution,
597
- parse_obj_as(
593
+ construct_type(
598
594
  type_=ServiceExecution, # type: ignore
599
595
  object_=_response.json(),
600
596
  ),
@@ -2,8 +2,58 @@
2
2
 
3
3
  # isort: skip_file
4
4
 
5
- from .hal_link import HalLink
6
- from .service_execution import ServiceExecution
7
- from .service_execution_status import ServiceExecutionStatus
5
+ import typing
6
+ from importlib import import_module
8
7
 
9
- __all__ = ["HalLink", "ServiceExecution", "ServiceExecutionStatus"]
8
+ if typing.TYPE_CHECKING:
9
+ from .hal_link import HalLink
10
+ from .log_entry import LogEntry
11
+ from .request_body import RequestBody
12
+ from .result_response import ResultResponse
13
+ from .result_response_embedded import ResultResponseEmbedded
14
+ from .result_response_links import ResultResponseLinks
15
+ from .service_execution import ServiceExecution
16
+ from .service_execution_status import ServiceExecutionStatus
17
+ _dynamic_imports: typing.Dict[str, str] = {
18
+ "HalLink": ".hal_link",
19
+ "LogEntry": ".log_entry",
20
+ "RequestBody": ".request_body",
21
+ "ResultResponse": ".result_response",
22
+ "ResultResponseEmbedded": ".result_response_embedded",
23
+ "ResultResponseLinks": ".result_response_links",
24
+ "ServiceExecution": ".service_execution",
25
+ "ServiceExecutionStatus": ".service_execution_status",
26
+ }
27
+
28
+
29
+ def __getattr__(attr_name: str) -> typing.Any:
30
+ module_name = _dynamic_imports.get(attr_name)
31
+ if module_name is None:
32
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
33
+ try:
34
+ module = import_module(module_name, __package__)
35
+ if module_name == f".{attr_name}":
36
+ return module
37
+ else:
38
+ return getattr(module, attr_name)
39
+ except ImportError as e:
40
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
41
+ except AttributeError as e:
42
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
43
+
44
+
45
+ def __dir__():
46
+ lazy_attrs = list(_dynamic_imports.keys())
47
+ return sorted(lazy_attrs)
48
+
49
+
50
+ __all__ = [
51
+ "HalLink",
52
+ "LogEntry",
53
+ "RequestBody",
54
+ "ResultResponse",
55
+ "ResultResponseEmbedded",
56
+ "ResultResponseLinks",
57
+ "ServiceExecution",
58
+ "ServiceExecutionStatus",
59
+ ]
@@ -3,10 +3,11 @@
3
3
  import typing
4
4
 
5
5
  import pydantic
6
- from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
6
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
+ from ..core.unchecked_base_model import UncheckedBaseModel
7
8
 
8
9
 
9
- class HalLink(UniversalBaseModel):
10
+ class HalLink(UncheckedBaseModel):
10
11
  href: typing.Optional[str] = pydantic.Field(default=None)
11
12
  """
12
13
  The URL of the link
@@ -0,0 +1,23 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import datetime as dt
4
+ import typing
5
+
6
+ import pydantic
7
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
8
+ from ..core.unchecked_base_model import UncheckedBaseModel
9
+
10
+
11
+ class LogEntry(UncheckedBaseModel):
12
+ message: typing.Optional[str] = None
13
+ severity: typing.Optional[str] = None
14
+ timestamp: typing.Optional[dt.datetime] = None
15
+
16
+ if IS_PYDANTIC_V2:
17
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
18
+ else:
19
+
20
+ class Config:
21
+ frozen = True
22
+ smart_union = True
23
+ extra = pydantic.Extra.allow
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ RequestBody = typing.Dict[str, typing.Optional[typing.Any]]
@@ -0,0 +1,27 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import pydantic
6
+ import typing_extensions
7
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
8
+ from ..core.serialization import FieldMetadata
9
+ from ..core.unchecked_base_model import UncheckedBaseModel
10
+ from .result_response_embedded import ResultResponseEmbedded
11
+ from .result_response_links import ResultResponseLinks
12
+
13
+
14
+ class ResultResponse(UncheckedBaseModel):
15
+ links: typing_extensions.Annotated[typing.Optional[ResultResponseLinks], FieldMetadata(alias="_links")] = None
16
+ embedded: typing_extensions.Annotated[typing.Optional[ResultResponseEmbedded], FieldMetadata(alias="_embedded")] = (
17
+ None
18
+ )
19
+
20
+ if IS_PYDANTIC_V2:
21
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
22
+ else:
23
+
24
+ class Config:
25
+ frozen = True
26
+ smart_union = True
27
+ extra = pydantic.Extra.allow
@@ -3,11 +3,12 @@
3
3
  import typing
4
4
 
5
5
  import pydantic
6
- from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
- from ...types.service_execution import ServiceExecution
6
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
+ from ..core.unchecked_base_model import UncheckedBaseModel
8
+ from .service_execution import ServiceExecution
8
9
 
9
10
 
10
- class GetResultResponseEmbedded(UniversalBaseModel):
11
+ class ResultResponseEmbedded(UncheckedBaseModel):
11
12
  status: typing.Optional[ServiceExecution] = None
12
13
 
13
14
  if IS_PYDANTIC_V2:
@@ -3,11 +3,12 @@
3
3
  import typing
4
4
 
5
5
  import pydantic
6
- from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
- from ...types.hal_link import HalLink
6
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
+ from ..core.unchecked_base_model import UncheckedBaseModel
8
+ from .hal_link import HalLink
8
9
 
9
10
 
10
- class GetResultResponseLinks(UniversalBaseModel):
11
+ class ResultResponseLinks(UncheckedBaseModel):
11
12
  status: typing.Optional[HalLink] = None
12
13
 
13
14
  if IS_PYDANTIC_V2:
@@ -4,12 +4,13 @@ import typing
4
4
 
5
5
  import pydantic
6
6
  import typing_extensions
7
- from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
8
8
  from ..core.serialization import FieldMetadata
9
+ from ..core.unchecked_base_model import UncheckedBaseModel
9
10
  from .service_execution_status import ServiceExecutionStatus
10
11
 
11
12
 
12
- class ServiceExecution(UniversalBaseModel):
13
+ class ServiceExecution(UncheckedBaseModel):
13
14
  id: typing.Optional[str] = None
14
15
  status: typing.Optional[ServiceExecutionStatus] = None
15
16
  created_at: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="createdAt")] = None
package/pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "planqk-service-sdk"
3
- version = "2.6.0"
3
+ version = "2.7.0"
4
4
  description = "SDK to interact with PLANQK Managed Services."
5
5
  authors = [
6
6
  { name = "Kipu Quantum GmbH", email = "info@kipu-quantum.com" },