splime 0.2.3__tar.gz → 0.2.4__tar.gz
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.
- {splime-0.2.3/src/splime.egg-info → splime-0.2.4}/PKG-INFO +1 -1
- {splime-0.2.3 → splime-0.2.4}/pyproject.toml +1 -1
- {splime-0.2.3 → splime-0.2.4}/src/spl/_client.py +7 -2
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/remote_client.py +49 -10
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/routes/libraries.py +6 -2
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/runtime_dependencies.py +1 -1
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/server.py +1 -1
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon_client.py +7 -2
- {splime-0.2.3 → splime-0.2.4/src/splime.egg-info}/PKG-INFO +1 -1
- {splime-0.2.3 → splime-0.2.4}/LICENSE +0 -0
- {splime-0.2.3 → splime-0.2.4}/NOTICE +0 -0
- {splime-0.2.3 → splime-0.2.4}/README.md +0 -0
- {splime-0.2.3 → splime-0.2.4}/setup.cfg +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/__init__.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/_deprecate.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/_http.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/client.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/core/__init__.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/core/_common.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/core/common.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/__init__.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/adapter.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/artifact.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/control.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/distribution.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/function.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/local_function.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/misc.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/module.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/node.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/node_function.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/node_remote.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/pipeline.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/scalar.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/core/ir/__init__.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/core/ir/common.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/core/ir/parse.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/core/ir/unparse.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/core/ir/utils.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/__init__.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/__main__.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/canonical.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/cli.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/client.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/docker_environment.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/docker_pool.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/doctor.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/environment.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/environment_base.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/heartbeat_service.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/metadata.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/repositories/__init__.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/repositories/env.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/repositories/library.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/repositories/object.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/repositories/run.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/repositories/server_connection.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/repositories/sync_event.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/routes/__init__.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/routes/_helpers.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/routes/artifacts.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/routes/diagnostics.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/routes/envs.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/routes/objects.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/routes/remote.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/routes/runs.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/routes/server_connections.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/run_progress.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/runtime_backend.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/runtime_config.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/secret_store.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/server_connection.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/services/__init__.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/services/sync.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/signature.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/storage_base.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/store.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/worker.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/pipeline_widget.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/py.typed +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/spl/server_client.py +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/splime.egg-info/SOURCES.txt +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/splime.egg-info/dependency_links.txt +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/splime.egg-info/entry_points.txt +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/splime.egg-info/requires.txt +0 -0
- {splime-0.2.3 → splime-0.2.4}/src/splime.egg-info/top_level.txt +0 -0
|
@@ -40,6 +40,11 @@ ObjectScope = Literal["auto", "local", "server", "all"]
|
|
|
40
40
|
RunSource = Literal["auto", "local"]
|
|
41
41
|
ProgressOption = bool | RunStateCallback
|
|
42
42
|
_NO_SERVER_CONNECTION_MESSAGE = "active server connection is not found"
|
|
43
|
+
_LIBRARY_DELETE_UNSUPPORTED_MESSAGE = (
|
|
44
|
+
"Deleting central-server libraries is not supported by the SPL server API. "
|
|
45
|
+
"Use the Console archive action to hide a library, or remove individual "
|
|
46
|
+
"entries with client.library.remove_entry()."
|
|
47
|
+
)
|
|
43
48
|
|
|
44
49
|
|
|
45
50
|
def _preview(value: Any, *, limit: int = 80) -> str:
|
|
@@ -552,10 +557,10 @@ class _LibraryAdmin:
|
|
|
552
557
|
return self._c._daemon.update_server_library(ref, payload)
|
|
553
558
|
|
|
554
559
|
def delete(self, ref: str) -> dict[str, Any]:
|
|
555
|
-
"""
|
|
560
|
+
"""Raise a clear error because server-side library delete is unsupported."""
|
|
556
561
|
|
|
557
562
|
self._c._require_server_connection("deleting a library")
|
|
558
|
-
|
|
563
|
+
raise NotImplementedError(_LIBRARY_DELETE_UNSUPPORTED_MESSAGE)
|
|
559
564
|
|
|
560
565
|
def grant(
|
|
561
566
|
self,
|
|
@@ -15,6 +15,11 @@ from spl._http import urlopen_verified, verified_https_context
|
|
|
15
15
|
|
|
16
16
|
DEFAULT_SERVER_URL = "https://splime.io/api"
|
|
17
17
|
DEFAULT_HEARTBEAT_INTERVAL_SECONDS = 60.0
|
|
18
|
+
LIBRARY_DELETE_UNSUPPORTED_MESSAGE = (
|
|
19
|
+
"Deleting central-server libraries is not supported by the SPL server API. "
|
|
20
|
+
"Use the Console archive action to hide a library, or remove individual "
|
|
21
|
+
"entries with client.library.remove_entry()."
|
|
22
|
+
)
|
|
18
23
|
|
|
19
24
|
|
|
20
25
|
class ServerClientError(RuntimeError):
|
|
@@ -40,12 +45,22 @@ class ServerClient:
|
|
|
40
45
|
self.machine_token = machine_token
|
|
41
46
|
self.user_token = user_token
|
|
42
47
|
|
|
43
|
-
def _headers(self) -> dict[str, str]:
|
|
48
|
+
def _headers(self, *, auth: str = "machine") -> dict[str, str]:
|
|
49
|
+
token = self.machine_token
|
|
50
|
+
if auth == "user":
|
|
51
|
+
if not self.user_token:
|
|
52
|
+
raise ServerClientError(
|
|
53
|
+
401,
|
|
54
|
+
"central SPL daemon server user token is required for this operation",
|
|
55
|
+
)
|
|
56
|
+
token = self.user_token
|
|
57
|
+
elif auth != "machine":
|
|
58
|
+
raise ValueError("auth must be 'machine' or 'user'")
|
|
44
59
|
headers = {
|
|
45
60
|
"Accept": "application/json",
|
|
46
|
-
"Authorization": f"Bearer {
|
|
61
|
+
"Authorization": f"Bearer {token}",
|
|
47
62
|
}
|
|
48
|
-
if self.user_token:
|
|
63
|
+
if auth == "machine" and self.user_token:
|
|
49
64
|
headers["X-SPL-User-Token"] = self.user_token
|
|
50
65
|
return headers
|
|
51
66
|
|
|
@@ -54,9 +69,11 @@ class ServerClient:
|
|
|
54
69
|
method: str,
|
|
55
70
|
path: str,
|
|
56
71
|
payload: dict[str, Any] | None = None,
|
|
72
|
+
*,
|
|
73
|
+
auth: str = "machine",
|
|
57
74
|
) -> Any:
|
|
58
75
|
body = None
|
|
59
|
-
headers = self._headers()
|
|
76
|
+
headers = self._headers(auth=auth)
|
|
60
77
|
if payload is not None:
|
|
61
78
|
body = json.dumps(payload, ensure_ascii=False).encode("utf-8")
|
|
62
79
|
headers["Content-Type"] = "application/json; charset=utf-8"
|
|
@@ -229,34 +246,53 @@ class ServerClient:
|
|
|
229
246
|
|
|
230
247
|
def list_libraries(self, *, include_accessible: bool = True) -> list[dict[str, Any]]:
|
|
231
248
|
query = {"include_accessible": "1" if include_accessible else "0"}
|
|
232
|
-
return self._json_request(
|
|
249
|
+
return self._json_request(
|
|
250
|
+
"GET",
|
|
251
|
+
f"/libraries?{urlencode(query)}",
|
|
252
|
+
auth="user" if self.user_token else "machine",
|
|
253
|
+
)
|
|
233
254
|
|
|
234
255
|
def create_library(self, payload: dict[str, Any]) -> dict[str, Any]:
|
|
235
|
-
return self._json_request("POST", "/libraries", payload)
|
|
256
|
+
return self._json_request("POST", "/libraries", payload, auth="user")
|
|
236
257
|
|
|
237
258
|
def get_library(self, library_ref: str) -> dict[str, Any]:
|
|
238
|
-
return self._json_request(
|
|
259
|
+
return self._json_request(
|
|
260
|
+
"GET",
|
|
261
|
+
f"/libraries/{quote(library_ref)}",
|
|
262
|
+
auth="user" if self.user_token else "machine",
|
|
263
|
+
)
|
|
239
264
|
|
|
240
265
|
def update_library(self, library_ref: str, payload: dict[str, Any]) -> dict[str, Any]:
|
|
241
|
-
return self._json_request(
|
|
266
|
+
return self._json_request(
|
|
267
|
+
"PUT",
|
|
268
|
+
f"/libraries/{quote(library_ref)}",
|
|
269
|
+
payload,
|
|
270
|
+
auth="user",
|
|
271
|
+
)
|
|
242
272
|
|
|
243
273
|
def delete_library(self, library_ref: str) -> dict[str, Any]:
|
|
244
|
-
|
|
274
|
+
raise NotImplementedError(LIBRARY_DELETE_UNSUPPORTED_MESSAGE)
|
|
245
275
|
|
|
246
276
|
def list_library_grants(self, library_ref: str) -> list[dict[str, Any]]:
|
|
247
|
-
return self._json_request(
|
|
277
|
+
return self._json_request(
|
|
278
|
+
"GET",
|
|
279
|
+
f"/libraries/{quote(library_ref)}/grants",
|
|
280
|
+
auth="user",
|
|
281
|
+
)
|
|
248
282
|
|
|
249
283
|
def grant_library(self, library_ref: str, payload: dict[str, Any]) -> dict[str, Any]:
|
|
250
284
|
return self._json_request(
|
|
251
285
|
"POST",
|
|
252
286
|
f"/libraries/{quote(library_ref)}/grants",
|
|
253
287
|
payload,
|
|
288
|
+
auth="user",
|
|
254
289
|
)
|
|
255
290
|
|
|
256
291
|
def revoke_library_grant(self, library_ref: str, grantee: str) -> dict[str, Any]:
|
|
257
292
|
return self._json_request(
|
|
258
293
|
"POST",
|
|
259
294
|
f"/libraries/{quote(library_ref)}/grants/{quote(grantee)}/revoke",
|
|
295
|
+
auth="user",
|
|
260
296
|
)
|
|
261
297
|
|
|
262
298
|
def add_library_reference(
|
|
@@ -268,6 +304,7 @@ class ServerClient:
|
|
|
268
304
|
"POST",
|
|
269
305
|
f"/libraries/{quote(library_ref)}/references",
|
|
270
306
|
payload,
|
|
307
|
+
auth="user",
|
|
271
308
|
)
|
|
272
309
|
|
|
273
310
|
def copy_object_into_library(
|
|
@@ -279,12 +316,14 @@ class ServerClient:
|
|
|
279
316
|
"POST",
|
|
280
317
|
f"/libraries/{quote(library_ref)}/copies",
|
|
281
318
|
payload,
|
|
319
|
+
auth="user",
|
|
282
320
|
)
|
|
283
321
|
|
|
284
322
|
def remove_library_entry(self, library_ref: str, name: str) -> dict[str, Any]:
|
|
285
323
|
return self._json_request(
|
|
286
324
|
"DELETE",
|
|
287
325
|
f"/libraries/{quote(library_ref)}/entries/{quote(name)}",
|
|
326
|
+
auth="user",
|
|
288
327
|
)
|
|
289
328
|
|
|
290
329
|
def list_objects(
|
|
@@ -5,6 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
from http import HTTPStatus
|
|
6
6
|
from typing import Any
|
|
7
7
|
|
|
8
|
+
from spl.daemon_client import LIBRARY_DELETE_UNSUPPORTED_MESSAGE
|
|
8
9
|
from spl.daemon.routes._helpers import RouteContext
|
|
9
10
|
from spl.daemon.store import validate_name
|
|
10
11
|
|
|
@@ -61,8 +62,11 @@ def register_library_routes(
|
|
|
61
62
|
@app.delete("/server/libraries/<library_ref>")
|
|
62
63
|
@route_errors
|
|
63
64
|
async def delete_server_library(library_ref: str) -> Any:
|
|
64
|
-
|
|
65
|
-
return json_response(
|
|
65
|
+
validate_name(library_ref)
|
|
66
|
+
return json_response(
|
|
67
|
+
{"error": LIBRARY_DELETE_UNSUPPORTED_MESSAGE},
|
|
68
|
+
HTTPStatus.NOT_IMPLEMENTED,
|
|
69
|
+
)
|
|
66
70
|
|
|
67
71
|
@app.get("/server/libraries/<library_ref>/grants")
|
|
68
72
|
@route_errors
|
|
@@ -228,7 +228,7 @@ class ServerClientProtocol(Protocol):
|
|
|
228
228
|
...
|
|
229
229
|
|
|
230
230
|
def delete_library(self, library_ref: str) -> dict[str, Any]:
|
|
231
|
-
"""Delete a server library."""
|
|
231
|
+
"""Delete a server library when upstream support is added."""
|
|
232
232
|
...
|
|
233
233
|
|
|
234
234
|
def list_library_grants(self, library_ref: str) -> list[dict[str, Any]]:
|
|
@@ -26,7 +26,7 @@ Endpoints:
|
|
|
26
26
|
POST /server/libraries
|
|
27
27
|
GET /server/libraries/<ref>
|
|
28
28
|
PUT /server/libraries/<ref>
|
|
29
|
-
DELETE /server/libraries/<ref>
|
|
29
|
+
DELETE /server/libraries/<ref> (501 until upstream archive/delete exists)
|
|
30
30
|
GET /server/libraries/<ref>/grants
|
|
31
31
|
POST /server/libraries/<ref>/grants
|
|
32
32
|
POST /server/libraries/<ref>/grants/<grantee>/revoke
|
|
@@ -26,6 +26,11 @@ DEFAULT_SERVER_URL = "https://splime.io/api"
|
|
|
26
26
|
DEFAULT_HEARTBEAT_INTERVAL_SECONDS = 60.0
|
|
27
27
|
DAEMON_ENDPOINT_FILENAME = "daemon-endpoint.json"
|
|
28
28
|
DAEMON_API_TOKEN_ENV = "SPL_DAEMON_API_TOKEN"
|
|
29
|
+
LIBRARY_DELETE_UNSUPPORTED_MESSAGE = (
|
|
30
|
+
"Deleting central-server libraries is not supported by the SPL server API. "
|
|
31
|
+
"Use the Console archive action to hide a library, or remove individual "
|
|
32
|
+
"entries with client.library.remove_entry()."
|
|
33
|
+
)
|
|
29
34
|
|
|
30
35
|
OfflinePolicy = Literal["queue", "wait", "fail_fast"]
|
|
31
36
|
RunSource = Literal["auto", "local"]
|
|
@@ -544,9 +549,9 @@ class Client:
|
|
|
544
549
|
)
|
|
545
550
|
|
|
546
551
|
def delete_server_library(self, library_ref: str) -> dict[str, Any]:
|
|
547
|
-
"""
|
|
552
|
+
"""Raise a clear error because server-side library delete is unsupported."""
|
|
548
553
|
|
|
549
|
-
|
|
554
|
+
raise NotImplementedError(LIBRARY_DELETE_UNSUPPORTED_MESSAGE)
|
|
550
555
|
|
|
551
556
|
def server_library_grants(self, library_ref: str) -> list[dict[str, Any]]:
|
|
552
557
|
"""Return grants for one central-server library."""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|