@planqk/planqk-api-sdk 1.6.0 → 1.9.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.
- package/.env.template +3 -3
- package/.gitlab-ci.yml +7 -8
- package/README-node.md +1 -1
- package/README-python.md +1 -1
- package/README.md +1 -1
- package/dist/sdk/environments.d.ts +1 -1
- package/dist/sdk/environments.js +1 -1
- package/fern/openapi/openapi.json +1 -1
- package/package.json +2 -1
- package/planqk/api/_version.py +1 -1
- package/planqk/api/client.py +2 -2
- package/planqk/api/credentials.py +6 -6
- package/planqk/api/sdk/environment.py +1 -1
- package/pyproject.toml +3 -3
- package/src/index.test.ts +4 -8
- package/src/sdk/environments.ts +1 -1
package/.env.template
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
KQH_BASE_URL=https://api.hub.kipu-quantum.com/qc-catalog
|
|
2
|
+
KQH_PERSONAL_ACCESS_TOKEN=
|
|
3
|
+
KQH_ORGANIZATION_ID=
|
package/.gitlab-ci.yml
CHANGED
|
@@ -26,10 +26,6 @@ compile-node-sdk:
|
|
|
26
26
|
- npm ci
|
|
27
27
|
script:
|
|
28
28
|
- npm run build
|
|
29
|
-
artifacts:
|
|
30
|
-
expire_in: 1 hour
|
|
31
|
-
paths:
|
|
32
|
-
- dist
|
|
33
29
|
cache:
|
|
34
30
|
key: node_modules
|
|
35
31
|
paths:
|
|
@@ -77,6 +73,8 @@ publish-python-sdk:
|
|
|
77
73
|
- if: '$CI_COMMIT_TAG'
|
|
78
74
|
image: ghcr.io/astral-sh/uv:$UV_VERSION-python$PYTHON_VERSION-$BASE_LAYER
|
|
79
75
|
before_script:
|
|
76
|
+
- uv venv
|
|
77
|
+
- uv sync --frozen
|
|
80
78
|
- source .venv/bin/activate
|
|
81
79
|
- uv pip install twine
|
|
82
80
|
script:
|
|
@@ -94,6 +92,11 @@ publish-node-sdk:
|
|
|
94
92
|
rules:
|
|
95
93
|
- if: '$CI_COMMIT_TAG'
|
|
96
94
|
image: node:lts
|
|
95
|
+
id_tokens:
|
|
96
|
+
NPM_ID_TOKEN:
|
|
97
|
+
aud: "npm:registry.npmjs.org"
|
|
98
|
+
SIGSTORE_ID_TOKEN:
|
|
99
|
+
aud: sigstore
|
|
97
100
|
before_script:
|
|
98
101
|
- npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
|
|
99
102
|
script:
|
|
@@ -101,10 +104,6 @@ publish-node-sdk:
|
|
|
101
104
|
- cp README-node.md README.md
|
|
102
105
|
- npm run build
|
|
103
106
|
- npm publish
|
|
104
|
-
artifacts:
|
|
105
|
-
expire_in: 1 hour
|
|
106
|
-
paths:
|
|
107
|
-
- dist
|
|
108
107
|
cache:
|
|
109
108
|
key: node_modules
|
|
110
109
|
paths:
|
package/README-node.md
CHANGED
package/README-python.md
CHANGED
package/README.md
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
export declare const PlanqkApiEnvironment: {
|
|
5
|
-
readonly Default: "https://
|
|
5
|
+
readonly Default: "https://api.hub.kipu-quantum.com/qc-catalog";
|
|
6
6
|
};
|
|
7
7
|
export type PlanqkApiEnvironment = typeof PlanqkApiEnvironment.Default;
|
package/dist/sdk/environments.js
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planqk/planqk-api-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "SDK to interact with the official PLANQK API.",
|
|
5
5
|
"author": "Kipu Quantum GmbH",
|
|
6
6
|
"contributors": [
|
|
7
|
+
"Harzenetter, Lukas <lukas.harzenetter@kipu-quantum.com>",
|
|
7
8
|
"Wurster, Michael <michael.wurster@kipu-quantum.com>"
|
|
8
9
|
],
|
|
9
10
|
"license": "Apache-2.0",
|
package/planqk/api/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "1.
|
|
1
|
+
__version__ = "1.9.0"
|
package/planqk/api/client.py
CHANGED
|
@@ -7,12 +7,12 @@ from planqk.api.credentials import DefaultCredentialsProvider
|
|
|
7
7
|
from planqk.api.sdk import PlanqkApi
|
|
8
8
|
from planqk.api.sdk.data_pools.client import DataPoolsClient
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
_BASE_URL = "KQH_BASE_URL"
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class PlanqkApiClient:
|
|
14
14
|
def __init__(self, access_token: Optional[str] = None, organization_id: Optional[str] = None):
|
|
15
|
-
base_url = os.environ.get(
|
|
15
|
+
base_url = os.environ.get(_BASE_URL, "https://api.hub.kipu-quantum.com/qc-catalog")
|
|
16
16
|
credentials_provider = DefaultCredentialsProvider(access_token)
|
|
17
17
|
|
|
18
18
|
self.api = PlanqkApi(base_url=base_url, api_key=credentials_provider.get_access_token(), organization_id=organization_id)
|
|
@@ -4,8 +4,8 @@ import platform
|
|
|
4
4
|
from abc import ABC, abstractmethod
|
|
5
5
|
from json import JSONDecodeError
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
_CONFIG_FILE_PATH = "
|
|
7
|
+
_PERSONAL_ACCESS_TOKEN = "KQH_PERSONAL_ACCESS_TOKEN"
|
|
8
|
+
_CONFIG_FILE_PATH = "KQH_CONFIG_FILE_PATH"
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class CredentialUnavailableError(Exception):
|
|
@@ -15,7 +15,7 @@ class CredentialUnavailableError(Exception):
|
|
|
15
15
|
|
|
16
16
|
def __init__(self, message=None):
|
|
17
17
|
if message is None:
|
|
18
|
-
message =
|
|
18
|
+
message = "Credentials not found. Please set your personal access token as parameter, in the environment, or use 'planqk login' to authenticate."
|
|
19
19
|
super().__init__(message)
|
|
20
20
|
|
|
21
21
|
|
|
@@ -29,10 +29,10 @@ class CredentialProvider(ABC):
|
|
|
29
29
|
class EnvironmentCredential(CredentialProvider):
|
|
30
30
|
|
|
31
31
|
def get_access_token(self) -> str:
|
|
32
|
-
access_token = os.environ.get(
|
|
32
|
+
access_token = os.environ.get(_PERSONAL_ACCESS_TOKEN)
|
|
33
33
|
|
|
34
34
|
if not access_token:
|
|
35
|
-
raise CredentialUnavailableError(f"Environment variable {
|
|
35
|
+
raise CredentialUnavailableError(f"Environment variable {_PERSONAL_ACCESS_TOKEN} is not set")
|
|
36
36
|
|
|
37
37
|
return access_token
|
|
38
38
|
|
|
@@ -80,7 +80,7 @@ class StaticCredential(CredentialProvider):
|
|
|
80
80
|
|
|
81
81
|
def get_access_token(self) -> str:
|
|
82
82
|
if not self.access_token:
|
|
83
|
-
raise CredentialUnavailableError(
|
|
83
|
+
raise CredentialUnavailableError("Access token not set")
|
|
84
84
|
return self.access_token
|
|
85
85
|
|
|
86
86
|
|
package/pyproject.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "planqk-api-sdk"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.9.0"
|
|
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" },
|
|
@@ -34,8 +34,8 @@ dev = [
|
|
|
34
34
|
]
|
|
35
35
|
|
|
36
36
|
[project.urls]
|
|
37
|
-
Homepage = "https://kipu-quantum.com
|
|
38
|
-
Documentation = "https://docs.
|
|
37
|
+
Homepage = "https://hub.kipu-quantum.com"
|
|
38
|
+
Documentation = "https://docs.hub.kipu-quantum.com"
|
|
39
39
|
Repository = "https://gitlab.com/planqk-foss/planqk-api-sdk"
|
|
40
40
|
Issues = "https://gitlab.com/planqk-foss/planqk-api-sdk/-/issues"
|
|
41
41
|
Changelog = "https://gitlab.com/planqk-foss/planqk-api-sdk/-/releases"
|
package/src/index.test.ts
CHANGED
|
@@ -3,11 +3,11 @@ import {test} from 'vitest'
|
|
|
3
3
|
import 'dotenv/config'
|
|
4
4
|
import {PlanqkApiClient} from "./sdk";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const organizationId = process.env.PLANQK_ORGANIZATION_ID
|
|
6
|
+
const baseUrl = process.env.KQH_BASE_URL!
|
|
7
|
+
const apiKey = process.env.KQH_PERSONAL_ACCESS_TOKEN!
|
|
8
|
+
const organizationId = process.env.KQH_ORGANIZATION_ID
|
|
10
9
|
|
|
10
|
+
test.skip('integration test: data pools', {timeout: 5 * 60 * 1000}, async () => {
|
|
11
11
|
const client = new PlanqkApiClient({baseUrl, apiKey, organizationId})
|
|
12
12
|
|
|
13
13
|
const dataPools = await client.dataPools.getDataPools()
|
|
@@ -18,10 +18,6 @@ test.skip('integration test: data pools', {timeout: 5 * 60 * 1000}, async () =>
|
|
|
18
18
|
})
|
|
19
19
|
|
|
20
20
|
test.skip('integration test: service jobs', {timeout: 5 * 60 * 1000}, async () => {
|
|
21
|
-
const baseUrl = process.env.PLANQK_API_BASE_URL!
|
|
22
|
-
const apiKey = process.env.PLANQK_PERSONAL_ACCESS_TOKEN!
|
|
23
|
-
const organizationId = process.env.PLANQK_ORGANIZATION_ID
|
|
24
|
-
|
|
25
21
|
const client = new PlanqkApiClient({baseUrl, apiKey, organizationId})
|
|
26
22
|
|
|
27
23
|
const serviceJobs = await client.serviceJobs.getServiceJobs()
|
package/src/sdk/environments.ts
CHANGED