dyff-schema 0.26.1__py3-none-any.whl → 0.27.0__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.
- dyff/schema/v0/r1/base.py +10 -7
- dyff/schema/v0/r1/commands.py +41 -16
- dyff/schema/v0/r1/platform.py +5 -4
- {dyff_schema-0.26.1.dist-info → dyff_schema-0.27.0.dist-info}/METADATA +1 -1
- {dyff_schema-0.26.1.dist-info → dyff_schema-0.27.0.dist-info}/RECORD +9 -9
- {dyff_schema-0.26.1.dist-info → dyff_schema-0.27.0.dist-info}/LICENSE +0 -0
- {dyff_schema-0.26.1.dist-info → dyff_schema-0.27.0.dist-info}/NOTICE +0 -0
- {dyff_schema-0.26.1.dist-info → dyff_schema-0.27.0.dist-info}/WHEEL +0 -0
- {dyff_schema-0.26.1.dist-info → dyff_schema-0.27.0.dist-info}/top_level.txt +0 -0
dyff/schema/v0/r1/base.py
CHANGED
|
@@ -599,17 +599,20 @@ class DyffBaseModel(pydantic.BaseModel):
|
|
|
599
599
|
# TODO: (DYFF-223) I think that exclude_unset=True should be the default
|
|
600
600
|
# for all schema objects, but I'm unsure of the consequences of making
|
|
601
601
|
# this change and we'll defer it until v1.
|
|
602
|
-
def dict(
|
|
603
|
-
|
|
602
|
+
def dict(
|
|
603
|
+
self, *, by_alias: bool = True, exclude_none: bool = True, **kwargs
|
|
604
|
+
) -> _ModelAsDict:
|
|
605
|
+
return super().dict(by_alias=by_alias, exclude_none=exclude_none, **kwargs)
|
|
604
606
|
|
|
605
|
-
def json(
|
|
606
|
-
|
|
607
|
+
def json(
|
|
608
|
+
self, *, by_alias: bool = True, exclude_none: bool = True, **kwargs
|
|
609
|
+
) -> str:
|
|
610
|
+
return super().json(by_alias=by_alias, exclude_none=exclude_none, **kwargs)
|
|
607
611
|
|
|
608
612
|
def model_dump(
|
|
609
613
|
self,
|
|
610
614
|
*,
|
|
611
615
|
mode: Literal["python", "json"] = "python",
|
|
612
|
-
by_alias: bool = True,
|
|
613
616
|
**kwargs,
|
|
614
617
|
) -> _ModelAsDict:
|
|
615
618
|
"""Encode the object as a dict containing only JSON datatypes.
|
|
@@ -621,9 +624,9 @@ class DyffBaseModel(pydantic.BaseModel):
|
|
|
621
624
|
we convert to Pydantic 2. See: DYFF-223
|
|
622
625
|
"""
|
|
623
626
|
if mode == "python":
|
|
624
|
-
return self.dict(
|
|
627
|
+
return self.dict(**kwargs)
|
|
625
628
|
else:
|
|
626
|
-
return json.loads(self.json(
|
|
629
|
+
return json.loads(self.json(**kwargs))
|
|
627
630
|
|
|
628
631
|
|
|
629
632
|
# Note: I *really* wanted to require datetimes to have timezones, like in
|
dyff/schema/v0/r1/commands.py
CHANGED
|
@@ -33,6 +33,37 @@ from .platform import (
|
|
|
33
33
|
_ModelAsDict = dict[str, Any]
|
|
34
34
|
|
|
35
35
|
|
|
36
|
+
class _JsonMergePatchSemantics(DyffSchemaBaseModel):
|
|
37
|
+
"""Explicit None values will be output as json 'null', and fields that are not set
|
|
38
|
+
explicitly are not output.
|
|
39
|
+
|
|
40
|
+
In JSON Merge Patch terms, None means "delete this field", and not setting a value
|
|
41
|
+
means "leave this field unchanged".
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
def dict(self, *, by_alias: bool = True, **kwargs) -> _ModelAsDict:
|
|
45
|
+
return super().dict(
|
|
46
|
+
by_alias=by_alias, exclude_unset=True, exclude_none=False, **kwargs
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
def json(self, *, by_alias: bool = True, **kwargs) -> str:
|
|
50
|
+
return super().json(
|
|
51
|
+
by_alias=by_alias, exclude_unset=True, exclude_none=False, **kwargs
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
# class _NoneMeansUndefined(DyffSchemaBaseModel):
|
|
56
|
+
# """Fields with the value None will not be emitted in the JSON output."""
|
|
57
|
+
|
|
58
|
+
# # TODO: (DYFF-223) This should perhaps be the default for all schema
|
|
59
|
+
# # objects.
|
|
60
|
+
# def dict(self, *, exclude_none=True, **kwargs) -> _ModelAsDict:
|
|
61
|
+
# return super().dict(exclude_none=True, **kwargs)
|
|
62
|
+
|
|
63
|
+
# def json(self, *, exclude_none=True, **kwargs) -> str:
|
|
64
|
+
# return super().json(exclude_none=True, **kwargs)
|
|
65
|
+
|
|
66
|
+
|
|
36
67
|
class EntityIdentifier(DyffSchemaBaseModel):
|
|
37
68
|
"""Identifies a single entity."""
|
|
38
69
|
|
|
@@ -41,8 +72,13 @@ class EntityIdentifier(DyffSchemaBaseModel):
|
|
|
41
72
|
"""Create an identifier that identifies the given entity."""
|
|
42
73
|
return EntityIdentifier(kind=entity.kind, id=entity.id)
|
|
43
74
|
|
|
44
|
-
kind: EntityKindLiteral = pydantic.Field(description="The .kind of the entity.")
|
|
45
75
|
id: str = pydantic.Field(description="The .id of the entity.")
|
|
76
|
+
kind: Optional[EntityKindLiteral] = pydantic.Field(
|
|
77
|
+
default=None,
|
|
78
|
+
description="The .kind of the entity. This is optional because"
|
|
79
|
+
" sometimes you need to send a command without knowing the kind,"
|
|
80
|
+
" but it should be set whenever possible.",
|
|
81
|
+
)
|
|
46
82
|
|
|
47
83
|
|
|
48
84
|
class FamilyIdentifier(EntityIdentifier):
|
|
@@ -66,17 +102,6 @@ class Command(SchemaVersion, DyffSchemaBaseModel):
|
|
|
66
102
|
"UpdateEntityStatus",
|
|
67
103
|
]
|
|
68
104
|
|
|
69
|
-
# TODO: (DYFF-223) I think that exclude_unset=True should be the default
|
|
70
|
-
# for all schema objects, but I'm unsure of the consequences of making
|
|
71
|
-
# this change and we'll defer it until v1.
|
|
72
|
-
def dict(
|
|
73
|
-
self, *, by_alias: bool = True, exclude_unset=True, **kwargs
|
|
74
|
-
) -> _ModelAsDict:
|
|
75
|
-
return super().dict(by_alias=by_alias, exclude_unset=exclude_unset, **kwargs)
|
|
76
|
-
|
|
77
|
-
def json(self, *, by_alias: bool = True, exclude_unset=True, **kwargs) -> str:
|
|
78
|
-
return super().json(by_alias=by_alias, exclude_unset=exclude_unset, **kwargs)
|
|
79
|
-
|
|
80
105
|
|
|
81
106
|
# ----------------------------------------------------------------------------
|
|
82
107
|
|
|
@@ -94,7 +119,7 @@ class CreateEntity(Command):
|
|
|
94
119
|
# ----------------------------------------------------------------------------
|
|
95
120
|
|
|
96
121
|
|
|
97
|
-
class EditEntityDocumentationPatch(
|
|
122
|
+
class EditEntityDocumentationPatch(_JsonMergePatchSemantics):
|
|
98
123
|
"""Same properties as DocumentationBase, but assigning None to a field is
|
|
99
124
|
interpreted as a command to delete that field.
|
|
100
125
|
|
|
@@ -157,7 +182,7 @@ class EditEntityDocumentation(Command):
|
|
|
157
182
|
# ----------------------------------------------------------------------------
|
|
158
183
|
|
|
159
184
|
|
|
160
|
-
class EditEntityLabelsAttributes(
|
|
185
|
+
class EditEntityLabelsAttributes(_JsonMergePatchSemantics):
|
|
161
186
|
"""Attributes for the EditEntityLabels command."""
|
|
162
187
|
|
|
163
188
|
labels: dict[LabelKeyType, Optional[Union[LabelValueType, Null]]] = pydantic.Field(
|
|
@@ -191,7 +216,7 @@ class EditEntityLabels(Command):
|
|
|
191
216
|
# ----------------------------------------------------------------------------
|
|
192
217
|
|
|
193
218
|
|
|
194
|
-
class EditFamilyMembersAttributes(
|
|
219
|
+
class EditFamilyMembersAttributes(_JsonMergePatchSemantics):
|
|
195
220
|
"""Attributes for the EditFamilyMembers command."""
|
|
196
221
|
|
|
197
222
|
members: dict[TagNameType, Optional[Union[FamilyMember, Null]]] = pydantic.Field(
|
|
@@ -233,7 +258,7 @@ class ForgetEntity(Command):
|
|
|
233
258
|
# ----------------------------------------------------------------------------
|
|
234
259
|
|
|
235
260
|
|
|
236
|
-
class UpdateEntityStatusAttributes(
|
|
261
|
+
class UpdateEntityStatusAttributes(_JsonMergePatchSemantics):
|
|
237
262
|
"""Attributes for the UpdateEntityStatus command."""
|
|
238
263
|
|
|
239
264
|
status: str = pydantic.Field(
|
dyff/schema/v0/r1/platform.py
CHANGED
|
@@ -305,7 +305,7 @@ def LabelValue() -> type[str]:
|
|
|
305
305
|
|
|
306
306
|
def TagName() -> type[str]:
|
|
307
307
|
return pydantic.constr( # type: ignore
|
|
308
|
-
regex=_oci_image_tag_regex(), max_length=
|
|
308
|
+
regex=_oci_image_tag_regex(), max_length=_oci_image_tag_maxlen()
|
|
309
309
|
)
|
|
310
310
|
|
|
311
311
|
|
|
@@ -449,7 +449,7 @@ class DyffEntityMetadata(DyffSchemaBaseModel):
|
|
|
449
449
|
description="Unique identifier of the current revision of the entity.",
|
|
450
450
|
)
|
|
451
451
|
|
|
452
|
-
documentation:
|
|
452
|
+
documentation: DocumentationBase = pydantic.Field(
|
|
453
453
|
default_factory=DocumentationBase,
|
|
454
454
|
description="Documentation of the resource. The content is used to"
|
|
455
455
|
" populate various views in the web UI.",
|
|
@@ -493,7 +493,7 @@ class DyffEntity(Status, Labeled, SchemaVersion, DyffModelWithID):
|
|
|
493
493
|
)
|
|
494
494
|
|
|
495
495
|
creationTime: datetime = pydantic.Field(
|
|
496
|
-
|
|
496
|
+
description="Resource creation time (assigned by system)"
|
|
497
497
|
)
|
|
498
498
|
|
|
499
499
|
lastTransitionTime: Optional[datetime] = pydantic.Field(
|
|
@@ -728,8 +728,9 @@ class Family(DyffEntity, FamilyBase, FamilyMembers):
|
|
|
728
728
|
|
|
729
729
|
class RevisionMetadata(DyffSchemaBaseModel):
|
|
730
730
|
previousRevision: Optional[str] = pydantic.Field(
|
|
731
|
+
default=None,
|
|
731
732
|
description="The ID of the revision from which this revision was derived."
|
|
732
|
-
"If None, then this is the first revision of the entity."
|
|
733
|
+
"If None, then this is the first revision of the entity.",
|
|
733
734
|
)
|
|
734
735
|
creationTime: datetime = pydantic.Field(
|
|
735
736
|
description="The time when the Revision was created"
|
|
@@ -24,9 +24,9 @@ dyff/schema/io/vllm.py,sha256=2q05M_-lTzq9oywKXHPPpCFCSDVCSsRQqtmERzWTtio,123
|
|
|
24
24
|
dyff/schema/v0/__init__.py,sha256=L5y8UhRnojerPYHumsxQJRcHCNz8Hj9NM8b47mewMNs,92
|
|
25
25
|
dyff/schema/v0/r1/__init__.py,sha256=L5y8UhRnojerPYHumsxQJRcHCNz8Hj9NM8b47mewMNs,92
|
|
26
26
|
dyff/schema/v0/r1/adapters.py,sha256=dmQS2ecgDX4ZvTMOW-6NzV_Oq_UpaiyFd7QnSNoOnK8,33057
|
|
27
|
-
dyff/schema/v0/r1/base.py,sha256=
|
|
28
|
-
dyff/schema/v0/r1/commands.py,sha256=
|
|
29
|
-
dyff/schema/v0/r1/platform.py,sha256
|
|
27
|
+
dyff/schema/v0/r1/base.py,sha256=fSWeuiArzt7MOdLGqQPPNW4IPye-6EBrHSikFllQXxQ,20273
|
|
28
|
+
dyff/schema/v0/r1/commands.py,sha256=7kP8G4amtvt3pRd01PHusV3EYGrYX82pV2GFe4WcitE,9752
|
|
29
|
+
dyff/schema/v0/r1/platform.py,sha256=-HbsM-cHmm7HiLiVx-1vPQ4S8SqZqHK3UXwuCBtJi-g,80753
|
|
30
30
|
dyff/schema/v0/r1/requests.py,sha256=ZoaT_g7dPKIWtibWJFwlbuMJ2dXqIkS8h9mJ-7VnLr4,15789
|
|
31
31
|
dyff/schema/v0/r1/test.py,sha256=X6dUyVd5svcPCI-PBMOAqEfK9jv3bRDvkQTJzwS96c0,10720
|
|
32
32
|
dyff/schema/v0/r1/version.py,sha256=isKAGuGxsdru8vDaYmI4YiZdJOu_wNxXK7u6QzD6FE4,392
|
|
@@ -39,9 +39,9 @@ dyff/schema/v0/r1/dataset/text.py,sha256=nLIn91Zlt0tNdXUklSgjJ-kEDxoPX32ISLkiv2D
|
|
|
39
39
|
dyff/schema/v0/r1/dataset/vision.py,sha256=aIe0fbfM_g3DsrDTdg2K803YKLjZBpurM_VJcJFuZLc,369
|
|
40
40
|
dyff/schema/v0/r1/io/__init__.py,sha256=L5y8UhRnojerPYHumsxQJRcHCNz8Hj9NM8b47mewMNs,92
|
|
41
41
|
dyff/schema/v0/r1/io/vllm.py,sha256=CUE9y8KthtUI7sD49S875rDmPvKotSXVIRaBS79aBZs,5320
|
|
42
|
-
dyff_schema-0.
|
|
43
|
-
dyff_schema-0.
|
|
44
|
-
dyff_schema-0.
|
|
45
|
-
dyff_schema-0.
|
|
46
|
-
dyff_schema-0.
|
|
47
|
-
dyff_schema-0.
|
|
42
|
+
dyff_schema-0.27.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
43
|
+
dyff_schema-0.27.0.dist-info/METADATA,sha256=sCwQZWjkkkWNhuiV0OJ9FuQa2ddUVHsVvZqXOjhRKKs,3482
|
|
44
|
+
dyff_schema-0.27.0.dist-info/NOTICE,sha256=YONACu0s_Ui6jNi-wtEsVQbTU1JIkh8wvLH6d1-Ni_w,43
|
|
45
|
+
dyff_schema-0.27.0.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
|
46
|
+
dyff_schema-0.27.0.dist-info/top_level.txt,sha256=9e3VVdeX73t_sUJOPQPCcGtYO1JhoErhHIi3WoWGcFI,5
|
|
47
|
+
dyff_schema-0.27.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|