@planqk/planqk-api-sdk 1.3.0 → 1.3.1

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 (34) hide show
  1. package/apps/README.md +24 -0
  2. package/apps/python-test-app/main.py +3 -3
  3. package/apps/test-file.txt +1 -0
  4. package/apps/ts-test-app/index.ts +8 -8
  5. package/apps/ts-test-app/package-lock.json +8 -6
  6. package/apps/ts-test-app/package.json +5 -9
  7. package/notebooks/python-sdk.ipynb +2 -1
  8. package/package.json +1 -1
  9. package/planqk/api/_version.py +1 -1
  10. package/planqk/api/client.py +5 -2
  11. package/planqk/api/sdk/__init__.py +2 -34
  12. package/planqk/api/sdk/client.py +0 -3
  13. package/planqk/api/sdk/types/__init__.py +1 -30
  14. package/pyproject.toml +2 -1
  15. package/uv.lock +352 -41
  16. package/apps/python-test-app/my_file.txt +0 -1
  17. package/apps/ts-test-app/test-file.txt +0 -1
  18. package/planqk/api/sdk/authentication/__init__.py +0 -7
  19. package/planqk/api/sdk/authentication/client.py +0 -102
  20. package/planqk/api/sdk/authentication/raw_client.py +0 -183
  21. package/planqk/api/sdk/authentication/types/__init__.py +0 -7
  22. package/planqk/api/sdk/authentication/types/authorize_response.py +0 -8
  23. package/planqk/api/sdk/types/access_token.py +0 -26
  24. package/planqk/api/sdk/types/organization_membership.py +0 -27
  25. package/planqk/api/sdk/types/organization_membership_account_type.py +0 -5
  26. package/planqk/api/sdk/types/organization_membership_role.py +0 -5
  27. package/planqk/api/sdk/types/personal_access_token_principal.py +0 -31
  28. package/planqk/api/sdk/types/personal_access_token_principal_account_type.py +0 -5
  29. package/planqk/api/sdk/types/service_execution.py +0 -27
  30. package/planqk/api/sdk/types/service_execution_status.py +0 -7
  31. package/planqk/api/sdk/types/service_execution_token_principal.py +0 -34
  32. package/planqk/api/sdk/types/user_context.py +0 -35
  33. package/planqk/api/sdk/types/user_context_account_type.py +0 -5
  34. package/planqk/api/sdk/types/user_context_context_type.py +0 -5
package/apps/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # Test Applications
2
+
3
+ This directory contains test applications for both TypeScript and Python SDKs.
4
+
5
+ ## TypeScript Test App
6
+
7
+ To run the TypeScript test application:
8
+
9
+ ```bash
10
+ cd ts-test-app
11
+ npm install
12
+ npm run start
13
+ ```
14
+
15
+ ## Python Test App
16
+
17
+ To run the Python test application:
18
+
19
+ ```bash
20
+ cd python-test-app
21
+ uv run main.py
22
+ ```
23
+
24
+ > Note: Ensure you have created a virtual environment based on the `pyproject.toml` in the root directory.
@@ -15,7 +15,7 @@ def main():
15
15
 
16
16
  # Initialize client with environment variables
17
17
  client = PlanqkApiClient(
18
- access_token=os.getenv("PLANQK_ACCESS_TOKEN"),
18
+ access_token=os.getenv("PLANQK_PERSONAL_ACCESS_TOKEN"),
19
19
  organization_id=os.getenv("PLANQK_ORGANIZATION_ID")
20
20
  )
21
21
 
@@ -64,7 +64,7 @@ def main():
64
64
  # Add a File to a Data Pool
65
65
  start_time = time.time()
66
66
  print("\nAdding a file to the Data Pool...")
67
- file_to_upload = "my_file.txt"
67
+ file_to_upload = "../test-file.txt"
68
68
  with open(file_to_upload, "rb") as f:
