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.
Files changed (86) hide show
  1. {splime-0.2.3/src/splime.egg-info → splime-0.2.4}/PKG-INFO +1 -1
  2. {splime-0.2.3 → splime-0.2.4}/pyproject.toml +1 -1
  3. {splime-0.2.3 → splime-0.2.4}/src/spl/_client.py +7 -2
  4. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/remote_client.py +49 -10
  5. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/routes/libraries.py +6 -2
  6. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/runtime_dependencies.py +1 -1
  7. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/server.py +1 -1
  8. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon_client.py +7 -2
  9. {splime-0.2.3 → splime-0.2.4/src/splime.egg-info}/PKG-INFO +1 -1
  10. {splime-0.2.3 → splime-0.2.4}/LICENSE +0 -0
  11. {splime-0.2.3 → splime-0.2.4}/NOTICE +0 -0
  12. {splime-0.2.3 → splime-0.2.4}/README.md +0 -0
  13. {splime-0.2.3 → splime-0.2.4}/setup.cfg +0 -0
  14. {splime-0.2.3 → splime-0.2.4}/src/spl/__init__.py +0 -0
  15. {splime-0.2.3 → splime-0.2.4}/src/spl/_deprecate.py +0 -0
  16. {splime-0.2.3 → splime-0.2.4}/src/spl/_http.py +0 -0
  17. {splime-0.2.3 → splime-0.2.4}/src/spl/client.py +0 -0
  18. {splime-0.2.3 → splime-0.2.4}/src/spl/core/__init__.py +0 -0
  19. {splime-0.2.3 → splime-0.2.4}/src/spl/core/_common.py +0 -0
  20. {splime-0.2.3 → splime-0.2.4}/src/spl/core/common.py +0 -0
  21. {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/__init__.py +0 -0
  22. {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/adapter.py +0 -0
  23. {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/artifact.py +0 -0
  24. {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/control.py +0 -0
  25. {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/distribution.py +0 -0
  26. {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/function.py +0 -0
  27. {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/local_function.py +0 -0
  28. {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/misc.py +0 -0
  29. {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/module.py +0 -0
  30. {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/node.py +0 -0
  31. {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/node_function.py +0 -0
  32. {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/node_remote.py +0 -0
  33. {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/pipeline.py +0 -0
  34. {splime-0.2.3 → splime-0.2.4}/src/spl/core/entities/scalar.py +0 -0
  35. {splime-0.2.3 → splime-0.2.4}/src/spl/core/ir/__init__.py +0 -0
  36. {splime-0.2.3 → splime-0.2.4}/src/spl/core/ir/common.py +0 -0
  37. {splime-0.2.3 → splime-0.2.4}/src/spl/core/ir/parse.py +0 -0
  38. {splime-0.2.3 → splime-0.2.4}/src/spl/core/ir/unparse.py +0 -0
  39. {splime-0.2.3 → splime-0.2.4}/src/spl/core/ir/utils.py +0 -0
  40. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/__init__.py +0 -0
  41. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/__main__.py +0 -0
  42. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/canonical.py +0 -0
  43. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/cli.py +0 -0
  44. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/client.py +0 -0
  45. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/docker_environment.py +0 -0
  46. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/docker_pool.py +0 -0
  47. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/doctor.py +0 -0
  48. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/environment.py +0 -0
  49. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/environment_base.py +0 -0
  50. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/heartbeat_service.py +0 -0
  51. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/metadata.py +0 -0
  52. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/repositories/__init__.py +0 -0
  53. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/repositories/env.py +0 -0
  54. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/repositories/library.py +0 -0
  55. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/repositories/object.py +0 -0
  56. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/repositories/run.py +0 -0
  57. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/repositories/server_connection.py +0 -0
  58. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/repositories/sync_event.py +0 -0
  59. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/routes/__init__.py +0 -0
  60. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/routes/_helpers.py +0 -0
  61. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/routes/artifacts.py +0 -0
  62. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/routes/diagnostics.py +0 -0
  63. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/routes/envs.py +0 -0
  64. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/routes/objects.py +0 -0
  65. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/routes/remote.py +0 -0
  66. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/routes/runs.py +0 -0
  67. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/routes/server_connections.py +0 -0
  68. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/run_progress.py +0 -0
  69. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/runtime_backend.py +0 -0
  70. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/runtime_config.py +0 -0
  71. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/secret_store.py +0 -0
  72. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/server_connection.py +0 -0
  73. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/services/__init__.py +0 -0
  74. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/services/sync.py +0 -0
  75. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/signature.py +0 -0
  76. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/storage_base.py +0 -0
  77. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/store.py +0 -0
  78. {splime-0.2.3 → splime-0.2.4}/src/spl/daemon/worker.py +0 -0
  79. {splime-0.2.3 → splime-0.2.4}/src/spl/pipeline_widget.py +0 -0
  80. {splime-0.2.3 → splime-0.2.4}/src/spl/py.typed +0 -0
  81. {splime-0.2.3 → splime-0.2.4}/src/spl/server_client.py +0 -0
  82. {splime-0.2.3 → splime-0.2.4}/src/splime.egg-info/SOURCES.txt +0 -0
  83. {splime-0.2.3 → splime-0.2.4}/src/splime.egg-info/dependency_links.txt +0 -0
  84. {splime-0.2.3 → splime-0.2.4}/src/splime.egg-info/entry_points.txt +0 -0
  85. {splime-0.2.3 → splime-0.2.4}/src/splime.egg-info/requires.txt +0 -0
  86. {splime-0.2.3 → splime-0.2.4}/src/splime.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: splime
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: Reuse Python functions across projects without rewriting or redeploying them.
5
5
  Author-email: Yastrebov Kirill <yastrebovks@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "splime"
7
- version = "0.2.3"
7
+ version = "0.2.4"
8
8
 
9
9
  description = "Reuse Python functions across projects without rewriting or redeploying them."
10
10
  readme = "README.md"
@@ -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
- """Delete or archive one central-server library when supported upstream."""
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
- return self._c._daemon.delete_server_library(ref)
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 {self.machine_token}",
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("GET", f"/libraries?{urlencode(query)}")
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("GET", f"/libraries/{quote(library_ref)}")
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("PUT", f"/libraries/{quote(library_ref)}", payload)
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
- return self._json_request("DELETE", f"/libraries/{quote(library_ref)}")
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("GET", f"/libraries/{quote(library_ref)}/grants")
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
- _, server = context.connected_server_client()
65
- return json_response(server.delete_library(validate_name(library_ref)))
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
- """Delete or archive one central-server library when supported upstream."""
552
+ """Raise a clear error because server-side library delete is unsupported."""
548
553
 
549
- return self._json_request("DELETE", f"/server/libraries/{quote(library_ref)}")
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."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: splime
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: Reuse Python functions across projects without rewriting or redeploying them.
5
5
  Author-email: Yastrebov Kirill <yastrebovks@gmail.com>
6
6
  License-Expression: Apache-2.0
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