dyff-schema 0.7.0__tar.gz → 0.7.2__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.
Files changed (55) hide show
  1. {dyff_schema-0.7.0/dyff_schema.egg-info → dyff_schema-0.7.2}/PKG-INFO +1 -1
  2. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/v0/r1/base.py +9 -0
  3. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/v0/r1/platform.py +31 -7
  4. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/v0/r1/requests.py +4 -4
  5. {dyff_schema-0.7.0 → dyff_schema-0.7.2/dyff_schema.egg-info}/PKG-INFO +1 -1
  6. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/.gitignore +0 -0
  7. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/.gitlab-ci.yml +0 -0
  8. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/.licenserc.yaml +0 -0
  9. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/.pre-commit-config.yaml +0 -0
  10. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/.prettierignore +0 -0
  11. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/.secrets.baseline +0 -0
  12. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/CODE_OF_CONDUCT.md +0 -0
  13. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/LICENSE +0 -0
  14. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/NOTICE +0 -0
  15. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/README.md +0 -0
  16. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/__init__.py +0 -0
  17. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/adapters.py +0 -0
  18. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/base.py +0 -0
  19. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/copydoc.py +0 -0
  20. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/dataset/__init__.py +0 -0
  21. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/dataset/arrow.py +0 -0
  22. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/dataset/binary.py +0 -0
  23. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/dataset/classification.py +0 -0
  24. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/dataset/text.py +0 -0
  25. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/dataset/vision.py +0 -0
  26. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/ids.py +0 -0
  27. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/io/__init__.py +0 -0
  28. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/io/vllm.py +0 -0
  29. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/platform.py +0 -0
  30. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/py.typed +0 -0
  31. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/quantity.py +0 -0
  32. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/requests.py +0 -0
  33. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/test.py +0 -0
  34. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/v0/__init__.py +0 -0
  35. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/v0/r1/__init__.py +0 -0
  36. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/v0/r1/adapters.py +0 -0
  37. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/v0/r1/dataset/__init__.py +0 -0
  38. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/v0/r1/dataset/arrow.py +0 -0
  39. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/v0/r1/dataset/binary.py +0 -0
  40. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/v0/r1/dataset/classification.py +0 -0
  41. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/v0/r1/dataset/text.py +0 -0
  42. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/v0/r1/dataset/vision.py +0 -0
  43. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/v0/r1/io/__init__.py +0 -0
  44. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/v0/r1/io/vllm.py +0 -0
  45. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/v0/r1/test.py +0 -0
  46. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/v0/r1/version.py +0 -0
  47. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff/schema/version.py +0 -0
  48. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff_schema.egg-info/SOURCES.txt +0 -0
  49. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff_schema.egg-info/dependency_links.txt +0 -0
  50. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff_schema.egg-info/requires.txt +0 -0
  51. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/dyff_schema.egg-info/top_level.txt +0 -0
  52. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/makefile +0 -0
  53. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/pyproject.toml +0 -0
  54. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/setup.cfg +0 -0
  55. {dyff_schema-0.7.0 → dyff_schema-0.7.2}/tests/test_import.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dyff-schema
3
- Version: 0.7.0
3
+ Version: 0.7.2
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
@@ -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
 
@@ -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 Documentation(DyffSchemaBaseModel):
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: Documentation = pydantic.Field(
323
- default_factory=Documentation,
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: Documentation = pydantic.Field(
384
- default_factory=Documentation,
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
- class APIKey(DyffSchemaBaseModel):
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",
@@ -23,7 +23,7 @@ from .platform import (
23
23
  AnalysisBase,
24
24
  DatasetBase,
25
25
  DataView,
26
- Documentation,
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(Documentation):
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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dyff-schema
3
- Version: 0.7.0
3
+ Version: 0.7.2
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
File without changes
File without changes
File without changes
File without changes