dyff-schema 0.20.0__tar.gz → 0.21.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 (59) hide show
  1. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/.gitlab-ci.yml +2 -2
  2. {dyff_schema-0.20.0/dyff_schema.egg-info → dyff_schema-0.21.0}/PKG-INFO +1 -1
  3. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/v0/r1/requests.py +71 -15
  4. {dyff_schema-0.20.0 → dyff_schema-0.21.0/dyff_schema.egg-info}/PKG-INFO +1 -1
  5. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/.gitignore +0 -0
  6. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/.licenserc.yaml +0 -0
  7. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/.pre-commit-config.yaml +0 -0
  8. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/.prettierignore +0 -0
  9. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/.secrets.baseline +0 -0
  10. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/CODE_OF_CONDUCT.md +0 -0
  11. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/LICENSE +0 -0
  12. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/NOTICE +0 -0
  13. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/README.md +0 -0
  14. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/__init__.py +0 -0
  15. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/adapters.py +0 -0
  16. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/annotations.py +0 -0
  17. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/base.py +0 -0
  18. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/copydoc.py +0 -0
  19. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/dataset/__init__.py +0 -0
  20. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/dataset/arrow.py +0 -0
  21. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/dataset/binary.py +0 -0
  22. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/dataset/classification.py +0 -0
  23. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/dataset/embedding.py +0 -0
  24. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/dataset/text.py +0 -0
  25. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/dataset/vision.py +0 -0
  26. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/errors.py +0 -0
  27. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/ids.py +0 -0
  28. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/io/__init__.py +0 -0
  29. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/io/vllm.py +0 -0
  30. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/platform.py +0 -0
  31. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/py.typed +0 -0
  32. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/quantity.py +0 -0
  33. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/requests.py +0 -0
  34. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/test.py +0 -0
  35. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/v0/__init__.py +0 -0
  36. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/v0/r1/__init__.py +0 -0
  37. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/v0/r1/adapters.py +0 -0
  38. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/v0/r1/base.py +0 -0
  39. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/v0/r1/dataset/__init__.py +0 -0
  40. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/v0/r1/dataset/arrow.py +0 -0
  41. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/v0/r1/dataset/binary.py +0 -0
  42. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/v0/r1/dataset/classification.py +0 -0
  43. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/v0/r1/dataset/embedding.py +0 -0
  44. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/v0/r1/dataset/text.py +0 -0
  45. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/v0/r1/dataset/vision.py +0 -0
  46. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/v0/r1/io/__init__.py +0 -0
  47. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/v0/r1/io/vllm.py +0 -0
  48. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/v0/r1/platform.py +0 -0
  49. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/v0/r1/test.py +0 -0
  50. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/v0/r1/version.py +0 -0
  51. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff/schema/version.py +0 -0
  52. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff_schema.egg-info/SOURCES.txt +0 -0
  53. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff_schema.egg-info/dependency_links.txt +0 -0
  54. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff_schema.egg-info/requires.txt +0 -0
  55. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/dyff_schema.egg-info/top_level.txt +0 -0
  56. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/makefile +0 -0
  57. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/pyproject.toml +0 -0
  58. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/setup.cfg +0 -0
  59. {dyff_schema-0.20.0 → dyff_schema-0.21.0}/tests/test_import.py +0 -0
@@ -12,7 +12,7 @@ include:
12
12
  file:
13
13
  - gitlab-release.yml
14
14
  - project: buildgarden/pipelines/detect-secrets
15
- ref: 0.2.2
15
+ ref: 0.2.3
16
16
  file:
17
17
  - detect-secrets.yml
18
18
  - project: buildgarden/pipelines/prettier
@@ -20,7 +20,7 @@ include:
20
20
  file:
21
21
  - prettier.yml
22
22
  - project: buildgarden/pipelines/python
23
- ref: 0.14.1
23
+ ref: 0.14.2
24
24
  file:
25
25
  - python-autoflake.yml
26
26
  - python-black.yml
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dyff-schema
3
- Version: 0.20.0
3
+ Version: 0.21.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
@@ -16,11 +16,11 @@ from __future__ import annotations
16
16
 
17
17
  import re
18
18
  from datetime import datetime
19
- from typing import Optional, Union
19
+ from typing import Literal, Optional, Union
20
20
 
21
21
  import pydantic
22
22
 
