dyff-schema 0.8.0__py3-none-any.whl → 0.9.1__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.
Potentially problematic release.
This version of dyff-schema might be problematic. Click here for more details.
- dyff/schema/errors.py +51 -0
- dyff/schema/v0/r1/platform.py +3 -3
- dyff/schema/v0/r1/requests.py +11 -8
- {dyff_schema-0.8.0.dist-info → dyff_schema-0.9.1.dist-info}/METADATA +1 -1
- {dyff_schema-0.8.0.dist-info → dyff_schema-0.9.1.dist-info}/RECORD +9 -8
- {dyff_schema-0.8.0.dist-info → dyff_schema-0.9.1.dist-info}/LICENSE +0 -0
- {dyff_schema-0.8.0.dist-info → dyff_schema-0.9.1.dist-info}/NOTICE +0 -0
- {dyff_schema-0.8.0.dist-info → dyff_schema-0.9.1.dist-info}/WHEEL +0 -0
- {dyff_schema-0.8.0.dist-info → dyff_schema-0.9.1.dist-info}/top_level.txt +0 -0
dyff/schema/errors.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2024 UL Research Institutes
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
from typing import NamedTuple, Optional
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class HTTPResponseStatus(NamedTuple):
|
|
9
|
+
code: int
|
|
10
|
+
status: str
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
HTTP_400_BAD_REQUEST = HTTPResponseStatus(400, "Bad Request")
|
|
14
|
+
HTTP_500_INTERNAL_SERVER_ERROR = HTTPResponseStatus(500, "Internal Server Error")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class DyffError(Exception):
|
|
18
|
+
"""Base class for Errors originating from the Dyff Platform."""
|
|
19
|
+
|
|
20
|
+
def __init__(self, message, *, http_status: Optional[HTTPResponseStatus] = None):
|
|
21
|
+
self.message = message
|
|
22
|
+
self.http_status = http_status
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ClientError(DyffError):
|
|
26
|
+
"""The error was caused by the client using an API incorrectly."""
|
|
27
|
+
|
|
28
|
+
def __init__(
|
|
29
|
+
self, message, *, http_status: HTTPResponseStatus = HTTP_400_BAD_REQUEST
|
|
30
|
+
):
|
|
31
|
+
if not (400 <= http_status.code <= 499):
|
|
32
|
+
raise AssertionError(
|
|
33
|
+
f"ClientError should map to a 4xx HTTP status; got {http_status}"
|
|
34
|
+
)
|
|
35
|
+
super().__init__(message, http_status=http_status)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class PlatformError(DyffError):
|
|
39
|
+
"""The error was caused by an internal problem with the platform."""
|
|
40
|
+
|
|
41
|
+
def __init__(
|
|
42
|
+
self,
|
|
43
|
+
message,
|
|
44
|
+
*,
|
|
45
|
+
http_status: HTTPResponseStatus = HTTP_500_INTERNAL_SERVER_ERROR,
|
|
46
|
+
):
|
|
47
|
+
if not (500 <= http_status.code <= 599):
|
|
48
|
+
raise AssertionError(
|
|
49
|
+
f"PlatformError should map to a 5xx HTTP status; got {http_status}"
|
|
50
|
+
)
|
|
51
|
+
super().__init__(message, http_status=http_status)
|
dyff/schema/v0/r1/platform.py
CHANGED
|
@@ -67,7 +67,7 @@ def _dns_domain_regex():
|
|
|
67
67
|
Note that its maximum length is 253 characters, but we can't enforce this in the
|
|
68
68
|
regex.
|
|
69
69
|
"""
|
|
70
|
-
return
|
|
70
|
+
return rf"{_dns_label_regex()}(\.{_dns_label_regex()})*"
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
def _k8s_domain_maxlen():
|
|
@@ -96,7 +96,7 @@ def _k8s_label_key_regex():
|
|
|
96
96
|
* my-multi_segment.key
|
|
97
97
|
* dyff.io/reserved-key
|
|
98
98
|
"""
|
|
99
|
-
return
|
|
99
|
+
return rf"^({_dns_domain_regex()}/)?{_dns_label_regex()}$"
|
|
100
100
|
|
|
101
101
|
|
|
102
102
|
def _k8s_label_key_maxlen():
|
|
@@ -126,7 +126,7 @@ def _k8s_label_value_regex():
|
|
|
126
126
|
|
|
127
127
|
See: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
|
|
128
128
|
"""
|
|
129
|
-
return
|
|
129
|
+
return rf"^({_k8s_label_regex()})?$"
|
|
130
130
|
|
|
131
131
|
|
|
132
132
|
def _k8s_label_value_maxlen():
|
dyff/schema/v0/r1/requests.py
CHANGED
|
@@ -12,9 +12,10 @@ resource will include the full dependency object as a sub-resource. The
|
|
|
12
12
|
in response.
|
|
13
13
|
"""
|
|
14
14
|
|
|
15
|
+
from __future__ import annotations
|
|
15
16
|
|
|
16
17
|
from datetime import datetime
|
|
17
|
-
from typing import
|
|
18
|
+
from typing import Optional, Union
|
|
18
19
|
|
|
19
20
|
import pydantic
|
|
20
21
|
|
|
@@ -172,6 +173,14 @@ class LabelUpdateRequest(DyffRequestBase, Labeled):
|
|
|
172
173
|
# will always be optional. There could be a problem if the semantics of a
|
|
173
174
|
# name change, but let's just not do that!
|
|
174
175
|
class DyffEntityQueryRequest(DyffRequestDefaultValidators):
|
|
176
|
+
query: Optional[str] = pydantic.Field(
|
|
177
|
+
default=None,
|
|
178
|
+
description="A JSON structure describing a query, encoded as a string."
|
|
179
|
+
" Valid keys are the same as the valid query keys for the corresponding"
|
|
180
|
+
" endpoint. Values can be scalars or lists. Lists are treated as"
|
|
181
|
+
" disjunctive queries (i.e., 'value $in list').",
|
|
182
|
+
)
|
|
183
|
+
|
|
175
184
|
id: Optional[str] = pydantic.Field(default=None)
|
|
176
185
|
account: Optional[str] = pydantic.Field(default=None)
|
|
177
186
|
status: Optional[str] = pydantic.Field(default=None)
|
|
@@ -180,12 +189,6 @@ class DyffEntityQueryRequest(DyffRequestDefaultValidators):
|
|
|
180
189
|
default=None, description="Labels dict represented as a JSON string."
|
|
181
190
|
)
|
|
182
191
|
|
|
183
|
-
def dict(self, exclude_unset=True, **kwargs) -> dict[str, Any]:
|
|
184
|
-
return super().dict(exclude_unset=exclude_unset, **kwargs)
|
|
185
|
-
|
|
186
|
-
def json(self, exclude_unset=True, **kwargs) -> Any:
|
|
187
|
-
return super().json(exclude_unset=exclude_unset, **kwargs)
|
|
188
|
-
|
|
189
192
|
|
|
190
193
|
class _AnalysisProductQueryRequest(DyffEntityQueryRequest):
|
|
191
194
|
method: Optional[str] = pydantic.Field(default=None)
|
|
@@ -194,7 +197,7 @@ class _AnalysisProductQueryRequest(DyffEntityQueryRequest):
|
|
|
194
197
|
evaluation: Optional[str] = pydantic.Field(default=None)
|
|
195
198
|
inferenceService: Optional[str] = pydantic.Field(default=None)
|
|
196
199
|
model: Optional[str] = pydantic.Field(default=None)
|
|
197
|
-
|
|
200
|
+
inputs: Optional[str] = pydantic.Field(default=None)
|
|
198
201
|
|
|
199
202
|
|
|
200
203
|
class AuditQueryRequest(DyffEntityQueryRequest):
|
|
@@ -2,6 +2,7 @@ dyff/schema/__init__.py,sha256=JcpxaRHNYgLjJWLjVayLlqacb2GX49Pazpwb8m-BctM,1031
|
|
|
2
2
|
dyff/schema/adapters.py,sha256=YMTHv_2VlLGFp-Kqwa6H51hjffHmk8gXjZilHysIF5Q,123
|
|
3
3
|
dyff/schema/base.py,sha256=jvaNtsSZyFfsdUZTcY_U-yfLY5_GyrMxSXhON2R9XR0,119
|
|
4
4
|
dyff/schema/copydoc.py,sha256=B4ZRpQmbFxi-3l9LCHvaJiVKb9VxADgC5vey804Febc,1075
|
|
5
|
+
dyff/schema/errors.py,sha256=ow3yiucU4wGkeLmapUURp3eyaebwGUwDaVTXpPcrA7M,1542
|
|
5
6
|
dyff/schema/ids.py,sha256=Z3JQzlAJQC2Pam7ehxb4TXA4MIuFQN5SyzL5Ql0RukA,1422
|
|
6
7
|
dyff/schema/platform.py,sha256=peHzGGSd5dQ-EFXrWDjBqMUtoOL3iCHxcV3XzW6Rjag,123
|
|
7
8
|
dyff/schema/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -21,8 +22,8 @@ dyff/schema/v0/__init__.py,sha256=L5y8UhRnojerPYHumsxQJRcHCNz8Hj9NM8b47mewMNs,92
|
|
|
21
22
|
dyff/schema/v0/r1/__init__.py,sha256=L5y8UhRnojerPYHumsxQJRcHCNz8Hj9NM8b47mewMNs,92
|
|
22
23
|
dyff/schema/v0/r1/adapters.py,sha256=2t2oxsnGfSEDKKDIEYw4qqLXMH7qlFIwPVuLyUmbsHs,23552
|
|
23
24
|
dyff/schema/v0/r1/base.py,sha256=QX1TfqX3jBafxpBnf2bUTcgP0sMyqZFFNJZQHhM48BI,19385
|
|
24
|
-
dyff/schema/v0/r1/platform.py,sha256=
|
|
25
|
-
dyff/schema/v0/r1/requests.py,sha256=
|
|
25
|
+
dyff/schema/v0/r1/platform.py,sha256=t7XKNBXByrkleLhcRZn1Et0Dtb36CtmghWeezThz_UI,61416
|
|
26
|
+
dyff/schema/v0/r1/requests.py,sha256=I2K3thOsga0X9-6oRsAO1Hqgkr8qV_8haw-7ALIf_yc,9857
|
|
26
27
|
dyff/schema/v0/r1/test.py,sha256=X6dUyVd5svcPCI-PBMOAqEfK9jv3bRDvkQTJzwS96c0,10720
|
|
27
28
|
dyff/schema/v0/r1/version.py,sha256=isKAGuGxsdru8vDaYmI4YiZdJOu_wNxXK7u6QzD6FE4,392
|
|
28
29
|
dyff/schema/v0/r1/dataset/__init__.py,sha256=LbVlkO2asyGYBKk2z49xjJYTM-pu9y9e4eQDXgTDLnM,2553
|
|
@@ -33,9 +34,9 @@ dyff/schema/v0/r1/dataset/text.py,sha256=nLIn91Zlt0tNdXUklSgjJ-kEDxoPX32ISLkiv2D
|
|
|
33
34
|
dyff/schema/v0/r1/dataset/vision.py,sha256=aIe0fbfM_g3DsrDTdg2K803YKLjZBpurM_VJcJFuZLc,369
|
|
34
35
|
dyff/schema/v0/r1/io/__init__.py,sha256=L5y8UhRnojerPYHumsxQJRcHCNz8Hj9NM8b47mewMNs,92
|
|
35
36
|
dyff/schema/v0/r1/io/vllm.py,sha256=CUE9y8KthtUI7sD49S875rDmPvKotSXVIRaBS79aBZs,5320
|
|
36
|
-
dyff_schema-0.
|
|
37
|
-
dyff_schema-0.
|
|
38
|
-
dyff_schema-0.
|
|
39
|
-
dyff_schema-0.
|
|
40
|
-
dyff_schema-0.
|
|
41
|
-
dyff_schema-0.
|
|
37
|
+
dyff_schema-0.9.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
38
|
+
dyff_schema-0.9.1.dist-info/METADATA,sha256=sBEGjSCsLcUKsMq0TCX-pd7DoWYXRgRCbu_vJJlq_pw,3459
|
|
39
|
+
dyff_schema-0.9.1.dist-info/NOTICE,sha256=YONACu0s_Ui6jNi-wtEsVQbTU1JIkh8wvLH6d1-Ni_w,43
|
|
40
|
+
dyff_schema-0.9.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
41
|
+
dyff_schema-0.9.1.dist-info/top_level.txt,sha256=9e3VVdeX73t_sUJOPQPCcGtYO1JhoErhHIi3WoWGcFI,5
|
|
42
|
+
dyff_schema-0.9.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|