nvidia-nat-s3 1.3.0.dev2__py3-none-any.whl → 1.3.0rc2__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.
- nat/plugins/s3/object_store.py +3 -3
- nat/plugins/s3/register.py +0 -1
- nat/plugins/s3/s3_object_store.py +28 -30
- {nvidia_nat_s3-1.3.0.dev2.dist-info → nvidia_nat_s3-1.3.0rc2.dist-info}/METADATA +6 -3
- nvidia_nat_s3-1.3.0rc2.dist-info/RECORD +9 -0
- nvidia_nat_s3-1.3.0.dev2.dist-info/RECORD +0 -9
- {nvidia_nat_s3-1.3.0.dev2.dist-info → nvidia_nat_s3-1.3.0rc2.dist-info}/WHEEL +0 -0
- {nvidia_nat_s3-1.3.0.dev2.dist-info → nvidia_nat_s3-1.3.0rc2.dist-info}/entry_points.txt +0 -0
- {nvidia_nat_s3-1.3.0.dev2.dist-info → nvidia_nat_s3-1.3.0rc2.dist-info}/top_level.txt +0 -0
nat/plugins/s3/object_store.py
CHANGED
@@ -41,9 +41,9 @@ class S3ObjectStoreClientConfig(ObjectStoreBaseConfig, name="s3"):
|
|
41
41
|
|
42
42
|
|
43
43
|
@register_object_store(config_type=S3ObjectStoreClientConfig)
|
44
|
-
async def s3_object_store_client(config: S3ObjectStoreClientConfig,
|
44
|
+
async def s3_object_store_client(config: S3ObjectStoreClientConfig, _builder: Builder):
|
45
45
|
|
46
|
-
from
|
46
|
+
from .s3_object_store import S3ObjectStore
|
47
47
|
|
48
|
-
async with S3ObjectStore(config) as store:
|
48
|
+
async with S3ObjectStore(**config.model_dump(exclude={"type"}, exclude_none=False)) as store:
|
49
49
|
yield store
|
nat/plugins/s3/register.py
CHANGED
@@ -23,7 +23,6 @@ from nat.data_models.object_store import KeyAlreadyExistsError
|
|
23
23
|
from nat.data_models.object_store import NoSuchKeyError
|
24
24
|
from nat.object_store.interfaces import ObjectStore
|
25
25
|
from nat.object_store.models import ObjectStoreItem
|
26
|
-
from nat.plugins.s3.object_store import S3ObjectStoreClientConfig
|
27
26
|
|
28
27
|
logger = logging.getLogger(__name__)
|
29
28
|
|
@@ -33,31 +32,31 @@ class S3ObjectStore(ObjectStore):
|
|
33
32
|
S3ObjectStore is an ObjectStore implementation that uses S3 as the underlying storage.
|
34
33
|
"""
|
35
34
|
|
36
|
-
def __init__(self,
|
35
|
+
def __init__(self,
|
36
|
+
*,
|
37
|
+
bucket_name: str,
|
38
|
+
endpoint_url: str | None,
|
39
|
+
access_key: str | None,
|
40
|
+
secret_key: str | None,
|
41
|
+
region: str | None):
|
37
42
|
|
38
43
|
super().__init__()
|
39
44
|
|
40
|
-
self.bucket_name =
|
45
|
+
self.bucket_name = bucket_name
|
41
46
|
self.session = aioboto3.Session()
|
42
47
|
self._client: BaseClient | None = None
|
43
48
|
self._client_context = None
|
44
49
|
|
45
|
-
|
46
|
-
|
47
|
-
|
50
|
+
self._client_args: dict = {}
|
51
|
+
if access_key and secret_key:
|
52
|
+
self._client_args["aws_access_key_id"] = access_key
|
53
|
+
self._client_args["aws_secret_access_key"] = secret_key
|
54
|
+
if region:
|
55
|
+
self._client_args["region_name"] = region
|
56
|
+
if endpoint_url:
|
57
|
+
self._client_args["endpoint_url"] = endpoint_url
|
48
58
|
|
49
|
-
|
50
|
-
raise ValueError("Secret key is not set. Please specify it in the environment variable "
|
51
|
-
"'{S3ObjectStoreClientConfig.SECRET_KEY_ENV}'.")
|
52
|
-
|
53
|
-
self._client_args = {
|
54
|
-
"aws_access_key_id": config.access_key,
|
55
|
-
"aws_secret_access_key": config.secret_key,
|
56
|
-
"region_name": config.region,
|
57
|
-
"endpoint_url": config.endpoint_url
|
58
|
-
}
|
59
|
-
|
60
|
-
async def __aenter__(self):
|
59
|
+
async def __aenter__(self) -> "S3ObjectStore":
|
61
60
|
|
62
61
|
if self._client_context is not None:
|
63
62
|
raise RuntimeError("Connection already established")
|
@@ -79,7 +78,7 @@ class S3ObjectStore(ObjectStore):
|
|
79
78
|
|
80
79
|
return self
|
81
80
|
|
82
|
-
async def __aexit__(self, exc_type, exc_value, traceback):
|
81
|
+
async def __aexit__(self, exc_type, exc_value, traceback) -> None:
|
83
82
|
|
84
83
|
if self._client_context is None:
|
85
84
|
raise RuntimeError("Connection not established")
|
@@ -112,11 +111,12 @@ class S3ObjectStore(ObjectStore):
|
|
112
111
|
except ClientError as e:
|
113
112
|
http_status_code = e.response.get("ResponseMetadata", {}).get("HTTPStatusCode", None)
|
114
113
|
if http_status_code == 412:
|
115
|
-
raise KeyAlreadyExistsError(
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
114
|
+
raise KeyAlreadyExistsError(
|
115
|
+
key=key,
|
116
|
+
additional_message=f"S3 object {self.bucket_name}/{key} already exists",
|
117
|
+
) from e
|
118
|
+
# Other errors — rethrow or handle accordingly
|
119
|
+
raise
|
120
120
|
|
121
121
|
async def upsert_object(self, key: str, item: ObjectStoreItem) -> None:
|
122
122
|
|
@@ -146,9 +146,8 @@ class S3ObjectStore(ObjectStore):
|
|
146
146
|
return ObjectStoreItem(data=data, content_type=response['ContentType'], metadata=response['Metadata'])
|
147
147
|
except ClientError as e:
|
148
148
|
if e.response['Error']['Code'] == 'NoSuchKey':
|
149
|
-
raise NoSuchKeyError(key=key, additional_message=str(e))
|
150
|
-
|
151
|
-
raise
|
149
|
+
raise NoSuchKeyError(key=key, additional_message=str(e)) from e
|
150
|
+
raise
|
152
151
|
|
153
152
|
async def delete_object(self, key: str) -> None:
|
154
153
|
if self._client is None:
|
@@ -158,9 +157,8 @@ class S3ObjectStore(ObjectStore):
|
|
158
157
|
await self._client.get_object(Bucket=self.bucket_name, Key=key)
|
159
158
|
except ClientError as e:
|
160
159
|
if e.response['Error']['Code'] == 'NoSuchKey':
|
161
|
-
raise NoSuchKeyError(key=key, additional_message=str(e))
|
162
|
-
|
163
|
-
raise
|
160
|
+
raise NoSuchKeyError(key=key, additional_message=str(e)) from e
|
161
|
+
raise
|
164
162
|
|
165
163
|
results = await self._client.delete_object(Bucket=self.bucket_name, Key=key)
|
166
164
|
|
@@ -1,10 +1,13 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: nvidia-nat-s3
|
3
|
-
Version: 1.3.
|
3
|
+
Version: 1.3.0rc2
|
4
4
|
Summary: Subpackage for S3-compatible integration in NeMo Agent toolkit
|
5
5
|
Keywords: ai,agents,memory,data store
|
6
6
|
Classifier: Programming Language :: Python
|
7
|
-
|
7
|
+
Classifier: Programming Language :: Python :: 3.11
|
8
|
+
Classifier: Programming Language :: Python :: 3.12
|
9
|
+
Classifier: Programming Language :: Python :: 3.13
|
10
|
+
Requires-Python: <3.14,>=3.11
|
8
11
|
Description-Content-Type: text/markdown
|
9
|
-
Requires-Dist: nvidia-nat==v1.3.0-
|
12
|
+
Requires-Dist: nvidia-nat==v1.3.0-rc2
|
10
13
|
Requires-Dist: aioboto3>=11.0.0
|
@@ -0,0 +1,9 @@
|
|
1
|
+
nat/plugins/s3/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
nat/plugins/s3/object_store.py,sha256=FDcO_8j__Nb-W8IY7JeUk5WoCRIqVNi1a1L1aVmYt10,2172
|
3
|
+
nat/plugins/s3/register.py,sha256=iBGq69m0rbZ3BTisA4Lt5UCHtW0Pc7m-l8G8dz-_pBc,813
|
4
|
+
nat/plugins/s3/s3_object_store.py,sha256=_2Sx1QXosuS2FnHXtG8qo4x9-xTNJVbNxoiJCZQcWgE,6052
|
5
|
+
nvidia_nat_s3-1.3.0rc2.dist-info/METADATA,sha256=1fBJAHq3YDseX_41WcK34P6SFSEbHrwlKmRCg92RaKk,506
|
6
|
+
nvidia_nat_s3-1.3.0rc2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
7
|
+
nvidia_nat_s3-1.3.0rc2.dist-info/entry_points.txt,sha256=HSc9lsaEu-3DyVezRMR-VZrfhWnDtA9llVaWE2CYZNw,63
|
8
|
+
nvidia_nat_s3-1.3.0rc2.dist-info/top_level.txt,sha256=8-CJ2cP6-f0ZReXe5Hzqp-5pvzzHz-5Ds5H2bGqh1-U,4
|
9
|
+
nvidia_nat_s3-1.3.0rc2.dist-info/RECORD,,
|
@@ -1,9 +0,0 @@
|
|
1
|
-
nat/plugins/s3/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
nat/plugins/s3/object_store.py,sha256=yg-YBd4DgQC7MPIznuMfCNoW8XBeb5fpSS3Aj6bKr_Q,2134
|
3
|
-
nat/plugins/s3/register.py,sha256=7gqnwyDrYttIlEaa7lo9AASYt-2GrZJE0YT2jpKjepo,845
|
4
|
-
nat/plugins/s3/s3_object_store.py,sha256=jFWFS_Ocl5Mil_WPB-zfmfi6SflyTBGvRf5ib-uU5dw,6250
|
5
|
-
nvidia_nat_s3-1.3.0.dev2.dist-info/METADATA,sha256=fCT18XHhdLopc_iFmFToEAoYZgTkSLbJDQQD40GPv0Y,356
|
6
|
-
nvidia_nat_s3-1.3.0.dev2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
7
|
-
nvidia_nat_s3-1.3.0.dev2.dist-info/entry_points.txt,sha256=HSc9lsaEu-3DyVezRMR-VZrfhWnDtA9llVaWE2CYZNw,63
|
8
|
-
nvidia_nat_s3-1.3.0.dev2.dist-info/top_level.txt,sha256=8-CJ2cP6-f0ZReXe5Hzqp-5pvzzHz-5Ds5H2bGqh1-U,4
|
9
|
-
nvidia_nat_s3-1.3.0.dev2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|