69
69
  added_file = client.data_pools.add_data_pool_file(
70
70
  id=data_pool_id,
@@ -113,7 +113,7 @@ def main():
113
113
  response = client.data_pools.get_data_pool_file(data_pool_id, download_file_id)
114
114
 
115
115
  # Save the downloaded file
116
- downloaded_filename = "downloaded-test-file.txt"
116
+ downloaded_filename = "../downloaded-test-file.txt"
117
117
  with open(downloaded_filename, "wb") as f:
118
118
  for chunk in response:
119
119
  f.write(chunk)
@@ -0,0 +1 @@
1
+ This is a test file for the PLANQK API SDK.
@@ -1,13 +1,13 @@
1
- import {PlanqkApiClient} from "@planqk/planqk-api-sdk"
1
+ import * as dotenv from "dotenv";
2
2
  import * as fs from "fs";
3
3
  import {Readable} from "stream";
4
- import * as dotenv from "dotenv";
4
+ import {PlanqkApiClient} from "@planqk/planqk-api-sdk"
5
5
 
6
6
  dotenv.config();
7
7
 
8
8
  const client = new PlanqkApiClient({
9
- apiKey: process.env.PLANQK_ACCESS_TOKEN!,
10
- baseUrl: process.env.PLANQK_API_BASE_URL || "https://platform.planqk.de/qc-catalog",
9
+ baseUrl: process.env.PLANQK_API_BASE_URL!,
10
+ apiKey: process.env.PLANQK_PERSONAL_ACCESS_TOKEN!,
11
11
  organizationId: process.env.PLANQK_ORGANIZATION_ID
12
12
  });
13
13
 
@@ -59,8 +59,8 @@ async function main() {
59
59
  console.time("Add File");
60
60
  console.log("\nAdding a file to the Data Pool...");
61
61
  const addedFile = await client.dataPools.addDataPoolFile(dataPoolId, {
62
- file: fs.createReadStream("test-file.txt"),
63
- filename: "my-test-file.txt",
62
+ file: fs.createReadStream("../test-file.txt"),
63
+ filename: "test-file.txt",
64
64
  });
65
65
  const fileId = addedFile.id!;
66
66
  console.log(`Added File with ID: ${addedFile.id}, Name: ${addedFile.name}`);
@@ -98,7 +98,7 @@ async function main() {
98
98
  console.time("Download File");
99
99
  console.log("\nDownloading the file from the Data Pool...");
100
100
  const response = await client.dataPools.getDataPoolFile(dataPoolId, fileId);
101
- const dest = fs.createWriteStream("test-file.txt");
101
+ const dest = fs.createWriteStream("../downloaded-test-file.txt");
102
102
  Readable.fromWeb(response.stream() as any).pipe(dest);
103
103
  await new Promise<void>((resolve) => dest.on("finish", () => resolve())); // Wait for download to complete
104
104
  console.log("File downloaded to downloaded-test-file.txt.");
@@ -137,4 +137,4 @@ async function main() {
137
137
  console.log("\n--- All documented calls tested ---");
138
138
  }
139
139
 
140
- main().catch(console.error);
140
+ main().catch(console.error);
@@ -8,11 +8,11 @@
8
8
  "name": "ts-test-app",
9
9
  "version": "1.0.0",
10
10
  "dependencies": {
11
- "@planqk/planqk-api-sdk": "^1.2.0",
12
- "@types/node": "^20.14.10"
11
+ "@planqk/planqk-api-sdk": "^1"
13
12
  },
14
13
  "devDependencies": {
15
- "typescript": "^5.8.3"
14
+ "@types/node": "^22",
15
+ "typescript": "^5"
16
16
  }
17
17
  },
18
18
  "node_modules/@planqk/planqk-api-sdk": {
@@ -32,9 +32,10 @@
32
32
  }
33
33
  },
34
34
  "node_modules/@types/node": {
35
- "version": "20.19.9",
36
- "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.9.tgz",
37
- "integrity": "sha512-cuVNgarYWZqxRJDQHEB58GEONhOK79QVR/qYx4S7kcUObQvUwvFnYxJuuHUKm2aieN9X3yZB4LZsuYNU1Qphsw==",
35
+ "version": "22.17.0",
36
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-22.17.0.tgz",
37
+ "integrity": "sha512-bbAKTCqX5aNVryi7qXVMi+OkB3w/OyblodicMbvE38blyAz7GxXf6XYhklokijuPwwVg9sDLKRxt0ZHXQwZVfQ==",
38
+ "dev": true,
38
39
  "license": "MIT",
39
40
  "dependencies": {
40
41
  "undici-types": "~6.21.0"
@@ -669,6 +670,7 @@
669
670
  "version": "6.21.0",
670
671
  "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
671
672
  "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
673
+ "dev": true,
672
674
  "license": "MIT"
673
675
  },
674
676
  "node_modules/url-join": {
@@ -3,17 +3,13 @@
3
3
  "version": "1.0.0",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
- "start": "npx tsc && node dist/index.js",
7
- "test": "echo \"Error: no test specified\" && exit 1"
6
+ "start": "npx tsc && node dist/index.js"
8
7
  },
9
- "keywords": [],
10
- "author": "",
11
- "description": "",
12
8
  "dependencies": {
13
- "@planqk/planqk-api-sdk": "^1.2.0",
14
- "@types/node": "^20.14.10"
9
+ "@planqk/planqk-api-sdk": "^1"
15
10
  },
16
11
  "devDependencies": {
17
- "typescript": "^5.8.3"
12
+ "typescript": "^5",
13
+ "@types/node": "^22"
18
14
  }
19
- }
15
+ }
@@ -55,6 +55,7 @@
55
55
  "\n",
