dyff-schema 0.7.0__py3-none-any.whl → 0.7.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.
Potentially problematic release.
This version of dyff-schema might be problematic. Click here for more details.
- dyff/schema/v0/r1/base.py +9 -0
- dyff/schema/v0/r1/platform.py +31 -7
- dyff/schema/v0/r1/requests.py +4 -4
- {dyff_schema-0.7.0.dist-info → dyff_schema-0.7.2.dist-info}/METADATA +1 -1
- {dyff_schema-0.7.0.dist-info → dyff_schema-0.7.2.dist-info}/RECORD +9 -9
- {dyff_schema-0.7.0.dist-info → dyff_schema-0.7.2.dist-info}/LICENSE +0 -0
- {dyff_schema-0.7.0.dist-info → dyff_schema-0.7.2.dist-info}/NOTICE +0 -0
- {dyff_schema-0.7.0.dist-info → dyff_schema-0.7.2.dist-info}/WHEEL +0 -0
- {dyff_schema-0.7.0.dist-info → dyff_schema-0.7.2.dist-info}/top_level.txt +0 -0
dyff/schema/v0/r1/base.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# SPDX-FileCopyrightText: 2024 UL Research Institutes
|
|
2
2
|
# SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
from datetime import datetime
|
|
4
5
|
from typing import Any, Generic, NamedTuple, Optional, Type, TypeVar
|
|
5
6
|
|
|
6
7
|
import pydantic
|
|
@@ -563,6 +564,14 @@ class DyffSchemaBaseModel(pydantic.BaseModel):
|
|
|
563
564
|
Python reserved words like 'bytes' as field names.
|
|
564
565
|
"""
|
|
565
566
|
|
|
567
|
+
@pydantic.root_validator
|
|
568
|
+
def _require_datetime_timezone_aware(cls, values):
|
|
569
|
+
for k, v in values.items():
|
|
570
|
+
if isinstance(v, datetime):
|
|
571
|
+
if v.tzinfo is None:
|
|
572
|
+
raise ValueError(f"{cls.__qualname__}.{k}: timezone not set")
|
|
573
|
+
return values
|
|
574
|
+
|
|
566
575
|
def dict(self, *, by_alias: bool = True, **kwargs) -> dict[str, Any]:
|
|
567
576
|
return super().dict(by_alias=by_alias, **kwargs)
|
|
568
577
|
|
dyff/schema/v0/r1/platform.py
CHANGED
|
@@ -18,7 +18,7 @@ We use the following naming convention:
|
|
|
18
18
|
# mypy: disable-error-code="import-untyped"
|
|
19
19
|
import abc
|
|
20
20
|
import enum
|
|
21
|
-
from datetime import datetime
|
|
21
|
+
from datetime import datetime, timezone
|
|
22
22
|
from enum import Enum
|
|
23
23
|
from typing import Any, Literal, NamedTuple, Optional, Type, Union
|
|
24
24
|
|
|
@@ -298,7 +298,7 @@ class Status(DyffSchemaBaseModel):
|
|
|
298
298
|
)
|
|
299
299
|
|
|
300
300
|
|
|
301
|
-
class
|
|
301
|
+
class DocumentationBase(DyffSchemaBaseModel):
|
|
302
302
|
title: Optional[str] = pydantic.Field(
|
|
303
303
|
default=None,
|
|
304
304
|
description='A short plain string suitable as a title or "headline".',
|
|
@@ -318,9 +318,13 @@ class Documentation(DyffSchemaBaseModel):
|
|
|
318
318
|
)
|
|
319
319
|
|
|
320
320
|
|
|
321
|
+
class Documentation(SchemaVersion, DocumentationBase):
|
|
322
|
+
pass
|
|
323
|
+
|
|
324
|
+
|
|
321
325
|
class Documented(DyffSchemaBaseModel):
|
|
322
|
-
documentation:
|
|
323
|
-
default_factory=
|
|
326
|
+
documentation: DocumentationBase = pydantic.Field(
|
|
327
|
+
default_factory=DocumentationBase,
|
|
324
328
|
description="Documentation of the resource. The content is used to"
|
|
325
329
|
" populate various views in the web UI.",
|
|
326
330
|
)
|
|
@@ -380,8 +384,8 @@ class Family(Labeled, SchemaVersion, DyffModelWithID):
|
|
|
380
384
|
description="Tags mapping interpretable names to resource IDs.",
|
|
381
385
|
)
|
|
382
386
|
|
|
383
|
-
documentation:
|
|
384
|
-
default_factory=
|
|
387
|
+
documentation: DocumentationBase = pydantic.Field(
|
|
388
|
+
default_factory=DocumentationBase,
|
|
385
389
|
description="Documentation of the resource family. The content is used"
|
|
386
390
|
" to populate various views in the web UI.",
|
|
387
391
|
)
|
|
@@ -528,7 +532,10 @@ class AccessGrant(DyffSchemaBaseModel):
|
|
|
528
532
|
)
|
|
529
533
|
|
|
530
534
|
|
|
531
|
-
|
|
535
|
+
# FIXME: We can't derive from DyffSchemaBaseModel right now because existing
|
|
536
|
+
# APIKeys don't have a timezone set for their datetime members.
|
|
537
|
+
# See: DYFF-406
|
|
538
|
+
class APIKey(pydantic.BaseModel):
|
|
532
539
|
"""A description of a set of permissions granted to a single subject (either an
|
|
533
540
|
account or a workload).
|
|
534
541
|
|
|
@@ -557,6 +564,22 @@ class APIKey(DyffSchemaBaseModel):
|
|
|
557
564
|
default_factory=list, description="AccessGrants associated with the APIKey"
|
|
558
565
|
)
|
|
559
566
|
|
|
567
|
+
@pydantic.root_validator
|
|
568
|
+
def _ensure_datetime_timezone_aware(cls, values):
|
|
569
|
+
update = {}
|
|
570
|
+
for k, v in values.items():
|
|
571
|
+
if isinstance(v, datetime):
|
|
572
|
+
if v.tzinfo is None:
|
|
573
|
+
update[k] = v.replace(tzinfo=timezone.utc)
|
|
574
|
+
values.update(update)
|
|
575
|
+
return values
|
|
576
|
+
|
|
577
|
+
def dict(self, *, by_alias: bool = True, **kwargs) -> dict[str, Any]:
|
|
578
|
+
return super().dict(by_alias=by_alias, **kwargs)
|
|
579
|
+
|
|
580
|
+
def json(self, *, by_alias: bool = True, **kwargs) -> str:
|
|
581
|
+
return super().json(by_alias=by_alias, **kwargs)
|
|
582
|
+
|
|
560
583
|
|
|
561
584
|
# ----------------------------------------------------------------------------
|
|
562
585
|
|
|
@@ -1861,6 +1884,7 @@ __all__ = [
|
|
|
1861
1884
|
"DataView",
|
|
1862
1885
|
"Digest",
|
|
1863
1886
|
"Documentation",
|
|
1887
|
+
"DocumentationBase",
|
|
1864
1888
|
"DyffDataSchema",
|
|
1865
1889
|
"DyffEntity",
|
|
1866
1890
|
"DyffModelWithID",
|
dyff/schema/v0/r1/requests.py
CHANGED
|
@@ -23,7 +23,7 @@ from .platform import (
|
|
|
23
23
|
AnalysisBase,
|
|
24
24
|
DatasetBase,
|
|
25
25
|
DataView,
|
|
26
|
-
|
|
26
|
+
DocumentationBase,
|
|
27
27
|
EvaluationBase,
|
|
28
28
|
InferenceServiceBase,
|
|
29
29
|
InferenceSessionBase,
|
|
@@ -52,7 +52,7 @@ class DatasetCreateRequest(DyffEntityCreateRequest, DatasetBase):
|
|
|
52
52
|
pass
|
|
53
53
|
|
|
54
54
|
|
|
55
|
-
class DocumentationEditRequest(
|
|
55
|
+
class DocumentationEditRequest(SchemaVersion, DocumentationBase):
|
|
56
56
|
pass
|
|
57
57
|
|
|
58
58
|
|
|
@@ -137,11 +137,11 @@ class ReportCreateRequest(DyffEntityCreateRequest, ReportBase):
|
|
|
137
137
|
)
|
|
138
138
|
|
|
139
139
|
|
|
140
|
-
class TagCreateRequest(TagBase):
|
|
140
|
+
class TagCreateRequest(SchemaVersion, TagBase):
|
|
141
141
|
pass
|
|
142
142
|
|
|
143
143
|
|
|
144
|
-
class LabelUpdateRequest(Labeled):
|
|
144
|
+
class LabelUpdateRequest(SchemaVersion, Labeled):
|
|
145
145
|
pass
|
|
146
146
|
|
|
147
147
|
|
|
@@ -20,9 +20,9 @@ dyff/schema/io/vllm.py,sha256=2q05M_-lTzq9oywKXHPPpCFCSDVCSsRQqtmERzWTtio,123
|
|
|
20
20
|
dyff/schema/v0/__init__.py,sha256=L5y8UhRnojerPYHumsxQJRcHCNz8Hj9NM8b47mewMNs,92
|
|
21
21
|
dyff/schema/v0/r1/__init__.py,sha256=L5y8UhRnojerPYHumsxQJRcHCNz8Hj9NM8b47mewMNs,92
|
|
22
22
|
dyff/schema/v0/r1/adapters.py,sha256=2t2oxsnGfSEDKKDIEYw4qqLXMH7qlFIwPVuLyUmbsHs,23552
|
|
23
|
-
dyff/schema/v0/r1/base.py,sha256=
|
|
24
|
-
dyff/schema/v0/r1/platform.py,sha256=
|
|
25
|
-
dyff/schema/v0/r1/requests.py,sha256=
|
|
23
|
+
dyff/schema/v0/r1/base.py,sha256=X4QVwOzNw5xPCF_f14w2JhARj1CHmGMjUmTcNzb-X0c,17471
|
|
24
|
+
dyff/schema/v0/r1/platform.py,sha256=ocEofM51a4bC0wlHB5zJO6jZUwJVUkYwv7RadTawhVA,61574
|
|
25
|
+
dyff/schema/v0/r1/requests.py,sha256=bTLtQUK80_fFeEWRG6QUJoLwy1_PyXf8ua9Ei4av0ug,8913
|
|
26
26
|
dyff/schema/v0/r1/test.py,sha256=X6dUyVd5svcPCI-PBMOAqEfK9jv3bRDvkQTJzwS96c0,10720
|
|
27
27
|
dyff/schema/v0/r1/version.py,sha256=isKAGuGxsdru8vDaYmI4YiZdJOu_wNxXK7u6QzD6FE4,392
|
|
28
28
|
dyff/schema/v0/r1/dataset/__init__.py,sha256=LbVlkO2asyGYBKk2z49xjJYTM-pu9y9e4eQDXgTDLnM,2553
|
|
@@ -33,9 +33,9 @@ dyff/schema/v0/r1/dataset/text.py,sha256=nLIn91Zlt0tNdXUklSgjJ-kEDxoPX32ISLkiv2D
|
|
|
33
33
|
dyff/schema/v0/r1/dataset/vision.py,sha256=aIe0fbfM_g3DsrDTdg2K803YKLjZBpurM_VJcJFuZLc,369
|
|
34
34
|
dyff/schema/v0/r1/io/__init__.py,sha256=L5y8UhRnojerPYHumsxQJRcHCNz8Hj9NM8b47mewMNs,92
|
|
35
35
|
dyff/schema/v0/r1/io/vllm.py,sha256=CUE9y8KthtUI7sD49S875rDmPvKotSXVIRaBS79aBZs,5320
|
|
36
|
-
dyff_schema-0.7.
|
|
37
|
-
dyff_schema-0.7.
|
|
38
|
-
dyff_schema-0.7.
|
|
39
|
-
dyff_schema-0.7.
|
|
40
|
-
dyff_schema-0.7.
|
|
41
|
-
dyff_schema-0.7.
|
|
36
|
+
dyff_schema-0.7.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
37
|
+
dyff_schema-0.7.2.dist-info/METADATA,sha256=zEELaVi3ZL67mNV3031i02KZH7DeuXqEwSkXR_C6LhI,3459
|
|
38
|
+
dyff_schema-0.7.2.dist-info/NOTICE,sha256=YONACu0s_Ui6jNi-wtEsVQbTU1JIkh8wvLH6d1-Ni_w,43
|
|
39
|
+
dyff_schema-0.7.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
40
|
+
dyff_schema-0.7.2.dist-info/top_level.txt,sha256=9e3VVdeX73t_sUJOPQPCcGtYO1JhoErhHIi3WoWGcFI,5
|
|
41
|
+
dyff_schema-0.7.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|