destiny_sdk 0.1.2__tar.gz → 0.1.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: destiny_sdk
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: A software development kit (sdk) to support interaction with the DESTINY repository
5
5
  License: Apache 2.0
6
6
  Author: Adam Hamilton
@@ -13,7 +13,7 @@ description = "A software development kit (sdk) to support interaction with the
13
13
  license = "Apache 2.0"
14
14
  name = "destiny_sdk"
15
15
  readme = "README.md"
16
- version = "0.1.2"
16
+ version = "0.1.3"
17
17
 
18
18
  [tool.poetry.dependencies]
19
19
  cachetools = "^5.5.2"
@@ -28,6 +28,7 @@ python-jose = "^3.4.0"
28
28
 
29
29
  [tool.poetry.group.dev.dependencies]
30
30
  mypy = "^1.15.0"
31
+ pre-commit = "^4.2.0"
31
32
  pytest-env = "^1.1.5"
32
33
  ruff = "^0.11.5"
33
34
  uvloop = "^0.21.0"
@@ -1,11 +1,10 @@
1
1
  """Enhancement classes for the Destiny Repository."""
2
2
 
3
3
  import datetime
4
- import uuid
5
4
  from enum import StrEnum, auto
6
5
  from typing import Annotated, Literal
7
6
 
8
- from pydantic import BaseModel, Field, HttpUrl
7
+ from pydantic import UUID4, BaseModel, Field, HttpUrl
9
8
 
10
9
  from destiny_sdk.core import _JsonlFileInputMixIn
11
10
  from destiny_sdk.visibility import Visibility
@@ -317,7 +316,15 @@ EnhancementContent = Annotated[
317
316
  class Enhancement(_JsonlFileInputMixIn, BaseModel):
318
317
  """Core enhancement class."""
319
318
 
320
- reference_id: uuid.UUID = Field(
319
+ id: UUID4 | None = Field(
320
+ default=None,
321
+ description=(
322
+ "The ID of the enhancement. "
323
+ "Populated by the repository when sending enhancements with references."
324
+ ),
325
+ )
326
+
327
+ reference_id: UUID4 = Field(
321
328
  description="The ID of the reference this enhancement is associated with."
322
329
  )
323
330
  source: str = Field(
@@ -330,7 +337,7 @@ class Enhancement(_JsonlFileInputMixIn, BaseModel):
330
337
  default=None,
331
338
  description="The version of the robot that generated the content.",
332
339
  )
333
- derived_from: list[uuid.UUID] | None = Field(
340
+ derived_from: list[UUID4] | None = Field(
334
341
  default=None,
335
342
  description="List of enhancement IDs that this enhancement was derived from.",
336
343
  )
@@ -1,16 +1,12 @@
1
1
  """Reference classes for the Destiny SDK."""
2
2
 
3
- from typing import Self
4
-
5
- from pydantic import UUID4, BaseModel, Field, TypeAdapter
3
+ from pydantic import UUID4, BaseModel, Field
6
4
 
7
5
  from destiny_sdk.core import _JsonlFileInputMixIn
8
6
  from destiny_sdk.enhancements import Enhancement, EnhancementFileInput
9
7
  from destiny_sdk.identifiers import ExternalIdentifier
10
8
  from destiny_sdk.visibility import Visibility
11
9
 
12
- external_identifier_adapter = TypeAdapter(ExternalIdentifier)
13
-
14
10
 
15
11
  class Reference(_JsonlFileInputMixIn, BaseModel):
16
12
  """Core reference class."""
@@ -31,24 +27,6 @@ class Reference(_JsonlFileInputMixIn, BaseModel):
31
27
  description="A list of enhancements for the reference",
32
28
  )
33
29
 
34
- @classmethod
35
- def from_es(cls, es_reference: dict) -> Self:
36
- """Create a Reference from an Elasticsearch document."""
37
- return cls(
38
- id=es_reference["_id"],
39
- visibility=Visibility(es_reference["_source"]["visibility"]),
40
- identifiers=[
41
- external_identifier_adapter.validate_python(identifier)
42
- for identifier in es_reference["_source"].get("identifiers", [])
43
- ],
44
- enhancements=[
45
- Enhancement.model_validate(
46
- enhancement | {"reference_id": es_reference["_id"]},
47
- )
48
- for enhancement in es_reference["_source"].get("enhancements", [])
49
- ],
50
- )
51
-
52
30
 
53
31
  class ReferenceFileInput(_JsonlFileInputMixIn, BaseModel):
54
32
  """Enhancement model used to marshall a file input."""
@@ -98,10 +98,15 @@ class RobotRequest(BaseModel):
98
98
  """An enhancement request from the repo to a robot."""
99
99
 
100
100
  id: UUID4
101
- reference: Reference # Reference with selected enhancements
102
- extra_fields: (
103
- dict | None
104
- ) # We need something to pass through the signed url for uploads
101
+ reference: Reference = Field(
102
+ description=(
103
+ "Reference to be enhanced, includes identifiers and existing enhancments."
104
+ )
105
+ )
106
+ extra_fields: dict | None = Field(
107
+ default=None,
108
+ description="Extra fields to pass to the robot. TBC.",
109
+ )
105
110
 
106
111
 
107
112
  #: The result for a single reference when processed by a batch enhancement request.
File without changes
File without changes