23
- from .base import DyffBaseModel
23
+ from .base import DyffBaseModel, DyffSchemaBaseModel
24
24
  from .platform import (
25
25
  AnalysisBase,
26
26
  AnalysisScope,
@@ -38,6 +38,8 @@ from .platform import (
38
38
  ModelSpec,
39
39
  ModuleBase,
40
40
  ReportBase,
41
+ summary_maxlen,
42
+ title_maxlen,
41
43
  )
42
44
  from .version import SchemaVersion
43
45
 
@@ -94,7 +96,28 @@ class AnalysisCreateRequest(DyffEntityCreateRequest, AnalysisBase):
94
96
 
95
97
 
96
98
  class ConcernCreateRequest(DyffEntityCreateRequest, ConcernBase):
97
- pass
99
+ @pydantic.validator("documentation", check_fields=False)
100
+ def _validate_documentation(
101
+ cls, documentation: DocumentationBase
102
+ ) -> DocumentationBase:
103
+ # TODO: This has to be a validator function because we can't apply the
104
+ # contraint to DocumentationBase, since there are already entities
105
+ # that violate the constraints in the data store. Fix in Schema v1.
106
+ if (
107
+ documentation.title is not None
108
+ and len(documentation.title) > title_maxlen()
109
+ ):
110
+ raise ValueError(
111
+ f".documentation.title must have length < {title_maxlen()}"
112
+ )
113
+ if (
114
+ documentation.summary is not None
115
+ and len(documentation.summary) > summary_maxlen()
116
+ ):
117
+ raise ValueError(
118
+ f".documentation.summary must have length < {summary_maxlen()}"
119
+ )
120
+ return documentation
98
121
 
99
122
 
100
123
  class DatasetCreateRequest(DyffEntityCreateRequest, DatasetBase):
@@ -102,7 +125,23 @@ class DatasetCreateRequest(DyffEntityCreateRequest, DatasetBase):
102
125
 
103
126
 
104
127
  class DocumentationEditRequest(DyffRequestBase, DocumentationBase):
105
- pass
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
106
145
 
107
146
 
108
147
  class InferenceServiceCreateRequest(DyffEntityCreateRequest, InferenceServiceBase):
@@ -213,7 +252,7 @@ class LabelUpdateRequest(DyffRequestBase, Labeled):
213
252
  # specify. I think it's not that important, because all of the query parameters
214
253
  # will always be optional. There could be a problem if the semantics of a
215
254
  # name change, but let's just not do that!
216
- class DyffEntityQueryRequest(DyffRequestDefaultValidators):
255
+ class QueryRequest(DyffRequestDefaultValidators):
217
256
  query: Optional[str] = pydantic.Field(
218
257
  default=None,
219
258
  description="A JSON structure describing a query, encoded as a string."
@@ -223,6 +262,30 @@ class DyffEntityQueryRequest(DyffRequestDefaultValidators):
223
262
  )
224
263
 
225
264
  id: Optional[str] = pydantic.Field(default=None)
265
+
266
+ order: Optional[Literal["ascending", "descending"]] = pydantic.Field(
267
+ default=None,
268
+ description="Sort the results in this order. Default: unsorted."
269
+ " Ignored unless 'orderBy' is also set."
270
+ " The order of operations is query -> order -> limit.",
271
+ )
272
+
273
+ orderBy: Optional[str] = pydantic.Field(
274
+ default=None,
275
+ description="Sort the results by the value of the specified field."
276
+ " The 'order' field must be set also."
277
+ " The order of operations is query -> order -> limit.",
278
+ )
279
+
280
+ limit: Optional[int] = pydantic.Field(
281
+ default=None,
282
+ ge=1,
283
+ description="Return at most this many results."
284
+ " The order of operations is query -> order -> limit.",
285
+ )
286
+
287
+
288
+ class DyffEntityQueryRequest(QueryRequest):
226
289
  account: Optional[str] = pydantic.Field(default=None)
227
290
  status: Optional[str] = pydantic.Field(default=None)
228
291
  reason: Optional[str] = pydantic.Field(default=None)
@@ -231,16 +294,8 @@ class DyffEntityQueryRequest(DyffRequestDefaultValidators):
231
294
  )
232
295
 
233
296
 
234
- class DocumentationQueryRequest(DyffRequestDefaultValidators):
235
- query: Optional[str] = pydantic.Field(
236
- default=None,
237
- description="A JSON structure describing a query, encoded as a string."
238
- " Valid keys are the same as the valid query keys for the corresponding"
239
- " endpoint. Values can be scalars or lists. Lists are treated as"
240
- " disjunctive queries (i.e., 'value $in list').",
241
- )
242
-
243
- id: Optional[str] = pydantic.Field(default=None)
297
+ class DocumentationQueryRequest(QueryRequest):
298
+ pass
244
299
 
245
300
 
246
301
  class _AnalysisProductQueryRequest(DyffEntityQueryRequest):
@@ -370,6 +425,7 @@ __all__ = [
370
425
  "ModelQueryRequest",
371
426
  "ModuleCreateRequest",
372
427
  "ModuleQueryRequest",
428
+ "QueryRequest",
373
429
  "ReportCreateRequest",
374
430
  "ReportQueryRequest",
375
431
  "SafetyCaseQueryRequest",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dyff-schema
3
- Version: 0.20.0
3
+ Version: 0.21.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