56
56
  "# Create a new data pool\n",
57
57
  "data_pool = client.data_pools.create_data_pool(name=\"Example Data Pool\")\n",
58
+ "data_pool = client.api.data_pools.get_data_pool(id=data_pool.id)\n",
58
59
  "\n",
59
60
  "# Add a file to the data pool\n",
60
61
  "file = client.data_pools.add_data_pool_file(\n",
@@ -210,7 +211,7 @@
210
211
  "name": "python",
211
212
  "nbconvert_exporter": "python",
212
213
  "pygments_lexer": "ipython3",
213
- "version": "3.11.11"
214
+ "version": "3.11.9"
214
215
  }
215
216
  },
216
217
  "nbformat": 4,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planqk/planqk-api-sdk",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "SDK to interact with the official PLANQK API.",
5
5
  "author": "Kipu Quantum GmbH",
6
6
  "contributors": [
@@ -1 +1 @@
1
- __version__ = "1.3.0"
1
+ __version__ = "1.3.1"
@@ -1,6 +1,8 @@
1
1
  import os
2
2
  from typing import Optional
3
3
 
4
+ from deprecated import deprecated
5
+
4
6
  from planqk.api.credentials import DefaultCredentialsProvider
5
7
  from planqk.api.sdk import PlanqkApi
6
8
  from planqk.api.sdk.data_pools.client import DataPoolsClient
@@ -13,8 +15,9 @@ class PlanqkApiClient:
13
15
  base_url = os.environ.get(_PLANQK_API_BASE_URL_NAME, "https://platform.planqk.de/qc-catalog")
14
16
  credentials_provider = DefaultCredentialsProvider(access_token)
15
17
 
16
- self._api = PlanqkApi(base_url=base_url, api_key=credentials_provider.get_access_token(), organization_id=organization_id)
18
+ self.api = PlanqkApi(base_url=base_url, api_key=credentials_provider.get_access_token(), organization_id=organization_id)
17
19
 
18
20
  @property
21
+ @deprecated(version="1.3.0", reason="Use `api.data_pools` instead.")
19
22
  def data_pools(self) -> DataPoolsClient:
20
- return self._api.data_pools
23
+ return self.api.data_pools
@@ -2,34 +2,14 @@
2
2
 
3
3
  # isort: skip_file
4
4
 
5
- from .types import (
6
- AccessToken,
7
- DataPoolDto,
8
- DataPoolDtoCurrentUserPermission,
9
- DataPoolFileDto,
10
- OauthScope,
11
- OrganizationMembership,
12
- OrganizationMembershipAccountType,
13
- OrganizationMembershipRole,
14
- PersonalAccessTokenPrincipal,
15
- PersonalAccessTokenPrincipalAccountType,
16
- ServiceExecution,
17
- ServiceExecutionStatus,
18
- ServiceExecutionTokenPrincipal,
19
- UserContext,
20
- UserContextAccountType,
21
- UserContextContextType,
22
- )
5
+ from .types import DataPoolDto, DataPoolDtoCurrentUserPermission, DataPoolFileDto, OauthScope
23
6
  from .errors import BadRequestError, ForbiddenError, InternalServerError, NotFoundError, UnauthorizedError
24
- from . import authentication, data_pools
25
- from .authentication import AuthorizeResponse
7
+ from . import data_pools
26
8
  from .client import AsyncPlanqkApi, PlanqkApi
27
9
  from .environment import PlanqkApiEnvironment
28
10
 
29
11
  __all__ = [
30
- "AccessToken",
31
12
  "AsyncPlanqkApi",
32
- "AuthorizeResponse",
33
13
  "BadRequestError",
34
14
  "DataPoolDto",
35
15
  "DataPoolDtoCurrentUserPermission",
@@ -38,20 +18,8 @@ __all__ = [
38
18
  "InternalServerError",
39
19
  "NotFoundError",
40
20
  "OauthScope",
41
- "OrganizationMembership",
42
- "OrganizationMembershipAccountType",
43
- "OrganizationMembershipRole",
44
- "PersonalAccessTokenPrincipal",
45
- "PersonalAccessTokenPrincipalAccountType",
46
21
  "PlanqkApi",
47
22
  "PlanqkApiEnvironment",
48
- "ServiceExecution",
49
- "ServiceExecutionStatus",
50
- "ServiceExecutionTokenPrincipal",
51
23
  "UnauthorizedError",
52
- "UserContext",
53
- "UserContextAccountType",
54
- "UserContextContextType",
55
- "authentication",
56
24
  "data_pools",
57
25
  ]
@@ -3,7 +3,6 @@
3
3
  import typing
4
4
 
5
5
  import httpx
6
- from .authentication.client import AsyncAuthenticationClient, AuthenticationClient
7
6
  from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
7
  from .data_pools.client import AsyncDataPoolsClient, DataPoolsClient
9
8
  from .environment import PlanqkApiEnvironment
@@ -79,7 +78,6 @@ class PlanqkApi:
79
78
  timeout=_defaulted_timeout,
80
79
  )
81
80
  self.data_pools = DataPoolsClient(client_wrapper=self._client_wrapper)
82
- self.authentication = AuthenticationClient(client_wrapper=self._client_wrapper)
83
81
 
84
82
 
85
83
  class AsyncPlanqkApi:
@@ -152,7 +150,6 @@ class AsyncPlanqkApi:
152
150
  timeout=_defaulted_timeout,
153
151
  )
