dyff-schema 0.26.0__tar.gz → 0.26.1__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.0/dyff_schema.egg-info → dyff_schema-0.26.1}/PKG-INFO +1 -1
  2. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/v0/r1/commands.py +21 -21
  3. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/v0/r1/requests.py +43 -27
  4. {dyff_schema-0.26.0 → dyff_schema-0.26.1/dyff_schema.egg-info}/PKG-INFO +1 -1
  5. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/.gitignore +0 -0
  6. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/.gitlab-ci.yml +0 -0
  7. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/.licenserc.yaml +0 -0
  8. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/.pre-commit-config.yaml +0 -0
  9. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/.prettierignore +0 -0
  10. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/.secrets.baseline +0 -0
  11. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/CODE_OF_CONDUCT.md +0 -0
  12. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/LICENSE +0 -0
  13. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/NOTICE +0 -0
  14. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/README.md +0 -0
  15. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/__init__.py +0 -0
  16. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/adapters.py +0 -0
  17. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/annotations.py +0 -0
  18. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/base.py +0 -0
  19. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/commands.py +0 -0
  20. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/copydoc.py +0 -0
  21. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/dataset/__init__.py +0 -0
  22. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/dataset/arrow.py +0 -0
  23. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/dataset/binary.py +0 -0
  24. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/dataset/classification.py +0 -0
  25. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/dataset/embedding.py +0 -0
  26. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/dataset/text.py +0 -0
  27. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/dataset/vision.py +0 -0
  28. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/errors.py +0 -0
  29. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/ids.py +0 -0
  30. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/io/__init__.py +0 -0
  31. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/io/vllm.py +0 -0
  32. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/platform.py +0 -0
  33. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/py.typed +0 -0
  34. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/quantity.py +0 -0
  35. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/requests.py +0 -0
  36. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/test.py +0 -0
  37. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/v0/__init__.py +0 -0
  38. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/v0/r1/__init__.py +0 -0
  39. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/v0/r1/adapters.py +0 -0
  40. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/v0/r1/base.py +0 -0
  41. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/v0/r1/dataset/__init__.py +0 -0
  42. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/v0/r1/dataset/arrow.py +0 -0
  43. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/v0/r1/dataset/binary.py +0 -0
  44. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/v0/r1/dataset/classification.py +0 -0
  45. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/v0/r1/dataset/embedding.py +0 -0
  46. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/v0/r1/dataset/text.py +0 -0
  47. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/v0/r1/dataset/vision.py +0 -0
  48. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/v0/r1/io/__init__.py +0 -0
  49. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/v0/r1/io/vllm.py +0 -0
  50. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/v0/r1/platform.py +0 -0
  51. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/v0/r1/test.py +0 -0
  52. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/v0/r1/version.py +0 -0
  53. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff/schema/version.py +0 -0
  54. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff_schema.egg-info/SOURCES.txt +0 -0
  55. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff_schema.egg-info/dependency_links.txt +0 -0
  56. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff_schema.egg-info/requires.txt +0 -0
  57. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/dyff_schema.egg-info/top_level.txt +0 -0
  58. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/makefile +0 -0
  59. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/pyproject.toml +0 -0
  60. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/setup.cfg +0 -0
  61. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/tests/test_adapters.py +0 -0
  62. {dyff_schema-0.26.0 → dyff_schema-0.26.1}/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.0
3
+ Version: 0.26.1
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
@@ -51,7 +51,7 @@ class FamilyIdentifier(EntityIdentifier):
51
51
  kind: Literal["Family"] = "Family"
52
52
 
53
53
 
54
- class Command(SchemaVersion):
54
+ class Command(SchemaVersion, DyffSchemaBaseModel):
55
55
  """Base class for Command messages.
56
56
 
57
57
  Commands define the API of the "command model" in our CQRS architecture.
@@ -95,17 +95,17 @@ class CreateEntity(Command):
95
95
 
96
96
 
97
97
  class EditEntityDocumentationPatch(DyffSchemaBaseModel):
98
- """Same properties as DocumentationBase, but generates a JSON Schema that allows
99
- fields to be set to JSON 'null'.
98
+ """Same properties as DocumentationBase, but assigning None to a field is
99
+ interpreted as a command to delete that field.
100
100
 
101
- This is needed to get JSON Merge Patch semantics, where explicit 'null' means
102
- "delete that field".
101
+ Fields that are assigned explicitly remain unchanged.
103
102
  """
104
103
 
105
104
  title: Optional[Union[pydantic.constr(max_length=title_maxlen()), Null]] = ( # type: ignore
106
105
  pydantic.Field(
107
106
  default=None,
108
- description='A short plain string suitable as a title or "headline".',
107
+ description='A short plain string suitable as a title or "headline".'
108
+ " Providing an explicit None value deletes the current value.",
109
109
  )
110
110
  )
