dyff-schema 0.26.1__tar.gz → 0.27.0__tar.gz

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.

Files changed (62) hide show
  1. {dyff_schema-0.26.1/dyff_schema.egg-info → dyff_schema-0.27.0}/PKG-INFO +1 -1
  2. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/v0/r1/base.py +10 -7
  3. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/v0/r1/commands.py +41 -16
  4. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/v0/r1/platform.py +5 -4
  5. {dyff_schema-0.26.1 → dyff_schema-0.27.0/dyff_schema.egg-info}/PKG-INFO +1 -1
  6. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/.gitignore +0 -0
  7. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/.gitlab-ci.yml +0 -0
  8. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/.licenserc.yaml +0 -0
  9. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/.pre-commit-config.yaml +0 -0
  10. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/.prettierignore +0 -0
  11. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/.secrets.baseline +0 -0
  12. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/CODE_OF_CONDUCT.md +0 -0
  13. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/LICENSE +0 -0
  14. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/NOTICE +0 -0
  15. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/README.md +0 -0
  16. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/__init__.py +0 -0
  17. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/adapters.py +0 -0
  18. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/annotations.py +0 -0
  19. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/base.py +0 -0
  20. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/commands.py +0 -0
  21. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/copydoc.py +0 -0
  22. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/dataset/__init__.py +0 -0
  23. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/dataset/arrow.py +0 -0
  24. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/dataset/binary.py +0 -0
  25. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/dataset/classification.py +0 -0
  26. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/dataset/embedding.py +0 -0
  27. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/dataset/text.py +0 -0
  28. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/dataset/vision.py +0 -0
  29. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/errors.py +0 -0
  30. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/ids.py +0 -0
  31. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/io/__init__.py +0 -0
  32. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/io/vllm.py +0 -0
  33. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/platform.py +0 -0
  34. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/py.typed +0 -0
  35. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/quantity.py +0 -0
  36. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/requests.py +0 -0
  37. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/test.py +0 -0
  38. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/v0/__init__.py +0 -0
  39. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/v0/r1/__init__.py +0 -0
  40. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/v0/r1/adapters.py +0 -0
  41. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/v0/r1/dataset/__init__.py +0 -0
  42. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/v0/r1/dataset/arrow.py +0 -0
  43. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/v0/r1/dataset/binary.py +0 -0
  44. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/v0/r1/dataset/classification.py +0 -0
  45. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/v0/r1/dataset/embedding.py +0 -0
  46. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/v0/r1/dataset/text.py +0 -0
  47. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/v0/r1/dataset/vision.py +0 -0
  48. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/v0/r1/io/__init__.py +0 -0
  49. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/v0/r1/io/vllm.py +0 -0
  50. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/v0/r1/requests.py +0 -0
  51. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/v0/r1/test.py +0 -0
  52. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/v0/r1/version.py +0 -0
  53. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff/schema/version.py +0 -0
  54. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff_schema.egg-info/SOURCES.txt +0 -0
  55. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff_schema.egg-info/dependency_links.txt +0 -0
  56. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff_schema.egg-info/requires.txt +0 -0
  57. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/dyff_schema.egg-info/top_level.txt +0 -0
  58. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/makefile +0 -0
  59. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/pyproject.toml +0 -0
  60. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/setup.cfg +0 -0
  61. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/tests/test_adapters.py +0 -0
  62. {dyff_schema-0.26.1 → dyff_schema-0.27.0}/tests/test_import.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: dyff-schema
3
- Version: 0.26.1
3
+ Version: 0.27.0
4
4
  Summary: Data models for the Dyff AI auditing platform.
5
5
  Author-email: Digital Safety Research Institute <contact@dsri.org>
6
6
  License: Apache-2.0
@@ -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(self, *, by_alias: bool = True, **kwargs) -> _ModelAsDict:
603
- return super().dict(by_alias=by_alias, **kwargs)
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(self, *, by_alias: bool = True, **kwargs) -> str:
606
- return super().json(by_alias=by_alias, **kwargs)
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(by_alias=by_alias, **kwargs)
627
+ return self.dict(**kwargs)
625
628
  else:
626
- return json.loads(self.json(by_alias=by_alias, **kwargs))
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
@@ -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(DyffSchemaBaseModel):
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(DyffSchemaBaseModel):
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(DyffSchemaBaseModel):
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(DyffSchemaBaseModel):
261
+ class UpdateEntityStatusAttributes(_JsonMergePatchSemantics):
237
262
  """Attributes for the UpdateEntityStatus command."""
238
263
 
239
264
  status: str = pydantic.Field(
@@ -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=_k8s_label_key_maxlen()
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: Optional[DocumentationBase] = pydantic.Field(
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
- default=None, description="Resource creation time (assigned by system)"
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"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: dyff-schema
3
- Version: 0.26.1
3
+ Version: 0.27.0
4
4
  Summary: Data models for the Dyff AI auditing platform.
5
5
  Author-email: Digital Safety Research Institute <contact@dsri.org>
6
6
  License: Apache-2.0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes