chuk-artifacts 0.1.6__py3-none-any.whl → 0.2__py3-none-any.whl
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.
- chuk_artifacts/grid.py +28 -0
- chuk_artifacts/providers/memory.py +3 -3
- chuk_artifacts/providers/s3.py +5 -5
- chuk_artifacts/store.py +6 -4
- {chuk_artifacts-0.1.6.dist-info → chuk_artifacts-0.2.dist-info}/METADATA +2 -2
- {chuk_artifacts-0.1.6.dist-info → chuk_artifacts-0.2.dist-info}/RECORD +9 -8
- {chuk_artifacts-0.1.6.dist-info → chuk_artifacts-0.2.dist-info}/WHEEL +0 -0
- {chuk_artifacts-0.1.6.dist-info → chuk_artifacts-0.2.dist-info}/licenses/LICENSE +0 -0
- {chuk_artifacts-0.1.6.dist-info → chuk_artifacts-0.2.dist-info}/top_level.txt +0 -0
chuk_artifacts/grid.py
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# chuk_artifacts/grid.py
|
2
|
+
"""Utility helpers for grid-style paths.
|
3
|
+
|
4
|
+
Pattern: grid/{sandbox_id}/{session_id}/{artifact_id}[/{subpath}]"""
|
5
|
+
|
6
|
+
from typing import Optional, Dict
|
7
|
+
|
8
|
+
_ROOT = "grid"
|
9
|
+
|
10
|
+
|
11
|
+
def canonical_prefix(sandbox_id: str, session_id: str) -> str:
|
12
|
+
return f"{_ROOT}/{sandbox_id}/{session_id}/"
|
13
|
+
|
14
|
+
|
15
|
+
def artifact_key(sandbox_id: str, session_id: str, artifact_id: str) -> str:
|
16
|
+
return f"{_ROOT}/{sandbox_id}/{session_id}/{artifact_id}"
|
17
|
+
|
18
|
+
|
19
|
+
def parse(key: str) -> Optional[Dict[str, str]]:
|
20
|
+
parts = key.split("/")
|
21
|
+
if len(parts) < 4 or parts[0] != _ROOT:
|
22
|
+
return None
|
23
|
+
return {
|
24
|
+
"sandbox_id": parts[1],
|
25
|
+
"session_id": parts[2],
|
26
|
+
"artifact_id": parts[3] if len(parts) > 3 else None,
|
27
|
+
"subpath": "/".join(parts[4:]) if len(parts) > 4 else None,
|
28
|
+
}
|
@@ -279,11 +279,11 @@ def factory(shared_store: Optional[Dict[str, Dict[str, Any]]] = None) -> Callabl
|
|
279
279
|
async def _ctx():
|
280
280
|
client = _MemoryS3Client(shared_store=shared_store)
|
281
281
|
try:
|
282
|
-
yield client
|
282
|
+
yield client # ← hand the live client back to caller
|
283
283
|
finally:
|
284
|
-
await client.close()
|
284
|
+
await client.close() # ← clean up when context exits
|
285
285
|
|
286
|
-
return _ctx
|
286
|
+
return _ctx
|
287
287
|
|
288
288
|
|
289
289
|
# ---- convenience functions for testing ------------------------------------
|
chuk_artifacts/providers/s3.py
CHANGED
@@ -56,12 +56,12 @@ def factory(
|
|
56
56
|
session = aioboto3.Session()
|
57
57
|
async with session.client(
|
58
58
|
"s3",
|
59
|
-
endpoint_url=endpoint_url,
|
60
|
-
region_name=region,
|
61
|
-
aws_access_key_id=access_key,
|
62
|
-
aws_secret_access_key=secret_key,
|
59
|
+
endpoint_url = endpoint_url,
|
60
|
+
region_name = region,
|
61
|
+
aws_access_key_id = access_key,
|
62
|
+
aws_secret_access_key = secret_key,
|
63
63
|
) as client:
|
64
|
-
yield client
|
64
|
+
yield client # ← the channel to real S3 / MinIO
|
65
65
|
|
66
66
|
return _ctx
|
67
67
|
|
chuk_artifacts/store.py
CHANGED
@@ -15,6 +15,8 @@ from __future__ import annotations
|
|
15
15
|
import os, logging, uuid
|
16
16
|
from datetime import datetime
|
17
17
|
from typing import Any, Dict, List, Callable, AsyncContextManager, Optional, Union
|
18
|
+
from chuk_sessions.session_manager import SessionManager
|
19
|
+
from .grid import canonical_prefix, artifact_key, parse
|
18
20
|
|
19
21
|
try:
|
20
22
|
import aioboto3
|
@@ -235,19 +237,19 @@ class ArtifactStore:
|
|
235
237
|
|
236
238
|
def get_canonical_prefix(self, session_id: str) -> str:
|
237
239
|
"""Get grid path prefix for session."""
|
238
|
-
return self.
|
240
|
+
return canonical_prefix(self.sandbox_id, session_id)
|
239
241
|
|
240
242
|
def generate_artifact_key(self, session_id: str, artifact_id: str) -> str:
|
241
243
|
"""Generate grid artifact key."""
|
242
|
-
return self.
|
244
|
+
return artifact_key(self.sandbox_id, session_id, artifact_id)
|
243
245
|
|
244
246
|
def parse_grid_key(self, grid_key: str) -> Optional[Dict[str, Any]]:
|
245
247
|
"""Parse grid key to extract components."""
|
246
|
-
return
|
248
|
+
return parse(grid_key)
|
247
249
|
|
248
250
|
def get_session_prefix_pattern(self) -> str:
|
249
251
|
"""Get session prefix pattern for this sandbox."""
|
250
|
-
return self.
|
252
|
+
return f"grid/{self.sandbox_id}/"
|
251
253
|
|
252
254
|
# ─────────────────────────────────────────────────────────────────
|
253
255
|
# File operations
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: chuk-artifacts
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.2
|
4
4
|
Summary: Chuk Artifacts provides a production-ready, modular artifact storage system that works seamlessly across multiple storage backends (memory, filesystem, AWS S3, IBM Cloud Object Storage) with Redis or memory-based metadata caching and strict session-based security.
|
5
5
|
License: MIT
|
6
6
|
Requires-Python: >=3.11
|
@@ -12,7 +12,7 @@ Requires-Dist: pyyaml>=6.0.2
|
|
12
12
|
Requires-Dist: aioboto3>=14.3.0
|
13
13
|
Requires-Dist: redis>=6.2.0
|
14
14
|
Requires-Dist: ibm-cos-sdk>=2.13.5
|
15
|
-
Requires-Dist: chuk-sessions>=0.
|
15
|
+
Requires-Dist: chuk-sessions>=0.2
|
16
16
|
Provides-Extra: websocket
|
17
17
|
Requires-Dist: websockets>=10.0; extra == "websocket"
|
18
18
|
Provides-Extra: dev
|
@@ -5,19 +5,20 @@ chuk_artifacts/batch.py,sha256=x8ARrWJ24I9fAXXodzvh31uMxYrvwZCGGJhUCM4vMJ4,5099
|
|
5
5
|
chuk_artifacts/config.py,sha256=MaUzHzKPoBUyERviEpv8JVvPybMzSksgLyj0b7AO3Sc,7664
|
6
6
|
chuk_artifacts/core.py,sha256=hokH7cgGE2ZaEwlV8XMKOov3EMvcLS2HufdApLS6l3M,6699
|
7
7
|
chuk_artifacts/exceptions.py,sha256=f-s7Mg7c8vMXsbgqO2B6lMHdXcJQNvsESAY4GhJaV4g,814
|
8
|
+
chuk_artifacts/grid.py,sha256=IkvAgTLaN-ahRGVC6sysMkP7ALUUleJHaYfr5TRH7ZY,796
|
8
9
|
chuk_artifacts/metadata.py,sha256=McyKLviBInpqh2eF621xhqb3Ix7QUj_nVc1gg_tUlqY,7830
|
9
10
|
chuk_artifacts/models.py,sha256=_foXlkr0DprqgztDw5WtlDc-s1OouLgYNp4XM1Ghp-g,837
|
10
11
|
chuk_artifacts/presigned.py,sha256=-GE8r0CfUZuPNA_jnSGTfX7kuws6kYCPe7C4y6FItdo,11491
|
11
12
|
chuk_artifacts/provider_factory.py,sha256=T0IXx1C8gygJzp417oB44_DxEaZoZR7jcdwQy8FghRE,3398
|
12
|
-
chuk_artifacts/store.py,sha256=
|
13
|
+
chuk_artifacts/store.py,sha256=HDX2xbWXEXP6B_xylBh1L3ynCxvs_41gZy4drm1bLWc,24814
|
13
14
|
chuk_artifacts/providers/__init__.py,sha256=3lN1lAy1ETT1mQslJo1f22PPR1W4CyxmsqJBclzH4NE,317
|
14
15
|
chuk_artifacts/providers/filesystem.py,sha256=F4EjE-_ItPg0RWe7CqameVpOMjU-b7AigEBkm_ZoNrc,15280
|
15
16
|
chuk_artifacts/providers/ibm_cos.py,sha256=K1-VAX4UVV9tA161MOeDXOKloQ0hB77jdw1-p46FwmU,4445
|
16
17
|
chuk_artifacts/providers/ibm_cos_iam.py,sha256=VtwvCi9rMMcZx6i9l21ob6wM8jXseqvjzgCnAA82RkY,3186
|
17
|
-
chuk_artifacts/providers/memory.py,sha256=
|
18
|
-
chuk_artifacts/providers/s3.py,sha256=
|
19
|
-
chuk_artifacts-0.
|
20
|
-
chuk_artifacts-0.
|
21
|
-
chuk_artifacts-0.
|
22
|
-
chuk_artifacts-0.
|
23
|
-
chuk_artifacts-0.
|
18
|
+
chuk_artifacts/providers/memory.py,sha256=9sA8xDKh_IMjuHtqR5gTtpzpanZfdBeQLcTk-4-G9Dk,10582
|
19
|
+
chuk_artifacts/providers/s3.py,sha256=QSSiYjNENQfwxJ2-Yw-CJrO8lNZcIrsfdn2Vo_DD-b4,2931
|
20
|
+
chuk_artifacts-0.2.dist-info/licenses/LICENSE,sha256=SG9BmgtPBagPV0d-Fep-msdAGl-E1CeoBL7-EDRH2qA,1066
|
21
|
+
chuk_artifacts-0.2.dist-info/METADATA,sha256=BQhxTSd3RQxruVtR7j27FdpW9P3kn7KiRbVn2pzCoyA,21184
|
22
|
+
chuk_artifacts-0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
23
|
+
chuk_artifacts-0.2.dist-info/top_level.txt,sha256=1_PVMtWXR0A-ZmeH6apF9mPaMtU0i23JE6wmN4GBRDI,15
|
24
|
+
chuk_artifacts-0.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|