111
111
 
@@ -113,19 +113,22 @@ class EditEntityDocumentationPatch(DyffSchemaBaseModel):
113
113
  pydantic.Field(
114
114
  default=None,
115
115
  description="A brief summary, suitable for display in"
116
- " small UI elements. Interpreted as Markdown. Excessively long"
117
- " summaries may be truncated in the UI, especially on small displays.",
116
+ " small UI elements. Providing an explicit None value deletes the"
117
+ " current value.",
118
118
  )
119
119
  )
120
120
 
121
121
  fullPage: Optional[Union[str, Null]] = pydantic.Field(
122
122
  default=None,
123
123
  description="Long-form documentation. Interpreted as"
124
- " Markdown. There are no length constraints, but be reasonable.",
124
+ " Markdown. There are no length constraints, but be reasonable."
125
+ " Providing an explicit None value deletes the current value.",
125
126
  )
126
127
 
127
128
 
128
129
  class EditEntityDocumentationAttributes(DyffSchemaBaseModel):
130
+ """Attributes for the EditEntityDocumentation command."""
131
+
129
132
  documentation: EditEntityDocumentationPatch = pydantic.Field(
130
133
  description="Edits to make to the documentation."
131
134
  )
@@ -155,18 +158,13 @@ class EditEntityDocumentation(Command):
155
158
 
156
159
 
157
160
  class EditEntityLabelsAttributes(DyffSchemaBaseModel):
161
+ """Attributes for the EditEntityLabels command."""
162
+
158
163
  labels: dict[LabelKeyType, Optional[Union[LabelValueType, Null]]] = pydantic.Field(
159
164
  default_factory=dict,
160
- description="A set of key-value labels for the resource. Used to"
161
- " specify identifying attributes of resources that are meaningful to"
162
- " users but do not imply semantics in the dyff system.\n\n"
163
- "The keys are DNS labels with an optional DNS domain prefix."
164
- " For example: 'my-key', 'your.com/key_0'. Keys prefixed with"
165
- " 'dyff.io/', 'subdomain.dyff.io/', etc. are reserved.\n\n"
166
- "The label values are alphanumeric characters separated by"
167
- " '.', '-', or '_'.\n\n"
168
- "We follow the kubernetes label conventions closely."
169
- " See: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels",
165
+ description="A set of key-value labels for the resource."
166
+ " Existing label keys that are not provided in the edit remain unchanged."
167
+ " Providing an explicit None value deletes the corresponding key.",
170
168
  )
171
169
 
172
170
 
@@ -194,7 +192,7 @@ class EditEntityLabels(Command):
194
192
 
195
193
 
196
194
  class EditFamilyMembersAttributes(DyffSchemaBaseModel):
197
- """Payload data for the EditFamilyMembers command."""
195
+ """Attributes for the EditFamilyMembers command."""
198
196
 
199
197
  members: dict[TagNameType, Optional[Union[FamilyMember, Null]]] = pydantic.Field(
200
198
  description="Mapping of names to IDs of member resources.",
@@ -236,11 +234,13 @@ class ForgetEntity(Command):
236
234
 
237
235
 
238
236
  class UpdateEntityStatusAttributes(DyffSchemaBaseModel):
237
+ """Attributes for the UpdateEntityStatus command."""
238
+
239
239
  status: str = pydantic.Field(
240
240
  description=Status.__fields__["status"].field_info.description
241
241
  )
242
242
 
243
- reason: Union[str, Null] = pydantic.Field(
243
+ reason: Optional[Union[str, Null]] = pydantic.Field(
244
244
  description=Status.__fields__["reason"].field_info.description
245
245
  )
246
246
 
@@ -16,11 +16,12 @@ from __future__ import annotations
16
16
 
17
17
  import re
18
18
  from datetime import datetime
19
- from typing import Literal, Optional, Union
19
+ from typing import Any, Literal, Optional, Union
20
20
 
21
21
  import pydantic
22
22
 
23
- from .base import DyffBaseModel, DyffSchemaBaseModel
23
+ from . import commands
24
+ from .base import DyffBaseModel
24
25
  from .platform import (
25
26
  AnalysisBase,
26
27
  AnalysisScope,
@@ -30,10 +31,8 @@ from .platform import (
30
31
  DocumentationBase,
31
32
  EvaluationBase,
32
33
  FamilyBase,
33
- FamilyMembers,
34
34
  InferenceServiceBase,
35
35
  InferenceSessionBase,
36
- Labeled,
37
36
  MethodBase,
38
37
  ModelSpec,
39
38
  ModuleBase,
@@ -43,6 +42,9 @@ from .platform import (
43
42
  )
44
43
  from .version import SchemaVersion
45
44
 
45
+ # mypy gets confused because 'dict' is the name of a method in DyffBaseModel
46
+ _ModelAsDict = dict[str, Any]
47
+
46
48
 
47
49
  class DyffRequestDefaultValidators(DyffBaseModel):
48
50
  """This must be the base class for *all* request models in the Dyff schema.
@@ -62,7 +64,19 @@ class DyffRequestDefaultValidators(DyffBaseModel):
62
64
 
63
65
 
64
66
  class DyffRequestBase(SchemaVersion, DyffRequestDefaultValidators):
65
- pass
67
+ # TODO: (DYFF-223) I think that exclude_unset=True should be the default
68
+ # for all schema objects, but I'm unsure of the consequences of making
69
+ # this change and we'll defer it until v1.
70
+ def dict(
71
+ self, *, by_alias: bool = True, exclude_unset=True, **kwargs
72
+ ) -> _ModelAsDict:
73
+ return super().dict(by_alias=by_alias, exclude_unset=exclude_unset, **kwargs)
74
+
75
+ def json(self, *, by_alias: bool = True, exclude_unset=True, **kwargs) -> str:
76
+ return super().json(by_alias=by_alias, exclude_unset=exclude_unset, **kwargs)
77
+
78
+
79
+ # ----------------------------------------------------------------------------
66
80
 
67
81
 
68
82
  class DyffEntityCreateRequest(DyffRequestBase):
@@ -124,26 +138,6 @@ class DatasetCreateRequest(DyffEntityCreateRequest, DatasetBase):
124
138
  pass
125
139
 
126
140
 
127
- class DocumentationEditRequest(DyffRequestBase, DocumentationBase):
128
- @pydantic.validator("title", check_fields=False)
129
- def _validate_title(cls, title: Optional[str]) -> Optional[str]:
130
- # TODO: This has to be a validator function because we can't apply the
131
- # contraint to DocumentationBase, since there are already entities
132
- # that violate the constraints in the data store. Fix in Schema v1.
133
- if title is not None and len(title) > title_maxlen():
134
- raise ValueError(f".title must have length < {title_maxlen()}")
135
- return title
136
-
137
- @pydantic.validator("summary", check_fields=False)
138
- def _validate_summary(cls, summary: Optional[str]) -> Optional[str]:
139
- # TODO: This has to be a validator function because we can't apply the
140
- # contraint to DocumentationBase, since there are already entities
141
- # that violate the constraints in the data store. Fix in Schema v1.
142
- if summary is not None and len(summary) > summary_maxlen():
143
- raise ValueError(f".summary must have length < {summary_maxlen()}")
144
- return summary
145
-
146
-
147
141
  class InferenceServiceCreateRequest(DyffEntityCreateRequest, InferenceServiceBase):
148
142
  model: Optional[str] = pydantic.Field(
149
143
  default=None, description="ID of Model backing the service, if applicable"
@@ -239,14 +233,35 @@ class ReportCreateRequest(DyffEntityCreateRequest, ReportBase):
239
233
  )
240
234
 
241
235
 
242
- class FamilyMembersEditRequest(DyffRequestBase, FamilyMembers):
236
+ # ----------------------------------------------------------------------------
237
+
238
+
239
+ class DocumentationEditRequest(
240
+ DyffRequestBase, commands.EditEntityDocumentationAttributes
241
+ ):
243
242
  pass
244
243
 
245
244
 
246
- class LabelUpdateRequest(DyffRequestBase, Labeled):
245
+ class FamilyMembersEditRequest(DyffRequestBase, commands.EditFamilyMembersAttributes):
247
246
  pass
248
247
 
249
248
 
249
+ class LabelsEditRequest(DyffRequestBase, commands.EditEntityLabelsAttributes):
250
+ pass
251
+
252
+
253
+ class LabelUpdateRequest(LabelsEditRequest):
254
+ """Deprecated alias for LabelsEditRequest.
255
+
256
+ .. deprecated:: 0.26.0
257
+
258
+ Use LabelsEditRequest
259
+ """
260
+
261
+
262
+ # ----------------------------------------------------------------------------
263
+
264
+
250
265
  # Note: Query requests, as they currently exist, don't work with Versioned
251
266
  # because fastapi will assign None to every field that the client doesn't
252
267
  # specify. I think it's not that important, because all of the query parameters
@@ -418,6 +433,7 @@ __all__ = [
418
433
  "InferenceSessionQueryRequest",
419
434
  "InferenceSessionTokenCreateRequest",
420
435
  "LabelUpdateRequest",
436
+ "LabelsEditRequest",
421
437
  "MeasurementQueryRequest",
422
438
  "MethodCreateRequest",
423
439
  "MethodQueryRequest",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: dyff-schema
3
- Version: 0.26.0
3
+ Version: 0.26.1
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