@planqk/planqk-api-sdk 1.3.0 → 1.3.4

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 (36) hide show
  1. package/.fossa.yml +8 -0
  2. package/.gitlab-ci.yml +34 -5
  3. package/apps/README.md +24 -0
  4. package/apps/python-test-app/main.py +3 -3
  5. package/apps/test-file.txt +1 -0
  6. package/apps/ts-test-app/index.ts +8 -8
  7. package/apps/ts-test-app/package-lock.json +8 -6
  8. package/apps/ts-test-app/package.json +5 -9
  9. package/notebooks/python-sdk.ipynb +2 -1
  10. package/package.json +1 -1
  11. package/planqk/api/_version.py +1 -1
  12. package/planqk/api/client.py +5 -2
  13. package/planqk/api/sdk/__init__.py +2 -34
  14. package/planqk/api/sdk/client.py +0 -3
  15. package/planqk/api/sdk/types/__init__.py +1 -30
  16. package/pyproject.toml +3 -1
  17. package/uv.lock +642 -331
  18. package/apps/python-test-app/my_file.txt +0 -1
  19. package/apps/ts-test-app/test-file.txt +0 -1
  20. package/planqk/api/sdk/authentication/__init__.py +0 -7
  21. package/planqk/api/sdk/authentication/client.py +0 -102
  22. package/planqk/api/sdk/authentication/raw_client.py +0 -183
  23. package/planqk/api/sdk/authentication/types/__init__.py +0 -7
  24. package/planqk/api/sdk/authentication/types/authorize_response.py +0 -8
  25. package/planqk/api/sdk/types/access_token.py +0 -26
  26. package/planqk/api/sdk/types/organization_membership.py +0 -27
  27. package/planqk/api/sdk/types/organization_membership_account_type.py +0 -5
  28. package/planqk/api/sdk/types/organization_membership_role.py +0 -5
  29. package/planqk/api/sdk/types/personal_access_token_principal.py +0 -31
  30. package/planqk/api/sdk/types/personal_access_token_principal_account_type.py +0 -5
  31. package/planqk/api/sdk/types/service_execution.py +0 -27
  32. package/planqk/api/sdk/types/service_execution_status.py +0 -7
  33. package/planqk/api/sdk/types/service_execution_token_principal.py +0 -34
  34. package/planqk/api/sdk/types/user_context.py +0 -35
  35. package/planqk/api/sdk/types/user_context_account_type.py +0 -5
  36. package/planqk/api/sdk/types/user_context_context_type.py +0 -5
package/.fossa.yml ADDED
@@ -0,0 +1,8 @@
1
+ version: 3
2
+ project:
3
+ id: "git@gitlab.com:planqk-foss/planqk-api-sdk.git"
4
+ name: "Platform-API-SDK"
5
+ labels:
6
+ - "Platform"
7
+ - "Open Source"
8
+ - "PLANQK"
package/.gitlab-ci.yml CHANGED
@@ -10,6 +10,8 @@ variables:
10
10
 
11
11
  stages:
12
12
  - commit-test
13
+ - install
14
+ - compliance
13
15
  - commit-release-check
14
16
  - release-package
15
17
 
@@ -21,8 +23,6 @@ semantic-release:
21
23
  - if: '$CI_PIPELINE_SOURCE == "web"'
22
24
  - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
23
25
  variables:
24
- ## Use the gitlab user to create the release commit
25
- ## https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#git-environment-variables
26
26
  GIT_AUTHOR_NAME: "$GITLAB_USER_NAME"
27
27
  GIT_AUTHOR_EMAIL: "$GITLAB_USER_EMAIL"
28
28
  GIT_COMMITTER_NAME: "$GITLAB_USER_NAME"
@@ -34,14 +34,39 @@ semantic-release:
34
34
  script:
35
35
  - semantic-release
36
36
 
37
+ install:
38
+ stage: install
39
+ rules:
40
+ - if: '$CI_COMMIT_TAG'
41
+ image: ghcr.io/astral-sh/uv:$UV_VERSION-python$PYTHON_VERSION-$BASE_LAYER
42
+ script:
43
+ - uv sync --frozen --no-dev
44
+ artifacts:
45
+ expire_in: 1 hour
46
+ paths:
47
+ - .venv
48
+
49
+ oss-compliance-check:
50
+ stage: compliance
51
+ rules:
52
+ - if: "$CI_COMMIT_TAG"
53
+ image: ubuntu:latest
54
+ before_script:
55
+ - apt-get update && apt-get install -y --no-install-recommends ca-certificates curl
56
+ - curl https://raw.githubusercontent.com/fossas/fossa-cli/master/install-latest.sh | bash
57
+ - source .venv/bin/activate
58
+ script:
59
+ - FOSSA_REVISION=$([ -z $CI_COMMIT_TAG ] && echo $CI_COMMIT_SHA || echo $CI_COMMIT_TAG)
60
+ - FOSSA_BRANCH=$([ -z $CI_COMMIT_BRANCH ] && echo 'main' || echo $CI_COMMIT_BRANCH)
61
+ - fossa analyze -b $FOSSA_BRANCH -r $FOSSA_REVISION .
62
+ - fossa test -r $FOSSA_REVISION
63
+
37
64
  publish-python-sdk:
38
65
  stage: release-package
39
66
  rules:
40
67
  - if: '$CI_COMMIT_TAG'
41
68
  image: ghcr.io/astral-sh/uv:$UV_VERSION-python$PYTHON_VERSION-$BASE_LAYER
42
69
  before_script:
43
- - uv venv
44
- - uv sync --frozen
45
70
  - source .venv/bin/activate
46
71
  - uv pip install twine
47
72
  script:
@@ -66,7 +91,11 @@ publish-node-sdk:
66
91
  - cp README-node.md README.md
67
92
  - npm run build
68
93
  - npm publish
94
+ artifacts:
95
+ expire_in: 1 hour
96
+ paths:
97
+ - dist
69
98
  cache:
70
- key: $CI_JOB_NAME
99
+ key: node_modules
71
100
  paths:
72
101
  - node_modules
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.4",
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.4"
@@ -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,12 +1,13 @@
1
1
  [project]
2
2
  name = "planqk-api-sdk"
3
- version = "1.3.0"
3
+ version = "1.3.4"
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" },
7
7
  ]
8
8
  maintainers = [
9
9
  { name = "Michael Wurster", email = "michael.wurster@kipu-quantum.com" },
10
+ { name = "Lukas Harzenetter", email = "lukas.harzenetter@kipu-quantum.com" },
10
11
  ]
11
12
  classifiers = [
12
13
  "Programming Language :: Python :: 3",
@@ -18,6 +19,7 @@ license = { file = "LICENSE" }
18
19
  requires-python = ">=3.9"
19
20
  dependencies = [
20
21
  "authlib>=1.5.1",
22
+ "deprecated>=1.2.18",
21
23
  "httpx>=0.28.1",
22
24
  "pydantic>=2.5.0,<2.10",
23
25
  ]