evo-objects 0.2.2__tar.gz → 0.2.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.
- {evo_objects-0.2.2 → evo_objects-0.2.3}/PKG-INFO +1 -1
- {evo_objects-0.2.2 → evo_objects-0.2.3}/pyproject.toml +1 -1
- {evo_objects-0.2.2 → evo_objects-0.2.3}/src/evo/objects/__init__.py +2 -1
- {evo_objects-0.2.2 → evo_objects-0.2.3}/src/evo/objects/client.py +38 -2
- {evo_objects-0.2.2 → evo_objects-0.2.3}/src/evo/objects/data.py +32 -0
- {evo_objects-0.2.2 → evo_objects-0.2.3}/.gitignore +0 -0
- {evo_objects-0.2.2 → evo_objects-0.2.3}/LICENSE.md +0 -0
- {evo_objects-0.2.2 → evo_objects-0.2.3}/src/evo/objects/_model_config.py +0 -0
- {evo_objects-0.2.2 → evo_objects-0.2.3}/src/evo/objects/endpoints/__init__.py +0 -0
- {evo_objects-0.2.2 → evo_objects-0.2.3}/src/evo/objects/endpoints/api/__init__.py +0 -0
- {evo_objects-0.2.2 → evo_objects-0.2.3}/src/evo/objects/endpoints/api/data_api.py +0 -0
- {evo_objects-0.2.2 → evo_objects-0.2.3}/src/evo/objects/endpoints/api/metadata_api.py +0 -0
- {evo_objects-0.2.2 → evo_objects-0.2.3}/src/evo/objects/endpoints/api/objects_api.py +0 -0
- {evo_objects-0.2.2 → evo_objects-0.2.3}/src/evo/objects/endpoints/api/stages_api.py +0 -0
- {evo_objects-0.2.2 → evo_objects-0.2.3}/src/evo/objects/endpoints/models.py +0 -0
- {evo_objects-0.2.2 → evo_objects-0.2.3}/src/evo/objects/exceptions.py +0 -0
- {evo_objects-0.2.2 → evo_objects-0.2.3}/src/evo/objects/io.py +0 -0
- {evo_objects-0.2.2 → evo_objects-0.2.3}/src/evo/objects/py.typed +0 -0
- {evo_objects-0.2.2 → evo_objects-0.2.3}/src/evo/objects/utils/__init__.py +0 -0
- {evo_objects-0.2.2 → evo_objects-0.2.3}/src/evo/objects/utils/_types.py +0 -0
- {evo_objects-0.2.2 → evo_objects-0.2.3}/src/evo/objects/utils/data.py +0 -0
- {evo_objects-0.2.2 → evo_objects-0.2.3}/src/evo/objects/utils/table_formats.py +0 -0
- {evo_objects-0.2.2 → evo_objects-0.2.3}/src/evo/objects/utils/tables.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: evo-objects
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: Python SDK for using the Seequent Evo Geoscience Object API
|
|
5
5
|
Project-URL: Source, https://github.com/SeequentEvo/evo-python-sdk
|
|
6
6
|
Project-URL: Tracker, https://github.com/SeequentEvo/evo-python-sdk/issues
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
# limitations under the License.
|
|
11
11
|
|
|
12
12
|
from .client import DownloadedObject, ObjectAPIClient
|
|
13
|
-
from .data import ObjectMetadata, ObjectSchema, ObjectVersion, SchemaVersion
|
|
13
|
+
from .data import ObjectMetadata, ObjectSchema, ObjectVersion, SchemaVersion, Stage
|
|
14
14
|
from .io import ObjectDataDownload, ObjectDataUpload
|
|
15
15
|
|
|
16
16
|
__all__ = [
|
|
@@ -22,4 +22,5 @@ __all__ = [
|
|
|
22
22
|
"ObjectSchema",
|
|
23
23
|
"ObjectVersion",
|
|
24
24
|
"SchemaVersion",
|
|
25
|
+
"Stage",
|
|
25
26
|
]
|
|
@@ -22,13 +22,14 @@ from evo.common.io.exceptions import DataNotFoundError
|
|
|
22
22
|
from evo.common.utils import get_service_health, parse_order_by
|
|
23
23
|
from evo.workspaces import ServiceUser
|
|
24
24
|
|
|
25
|
-
from .data import ObjectMetadata, ObjectOrderByEnum, ObjectSchema, ObjectVersion, OrgObjectMetadata
|
|
26
|
-
from .endpoints import ObjectsApi
|
|
25
|
+
from .data import ObjectMetadata, ObjectOrderByEnum, ObjectSchema, ObjectVersion, OrgObjectMetadata, Stage
|
|
26
|
+
from .endpoints import MetadataApi, ObjectsApi, StagesApi
|
|
27
27
|
from .endpoints.models import (
|
|
28
28
|
GeoscienceObject,
|
|
29
29
|
GeoscienceObjectVersion,
|
|
30
30
|
GetObjectResponse,
|
|
31
31
|
ListedObject,
|
|
32
|
+
MetadataUpdateBody,
|
|
32
33
|
OrgListedObject,
|
|
33
34
|
PostObjectResponse,
|
|
34
35
|
UpdateGeoscienceObject,
|
|
@@ -53,10 +54,12 @@ def _version_from_listed_version(model: GeoscienceObjectVersion) -> ObjectVersio
|
|
|
53
54
|
:return: An ObjectVersion instance.
|
|
54
55
|
"""
|
|
55
56
|
created_by = None if model.created_by is None else ServiceUser.from_model(model.created_by) # type: ignore
|
|
57
|
+
stage = None if model.stage is None else Stage.from_model(model.stage)
|
|
56
58
|
return ObjectVersion(
|
|
57
59
|
version_id=model.version_id,
|
|
58
60
|
created_at=model.created_at,
|
|
59
61
|
created_by=created_by,
|
|
62
|
+
stage=stage,
|
|
60
63
|
)
|
|
61
64
|
|
|
62
65
|
|
|
@@ -109,7 +112,9 @@ class DownloadedObject:
|
|
|
109
112
|
class ObjectAPIClient(BaseAPIClient):
|
|
110
113
|
def __init__(self, environment: Environment, connector: APIConnector) -> None:
|
|
111
114
|
super().__init__(environment, connector)
|
|
115
|
+
self._stages_api = StagesApi(connector=connector)
|
|
112
116
|
self._objects_api = ObjectsApi(connector=connector)
|
|
117
|
+
self._metadata_api = MetadataApi(connector=connector)
|
|
113
118
|
|
|
114
119
|
async def get_service_health(self, check_type: HealthCheckType = HealthCheckType.FULL) -> ServiceHealth:
|
|
115
120
|
"""Get the health of the geoscience object service.
|
|
@@ -132,6 +137,7 @@ class ObjectAPIClient(BaseAPIClient):
|
|
|
132
137
|
"""
|
|
133
138
|
created_by = None if model.created_by is None else ServiceUser.from_model(model.created_by)
|
|
134
139
|
modified_by = None if model.modified_by is None else ServiceUser.from_model(model.modified_by)
|
|
140
|
+
stage = None if model.stage is None else Stage.from_model(model.stage)
|
|
135
141
|
return ObjectMetadata(
|
|
136
142
|
environment=self._environment,
|
|
137
143
|
id=model.object_id,
|
|
@@ -143,6 +149,7 @@ class ObjectAPIClient(BaseAPIClient):
|
|
|
143
149
|
parent=model.path.rstrip("/"),
|
|
144
150
|
schema_id=ObjectSchema.from_id(model.schema_),
|
|
145
151
|
version_id=model.version_id,
|
|
152
|
+
stage=stage,
|
|
146
153
|
)
|
|
147
154
|
|
|
148
155
|
def _metadata_from_org_listed_object(self, model: OrgListedObject) -> OrgObjectMetadata:
|
|
@@ -154,6 +161,7 @@ class ObjectAPIClient(BaseAPIClient):
|
|
|
154
161
|
"""
|
|
155
162
|
created_by = None if model.created_by is None else ServiceUser.from_model(model.created_by)
|
|
156
163
|
modified_by = None if model.modified_by is None else ServiceUser.from_model(model.modified_by)
|
|
164
|
+
stage = None if model.stage is None else Stage.from_model(model.stage)
|
|
157
165
|
return OrgObjectMetadata(
|
|
158
166
|
environment=self._environment,
|
|
159
167
|
workspace_id=model.workspace_id,
|
|
@@ -165,6 +173,7 @@ class ObjectAPIClient(BaseAPIClient):
|
|
|
165
173
|
modified_at=model.modified_at,
|
|
166
174
|
modified_by=modified_by,
|
|
167
175
|
schema_id=ObjectSchema.from_id(model.schema_),
|
|
176
|
+
stage=stage,
|
|
168
177
|
)
|
|
169
178
|
|
|
170
179
|
def _metadata_from_endpoint_model(self, model: GetObjectResponse | PostObjectResponse) -> ObjectMetadata:
|
|
@@ -177,6 +186,7 @@ class ObjectAPIClient(BaseAPIClient):
|
|
|
177
186
|
object_path = PurePosixPath(model.object_path)
|
|
178
187
|
created_by = None if model.created_by is None else ServiceUser.from_model(model.created_by)
|
|
179
188
|
modified_by = None if model.modified_by is None else ServiceUser.from_model(model.modified_by)
|
|
189
|
+
stage = None if model.stage is None else Stage.from_model(model.stage)
|
|
180
190
|
return ObjectMetadata(
|
|
181
191
|
environment=self._environment,
|
|
182
192
|
id=model.object_id,
|
|
@@ -188,6 +198,7 @@ class ObjectAPIClient(BaseAPIClient):
|
|
|
188
198
|
parent=str(object_path.parent),
|
|
189
199
|
schema_id=ObjectSchema.from_id(model.object.schema_),
|
|
190
200
|
version_id=model.version_id,
|
|
201
|
+
stage=stage,
|
|
191
202
|
)
|
|
192
203
|
|
|
193
204
|
async def list_objects(
|
|
@@ -658,3 +669,28 @@ class ObjectAPIClient(BaseAPIClient):
|
|
|
658
669
|
if isinstance(result, EmptyResponse):
|
|
659
670
|
return None
|
|
660
671
|
return self._metadata_from_endpoint_model(result)
|
|
672
|
+
|
|
673
|
+
async def list_stages(self) -> list[Stage]:
|
|
674
|
+
"""List all available stages in the organisation.
|
|
675
|
+
|
|
676
|
+
:return: A list of all available stages."""
|
|
677
|
+
response = await self._stages_api.list_stages(org_id=str(self._environment.org_id))
|
|
678
|
+
return [Stage.from_model(model) for model in response.stages]
|
|
679
|
+
|
|
680
|
+
async def set_stage(self, object_id: UUID, version_id: int, stage_id: UUID) -> None:
|
|
681
|
+
"""Set the stage of a specific version of a geoscience object.
|
|
682
|
+
|
|
683
|
+
:param object_id: The UUID of the geoscience object.
|
|
684
|
+
:param version_id: The version ID of the geoscience object.
|
|
685
|
+
:param stage_id: The UUID of the stage to set.
|
|
686
|
+
|
|
687
|
+
:return: None
|
|
688
|
+
"""
|
|
689
|
+
|
|
690
|
+
await self._metadata_api.update_metadata(
|
|
691
|
+
object_id=str(object_id),
|
|
692
|
+
org_id=str(self._environment.org_id),
|
|
693
|
+
workspace_id=str(self._environment.workspace_id),
|
|
694
|
+
metadata_update_body=MetadataUpdateBody(stage_id=stage_id),
|
|
695
|
+
version_id=version_id,
|
|
696
|
+
)
|
|
@@ -15,6 +15,7 @@ import enum
|
|
|
15
15
|
import re
|
|
16
16
|
from dataclasses import dataclass
|
|
17
17
|
from datetime import datetime
|
|
18
|
+
from typing import Protocol
|
|
18
19
|
from uuid import UUID
|
|
19
20
|
|
|
20
21
|
from evo.common import ResourceMetadata
|
|
@@ -28,6 +29,7 @@ __all__ = [
|
|
|
28
29
|
"ObjectSchema",
|
|
29
30
|
"ObjectVersion",
|
|
30
31
|
"SchemaVersion",
|
|
32
|
+
"Stage",
|
|
31
33
|
]
|
|
32
34
|
|
|
33
35
|
|
|
@@ -60,6 +62,9 @@ class ObjectMetadata(ResourceMetadata):
|
|
|
60
62
|
modified_by: ServiceUser | None
|
|
61
63
|
"""The user who last modified the object."""
|
|
62
64
|
|
|
65
|
+
stage: Stage | None
|
|
66
|
+
"""The stage of the object, if available."""
|
|
67
|
+
|
|
63
68
|
@property
|
|
64
69
|
def path(self) -> str:
|
|
65
70
|
"""The full path of the object, formed by joining the parent and name, separated by a slash ('/')."""
|
|
@@ -96,6 +101,9 @@ class OrgObjectMetadata(ResourceMetadata):
|
|
|
96
101
|
modified_by: ServiceUser | None
|
|
97
102
|
"""The user who last modified the object."""
|
|
98
103
|
|
|
104
|
+
stage: Stage | None
|
|
105
|
+
"""The stage of the object, if available."""
|
|
106
|
+
|
|
99
107
|
@property
|
|
100
108
|
def url(self) -> str:
|
|
101
109
|
"""The url of the object."""
|
|
@@ -120,6 +128,30 @@ class ObjectVersion:
|
|
|
120
128
|
created_by: ServiceUser | None
|
|
121
129
|
"""The user that uploaded the version."""
|
|
122
130
|
|
|
131
|
+
stage: Stage | None
|
|
132
|
+
"""The stage associated with this version, if applicable."""
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
class _StageModel(Protocol):
|
|
136
|
+
stage_id: UUID
|
|
137
|
+
name: str
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
@dataclass(frozen=True, kw_only=True)
|
|
141
|
+
class Stage:
|
|
142
|
+
"""Metadata about a stage"""
|
|
143
|
+
|
|
144
|
+
id: UUID
|
|
145
|
+
"""The stage UUID."""
|
|
146
|
+
|
|
147
|
+
name: str
|
|
148
|
+
"""The stage name."""
|
|
149
|
+
|
|
150
|
+
@classmethod
|
|
151
|
+
def from_model(cls, model: _StageModel) -> Stage:
|
|
152
|
+
"""Create a new instance from an instance of a generated model."""
|
|
153
|
+
return cls(id=model.stage_id, name=model.name)
|
|
154
|
+
|
|
123
155
|
|
|
124
156
|
@dataclass(frozen=True, order=True)
|
|
125
157
|
class SchemaVersion:
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|