154
152
  self.data_pools = AsyncDataPoolsClient(client_wrapper=self._client_wrapper)
155
- self.authentication = AsyncAuthenticationClient(client_wrapper=self._client_wrapper)
156
153
 
157
154
 
158
155
  def _get_base_url(*, base_url: typing.Optional[str] = None, environment: PlanqkApiEnvironment) -> str:
@@ -2,38 +2,9 @@
2
2
 
3
3
  # isort: skip_file
4
4
 
5
- from .access_token import AccessToken
6
5
  from .data_pool_dto import DataPoolDto
7
6
  from .data_pool_dto_current_user_permission import DataPoolDtoCurrentUserPermission
8
7
  from .data_pool_file_dto import DataPoolFileDto
9
8
  from .oauth_scope import OauthScope
10
- from .organization_membership import OrganizationMembership
11
- from .organization_membership_account_type import OrganizationMembershipAccountType
12
- from .organization_membership_role import OrganizationMembershipRole
13
- from .personal_access_token_principal import PersonalAccessTokenPrincipal
14
- from .personal_access_token_principal_account_type import PersonalAccessTokenPrincipalAccountType
15
- from .service_execution import ServiceExecution
16
- from .service_execution_status import ServiceExecutionStatus
17
- from .service_execution_token_principal import ServiceExecutionTokenPrincipal
18
- from .user_context import UserContext
19
- from .user_context_account_type import UserContextAccountType
20
- from .user_context_context_type import UserContextContextType
21
9
 
22
- __all__ = [
23
- "AccessToken",
24
- "DataPoolDto",
25
- "DataPoolDtoCurrentUserPermission",
26
- "DataPoolFileDto",
27
- "OauthScope",
28
- "OrganizationMembership",
29
- "OrganizationMembershipAccountType",
30
- "OrganizationMembershipRole",
31
- "PersonalAccessTokenPrincipal",
32
- "PersonalAccessTokenPrincipalAccountType",
33
- "ServiceExecution",
34
- "ServiceExecutionStatus",
35
- "ServiceExecutionTokenPrincipal",
36
- "UserContext",
37
- "UserContextAccountType",
38
- "UserContextContextType",
39
- ]
10
+ __all__ = ["DataPoolDto", "DataPoolDtoCurrentUserPermission", "DataPoolFileDto", "OauthScope"]
package/pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "planqk-api-sdk"
3
- version = "1.3.0"
3
+ version = "1.3.1"
4
4
  description = "SDK to interact with the official PLANQK API."
5
5
  authors = [
6
6
  { name = "Kipu Quantum GmbH", email = "info@kipu-quantum.com" },
@@ -18,6 +18,7 @@ license = { file = "LICENSE" }
18
18
  requires-python = ">=3.9"
19
19
  dependencies = [
20
20
  "authlib>=1.5.1",
21
+ "deprecated>=1.2.18",
21
22
  "httpx>=0.28.1",
22
23
  "pydantic>=2.5.0,<2.10",
23
24
  ]