label-studio-sdk 1.0.8__py3-none-any.whl → 1.0.10__py3-none-any.whl
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 label-studio-sdk might be problematic. Click here for more details.
- label_studio_sdk/__init__.py +20 -7
- label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py +16 -4
- label_studio_sdk/_extensions/pager_ext.py +8 -0
- label_studio_sdk/actions/client.py +91 -40
- label_studio_sdk/actions/types/actions_create_request_filters.py +14 -24
- label_studio_sdk/actions/types/actions_create_request_filters_items_item.py +16 -26
- label_studio_sdk/actions/types/actions_create_request_filters_items_item_value.py +3 -1
- label_studio_sdk/actions/types/actions_create_request_selected_items.py +1 -2
- label_studio_sdk/actions/types/actions_create_request_selected_items_excluded.py +15 -25
- label_studio_sdk/actions/types/actions_create_request_selected_items_included.py +15 -25
- label_studio_sdk/annotations/__init__.py +2 -2
- label_studio_sdk/annotations/client.py +278 -104
- label_studio_sdk/annotations/types/__init__.py +2 -1
- label_studio_sdk/annotations/types/annotations_create_bulk_request_selected_items.py +34 -0
- label_studio_sdk/annotations/types/annotations_create_bulk_response_item.py +11 -21
- label_studio_sdk/base_client.py +46 -27
- label_studio_sdk/client.py +1 -0
- label_studio_sdk/comments/client.py +190 -44
- label_studio_sdk/converter/converter.py +56 -13
- label_studio_sdk/converter/imports/yolo.py +1 -1
- label_studio_sdk/converter/utils.py +3 -2
- label_studio_sdk/core/__init__.py +21 -4
- label_studio_sdk/core/client_wrapper.py +9 -10
- label_studio_sdk/core/file.py +37 -8
- label_studio_sdk/core/http_client.py +52 -28
- label_studio_sdk/core/jsonable_encoder.py +33 -31
- label_studio_sdk/core/pagination.py +5 -4
- label_studio_sdk/core/pydantic_utilities.py +272 -4
- label_studio_sdk/core/query_encoder.py +38 -13
- label_studio_sdk/core/request_options.py +3 -0
- label_studio_sdk/core/serialization.py +272 -0
- label_studio_sdk/errors/bad_request_error.py +2 -3
- label_studio_sdk/export_storage/azure/client.py +228 -58
- label_studio_sdk/export_storage/azure/types/azure_create_response.py +19 -29
- label_studio_sdk/export_storage/azure/types/azure_update_response.py +19 -29
- label_studio_sdk/export_storage/client.py +48 -18
- label_studio_sdk/export_storage/gcs/client.py +228 -58
- label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +19 -29
- label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +19 -29
- label_studio_sdk/export_storage/local/client.py +222 -56
- label_studio_sdk/export_storage/local/types/local_create_response.py +17 -27
- label_studio_sdk/export_storage/local/types/local_update_response.py +17 -27
- label_studio_sdk/export_storage/redis/client.py +228 -58
- label_studio_sdk/export_storage/redis/types/redis_create_response.py +20 -30
- label_studio_sdk/export_storage/redis/types/redis_update_response.py +20 -30
- label_studio_sdk/export_storage/s3/client.py +228 -58
- label_studio_sdk/export_storage/s3/types/s3create_response.py +27 -35
- label_studio_sdk/export_storage/s3/types/s3update_response.py +27 -35
- label_studio_sdk/export_storage/s3s/client.py +187 -43
- label_studio_sdk/export_storage/types/export_storage_list_types_response_item.py +11 -21
- label_studio_sdk/files/client.py +172 -56
- label_studio_sdk/import_storage/azure/client.py +223 -53
- label_studio_sdk/import_storage/azure/types/azure_create_response.py +22 -32
- label_studio_sdk/import_storage/azure/types/azure_update_response.py +22 -32
- label_studio_sdk/import_storage/client.py +48 -18
- label_studio_sdk/import_storage/gcs/client.py +223 -53
- label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +22 -32
- label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +22 -32
- label_studio_sdk/import_storage/local/client.py +223 -53
- label_studio_sdk/import_storage/local/types/local_create_response.py +17 -27
- label_studio_sdk/import_storage/local/types/local_update_response.py +17 -27
- label_studio_sdk/import_storage/redis/client.py +223 -53
- label_studio_sdk/import_storage/redis/types/redis_create_response.py +20 -30
- label_studio_sdk/import_storage/redis/types/redis_update_response.py +20 -30
- label_studio_sdk/import_storage/s3/client.py +223 -53
- label_studio_sdk/import_storage/s3/types/s3create_response.py +31 -39
- label_studio_sdk/import_storage/s3/types/s3update_response.py +31 -39
- label_studio_sdk/import_storage/s3s/client.py +222 -52
- label_studio_sdk/import_storage/types/import_storage_list_types_response_item.py +11 -21
- label_studio_sdk/label_interface/control_tags.py +1 -1
- label_studio_sdk/ml/client.py +280 -78
- label_studio_sdk/ml/types/ml_create_response.py +21 -31
- label_studio_sdk/ml/types/ml_update_response.py +21 -31
- label_studio_sdk/model_providers/client.py +173 -56
- label_studio_sdk/predictions/client.py +247 -101
- label_studio_sdk/projects/__init__.py +3 -0
- label_studio_sdk/projects/client.py +309 -115
- label_studio_sdk/projects/client_ext.py +16 -0
- label_studio_sdk/projects/exports/__init__.py +3 -0
- label_studio_sdk/projects/exports/client.py +447 -296
- label_studio_sdk/projects/exports/client_ext.py +134 -0
- label_studio_sdk/projects/exports/types/__init__.py +6 -0
- label_studio_sdk/projects/exports/types/exports_convert_response.py +24 -0
- label_studio_sdk/projects/exports/types/exports_list_formats_response_item.py +44 -0
- label_studio_sdk/projects/types/projects_create_response.py +29 -34
- label_studio_sdk/projects/types/projects_import_tasks_response.py +19 -29
- label_studio_sdk/projects/types/projects_list_response.py +11 -21
- label_studio_sdk/projects/types/projects_update_response.py +24 -34
- label_studio_sdk/prompts/client.py +309 -92
- label_studio_sdk/prompts/indicators/client.py +67 -23
- label_studio_sdk/prompts/runs/client.py +95 -40
- label_studio_sdk/prompts/types/prompts_batch_failed_predictions_request_failed_predictions_item.py +14 -24
- label_studio_sdk/prompts/types/prompts_batch_failed_predictions_response.py +11 -21
- label_studio_sdk/prompts/types/prompts_batch_predictions_request_results_item.py +26 -29
- label_studio_sdk/prompts/types/prompts_batch_predictions_response.py +11 -21
- label_studio_sdk/prompts/versions/client.py +277 -88
- label_studio_sdk/tasks/client.py +263 -90
- label_studio_sdk/tasks/types/tasks_list_response.py +15 -25
- label_studio_sdk/types/__init__.py +10 -6
- label_studio_sdk/types/annotation.py +29 -38
- label_studio_sdk/types/annotation_filter_options.py +14 -24
- label_studio_sdk/types/annotations_dm_field.py +30 -39
- label_studio_sdk/types/azure_blob_export_storage.py +28 -37
- label_studio_sdk/types/azure_blob_import_storage.py +28 -37
- label_studio_sdk/types/base_task.py +30 -39
- label_studio_sdk/types/base_task_updated_by.py +3 -1
- label_studio_sdk/types/base_user.py +14 -21
- label_studio_sdk/types/comment.py +12 -21
- label_studio_sdk/types/comment_created_by.py +1 -1
- label_studio_sdk/types/converted_format.py +12 -22
- label_studio_sdk/types/data_manager_task_serializer.py +31 -40
- label_studio_sdk/types/data_manager_task_serializer_annotators_item.py +1 -1
- label_studio_sdk/types/data_manager_task_serializer_drafts_item.py +13 -22
- label_studio_sdk/types/data_manager_task_serializer_predictions_item.py +15 -24
- label_studio_sdk/types/export.py +17 -26
- label_studio_sdk/types/export_format.py +25 -0
- label_studio_sdk/types/export_snapshot.py +45 -0
- label_studio_sdk/types/export_snapshot_status.py +5 -0
- label_studio_sdk/types/file_upload.py +11 -21
- label_studio_sdk/types/filter.py +16 -26
- label_studio_sdk/types/filter_group.py +12 -22
- label_studio_sdk/types/gcs_export_storage.py +28 -37
- label_studio_sdk/types/gcs_import_storage.py +28 -37
- label_studio_sdk/types/inference_run.py +14 -23
- label_studio_sdk/types/inference_run_cost_estimate.py +17 -27
- label_studio_sdk/types/inference_run_created_by.py +1 -1
- label_studio_sdk/types/inference_run_organization.py +1 -1
- label_studio_sdk/types/key_indicator_value.py +12 -22
- label_studio_sdk/types/key_indicators.py +0 -1
- label_studio_sdk/types/key_indicators_item.py +15 -25
- label_studio_sdk/types/key_indicators_item_additional_kpis_item.py +13 -23
- label_studio_sdk/types/key_indicators_item_extra_kpis_item.py +13 -23
- label_studio_sdk/types/local_files_export_storage.py +25 -34
- label_studio_sdk/types/local_files_import_storage.py +24 -33
- label_studio_sdk/types/ml_backend.py +23 -32
- label_studio_sdk/types/model_provider_connection.py +22 -31
- label_studio_sdk/types/model_provider_connection_created_by.py +1 -1
- label_studio_sdk/types/model_provider_connection_organization.py +1 -1
- label_studio_sdk/types/model_provider_connection_provider.py +3 -1
- label_studio_sdk/types/prediction.py +21 -30
- label_studio_sdk/types/project.py +48 -55
- label_studio_sdk/types/project_import.py +21 -30
- label_studio_sdk/types/project_label_config.py +12 -22
- label_studio_sdk/types/prompt.py +24 -32
- label_studio_sdk/types/prompt_associated_projects_item.py +6 -0
- label_studio_sdk/types/prompt_associated_projects_item_id.py +20 -0
- label_studio_sdk/types/prompt_created_by.py +1 -1
- label_studio_sdk/types/prompt_organization.py +1 -1
- label_studio_sdk/types/prompt_version.py +13 -22
- label_studio_sdk/types/prompt_version_created_by.py +1 -1
- label_studio_sdk/types/prompt_version_organization.py +1 -1
- label_studio_sdk/types/prompt_version_provider.py +3 -1
- label_studio_sdk/types/redis_export_storage.py +29 -38
- label_studio_sdk/types/redis_import_storage.py +28 -37
- label_studio_sdk/types/refined_prompt_response.py +19 -29
- label_studio_sdk/types/s3export_storage.py +36 -43
- label_studio_sdk/types/s3import_storage.py +37 -44
- label_studio_sdk/types/s3s_export_storage.py +26 -33
- label_studio_sdk/types/s3s_import_storage.py +35 -42
- label_studio_sdk/types/serialization_option.py +12 -22
- label_studio_sdk/types/serialization_options.py +18 -28
- label_studio_sdk/types/task.py +44 -47
- label_studio_sdk/types/task_annotators_item.py +1 -1
- label_studio_sdk/types/task_comment_authors_item.py +1 -1
- label_studio_sdk/types/task_filter_options.py +15 -25
- label_studio_sdk/types/user_simple.py +11 -21
- label_studio_sdk/types/view.py +16 -26
- label_studio_sdk/types/webhook.py +19 -28
- label_studio_sdk/types/webhook_serializer_for_update.py +19 -28
- label_studio_sdk/types/workspace.py +22 -31
- label_studio_sdk/users/client.py +257 -63
- label_studio_sdk/users/types/users_get_token_response.py +12 -22
- label_studio_sdk/users/types/users_reset_token_response.py +12 -22
- label_studio_sdk/version.py +0 -1
- label_studio_sdk/versions/__init__.py +5 -0
- label_studio_sdk/versions/client.py +112 -0
- label_studio_sdk/versions/types/__init__.py +6 -0
- label_studio_sdk/versions/types/versions_get_response.py +73 -0
- label_studio_sdk/versions/types/versions_get_response_edition.py +5 -0
- label_studio_sdk/views/client.py +219 -52
- label_studio_sdk/views/types/views_create_request_data.py +13 -23
- label_studio_sdk/views/types/views_create_request_data_filters.py +14 -24
- label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +16 -26
- label_studio_sdk/views/types/views_create_request_data_filters_items_item_value.py +3 -1
- label_studio_sdk/views/types/views_update_request_data.py +13 -23
- label_studio_sdk/views/types/views_update_request_data_filters.py +14 -24
- label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +16 -26
- label_studio_sdk/views/types/views_update_request_data_filters_items_item_value.py +3 -1
- label_studio_sdk/webhooks/client.py +191 -61
- label_studio_sdk/workspaces/client.py +164 -41
- label_studio_sdk/workspaces/members/client.py +109 -31
- label_studio_sdk/workspaces/members/types/members_create_response.py +12 -22
- label_studio_sdk/workspaces/members/types/members_list_response_item.py +12 -22
- {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.10.dist-info}/METADATA +7 -5
- {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.10.dist-info}/RECORD +197 -184
- {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.10.dist-info}/WHEEL +1 -1
- label_studio_sdk/types/export_convert.py +0 -32
- label_studio_sdk/types/export_create.py +0 -54
- label_studio_sdk/types/export_create_status.py +0 -5
- {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.10.dist-info}/LICENSE +0 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
3
|
import typing
|
|
4
|
-
from
|
|
5
|
-
|
|
6
|
-
from ...core.api_error import ApiError
|
|
7
|
-
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
|
-
from ...core.jsonable_encoder import jsonable_encoder
|
|
9
|
-
from ...core.pydantic_utilities import pydantic_v1
|
|
4
|
+
from ...core.client_wrapper import SyncClientWrapper
|
|
10
5
|
from ...core.request_options import RequestOptions
|
|
11
6
|
from ...types.gcs_export_storage import GcsExportStorage
|
|
7
|
+
from ...core.pydantic_utilities import parse_obj_as
|
|
8
|
+
from json.decoder import JSONDecodeError
|
|
9
|
+
from ...core.api_error import ApiError
|
|
12
10
|
from .types.gcs_create_response import GcsCreateResponse
|
|
11
|
+
from ...core.jsonable_encoder import jsonable_encoder
|
|
13
12
|
from .types.gcs_update_response import GcsUpdateResponse
|
|
13
|
+
from ...core.client_wrapper import AsyncClientWrapper
|
|
14
14
|
|
|
15
15
|
# this is used as the default value for optional parameters
|
|
16
16
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -24,6 +24,7 @@ class GcsClient:
|
|
|
24
24
|
self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
25
25
|
) -> typing.List[GcsExportStorage]:
|
|
26
26
|
"""
|
|
27
|
+
|
|
27
28
|
You can connect your Google Cloud Storage bucket to Label Studio as a source storage or target storage. Use this API request to get a list of all GCS export (target) storage connections for a specific project.
|
|
28
29
|
|
|
29
30
|
The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](../projects/list).
|
|
@@ -45,7 +46,7 @@ class GcsClient:
|
|
|
45
46
|
|
|
46
47
|
Examples
|
|
47
48
|
--------
|
|
48
|
-
from label_studio_sdk
|
|
49
|
+
from label_studio_sdk import LabelStudio
|
|
49
50
|
|
|
50
51
|
client = LabelStudio(
|
|
51
52
|
api_key="YOUR_API_KEY",
|
|
@@ -53,11 +54,22 @@ class GcsClient:
|
|
|
53
54
|
client.export_storage.gcs.list()
|
|
54
55
|
"""
|
|
55
56
|
_response = self._client_wrapper.httpx_client.request(
|
|
56
|
-
"api/storages/export/gcs",
|
|
57
|
+
"api/storages/export/gcs",
|
|
58
|
+
method="GET",
|
|
59
|
+
params={
|
|
60
|
+
"project": project,
|
|
61
|
+
},
|
|
62
|
+
request_options=request_options,
|
|
57
63
|
)
|
|
58
64
|
try:
|
|
59
65
|
if 200 <= _response.status_code < 300:
|
|
60
|
-
return
|
|
66
|
+
return typing.cast(
|
|
67
|
+
typing.List[GcsExportStorage],
|
|
68
|
+
parse_obj_as(
|
|
69
|
+
type_=typing.List[GcsExportStorage], # type: ignore
|
|
70
|
+
object_=_response.json(),
|
|
71
|
+
),
|
|
72
|
+
)
|
|
61
73
|
_response_json = _response.json()
|
|
62
74
|
except JSONDecodeError:
|
|
63
75
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -77,6 +89,7 @@ class GcsClient:
|
|
|
77
89
|
request_options: typing.Optional[RequestOptions] = None,
|
|
78
90
|
) -> GcsCreateResponse:
|
|
79
91
|
"""
|
|
92
|
+
|
|
80
93
|
Create a new target storage connection to Google Cloud Storage.
|
|
81
94
|
|
|
82
95
|
For information about the required fields and prerequisites, see [Google Cloud Storage](https://labelstud.io/guide/storage#Google-Cloud-Storage) in the Label Studio documentation.
|
|
@@ -119,7 +132,7 @@ class GcsClient:
|
|
|
119
132
|
|
|
120
133
|
Examples
|
|
121
134
|
--------
|
|
122
|
-
from label_studio_sdk
|
|
135
|
+
from label_studio_sdk import LabelStudio
|
|
123
136
|
|
|
124
137
|
client = LabelStudio(
|
|
125
138
|
api_key="YOUR_API_KEY",
|
|
@@ -139,12 +152,21 @@ class GcsClient:
|
|
|
139
152
|
"google_application_credentials": google_application_credentials,
|
|
140
153
|
"google_project_id": google_project_id,
|
|
141
154
|
},
|
|
155
|
+
headers={
|
|
156
|
+
"content-type": "application/json",
|
|
157
|
+
},
|
|
142
158
|
request_options=request_options,
|
|
143
159
|
omit=OMIT,
|
|
144
160
|
)
|
|
145
161
|
try:
|
|
146
162
|
if 200 <= _response.status_code < 300:
|
|
147
|
-
return
|
|
163
|
+
return typing.cast(
|
|
164
|
+
GcsCreateResponse,
|
|
165
|
+
parse_obj_as(
|
|
166
|
+
type_=GcsCreateResponse, # type: ignore
|
|
167
|
+
object_=_response.json(),
|
|
168
|
+
),
|
|
169
|
+
)
|
|
148
170
|
_response_json = _response.json()
|
|
149
171
|
except JSONDecodeError:
|
|
150
172
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -165,6 +187,7 @@ class GcsClient:
|
|
|
165
187
|
request_options: typing.Optional[RequestOptions] = None,
|
|
166
188
|
) -> None:
|
|
167
189
|
"""
|
|
190
|
+
|
|
168
191
|
Validate a specific GCS export storage connection. This is useful to ensure that the storage configuration settings are correct and operational before attempting to export data.
|
|
169
192
|
|
|
170
193
|
Parameters
|
|
@@ -205,7 +228,7 @@ class GcsClient:
|
|
|
205
228
|
|
|
206
229
|
Examples
|
|
207
230
|
--------
|
|
208
|
-
from label_studio_sdk
|
|
231
|
+
from label_studio_sdk import LabelStudio
|
|
209
232
|
|
|
210
233
|
client = LabelStudio(
|
|
211
234
|
api_key="YOUR_API_KEY",
|
|
@@ -226,6 +249,9 @@ class GcsClient:
|
|
|
226
249
|
"google_application_credentials": google_application_credentials,
|
|
227
250
|
"google_project_id": google_project_id,
|
|
228
251
|
},
|
|
252
|
+
headers={
|
|
253
|
+
"content-type": "application/json",
|
|
254
|
+
},
|
|
229
255
|
request_options=request_options,
|
|
230
256
|
omit=OMIT,
|
|
231
257
|
)
|
|
@@ -239,6 +265,7 @@ class GcsClient:
|
|
|
239
265
|
|
|
240
266
|
def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> GcsExportStorage:
|
|
241
267
|
"""
|
|
268
|
+
|
|
242
269
|
Get a specific GCS export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
|
|
243
270
|
|
|
244
271
|
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
@@ -258,7 +285,7 @@ class GcsClient:
|
|
|
258
285
|
|
|
259
286
|
Examples
|
|
260
287
|
--------
|
|
261
|
-
from label_studio_sdk
|
|
288
|
+
from label_studio_sdk import LabelStudio
|
|
262
289
|
|
|
263
290
|
client = LabelStudio(
|
|
264
291
|
api_key="YOUR_API_KEY",
|
|
@@ -268,11 +295,19 @@ class GcsClient:
|
|
|
268
295
|
)
|
|
269
296
|
"""
|
|
270
297
|
_response = self._client_wrapper.httpx_client.request(
|
|
271
|
-
f"api/storages/export/gcs/{jsonable_encoder(id)}",
|
|
298
|
+
f"api/storages/export/gcs/{jsonable_encoder(id)}",
|
|
299
|
+
method="GET",
|
|
300
|
+
request_options=request_options,
|
|
272
301
|
)
|
|
273
302
|
try:
|
|
274
303
|
if 200 <= _response.status_code < 300:
|
|
275
|
-
return
|
|
304
|
+
return typing.cast(
|
|
305
|
+
GcsExportStorage,
|
|
306
|
+
parse_obj_as(
|
|
307
|
+
type_=GcsExportStorage, # type: ignore
|
|
308
|
+
object_=_response.json(),
|
|
309
|
+
),
|
|
310
|
+
)
|
|
276
311
|
_response_json = _response.json()
|
|
277
312
|
except JSONDecodeError:
|
|
278
313
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -280,6 +315,7 @@ class GcsClient:
|
|
|
280
315
|
|
|
281
316
|
def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
282
317
|
"""
|
|
318
|
+
|
|
283
319
|
Delete a specific GCS export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
|
|
284
320
|
|
|
285
321
|
Deleting an export/target storage connection does not affect tasks with synced data in Label Studio. If you want to remove the tasks that were synced from the external storage, you will need to delete them manually from within the Label Studio UI or use the [Delete tasks](../../tasks/delete-all-tasks) API.
|
|
@@ -298,7 +334,7 @@ class GcsClient:
|
|
|
298
334
|
|
|
299
335
|
Examples
|
|
300
336
|
--------
|
|
301
|
-
from label_studio_sdk
|
|
337
|
+
from label_studio_sdk import LabelStudio
|
|
302
338
|
|
|
303
339
|
client = LabelStudio(
|
|
304
340
|
api_key="YOUR_API_KEY",
|
|
@@ -308,7 +344,9 @@ class GcsClient:
|
|
|
308
344
|
)
|
|
309
345
|
"""
|
|
310
346
|
_response = self._client_wrapper.httpx_client.request(
|
|
311
|
-
f"api/storages/export/gcs/{jsonable_encoder(id)}",
|
|
347
|
+
f"api/storages/export/gcs/{jsonable_encoder(id)}",
|
|
348
|
+
method="DELETE",
|
|
349
|
+
request_options=request_options,
|
|
312
350
|
)
|
|
313
351
|
try:
|
|
314
352
|
if 200 <= _response.status_code < 300:
|
|
@@ -333,6 +371,7 @@ class GcsClient:
|
|
|
333
371
|
request_options: typing.Optional[RequestOptions] = None,
|
|
334
372
|
) -> GcsUpdateResponse:
|
|
335
373
|
"""
|
|
374
|
+
|
|
336
375
|
Update a specific GCS export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
|
|
337
376
|
|
|
338
377
|
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
@@ -376,7 +415,7 @@ class GcsClient:
|
|
|
376
415
|
|
|
377
416
|
Examples
|
|
378
417
|
--------
|
|
379
|
-
from label_studio_sdk
|
|
418
|
+
from label_studio_sdk import LabelStudio
|
|
380
419
|
|
|
381
420
|
client = LabelStudio(
|
|
382
421
|
api_key="YOUR_API_KEY",
|
|
@@ -398,19 +437,29 @@ class GcsClient:
|
|
|
398
437
|
"google_application_credentials": google_application_credentials,
|
|
399
438
|
"google_project_id": google_project_id,
|
|
400
439
|
},
|
|
440
|
+
headers={
|
|
441
|
+
"content-type": "application/json",
|
|
442
|
+
},
|
|
401
443
|
request_options=request_options,
|
|
402
444
|
omit=OMIT,
|
|
403
445
|
)
|
|
404
446
|
try:
|
|
405
447
|
if 200 <= _response.status_code < 300:
|
|
406
|
-
return
|
|
448
|
+
return typing.cast(
|
|
449
|
+
GcsUpdateResponse,
|
|
450
|
+
parse_obj_as(
|
|
451
|
+
type_=GcsUpdateResponse, # type: ignore
|
|
452
|
+
object_=_response.json(),
|
|
453
|
+
),
|
|
454
|
+
)
|
|
407
455
|
_response_json = _response.json()
|
|
408
456
|
except JSONDecodeError:
|
|
409
457
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
410
458
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
411
459
|
|
|
412
|
-
def sync(self, id:
|
|
460
|
+
def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> GcsExportStorage:
|
|
413
461
|
"""
|
|
462
|
+
|
|
414
463
|
Sync tasks to a GCS export/target storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
|
|
415
464
|
|
|
416
465
|
Sync operations with external buckets only go one way. They either create tasks from objects in the bucket (source/import storage) or push annotations to the output bucket (export/target storage). Changing something on the bucket side doesn’t guarantee consistency in results.
|
|
@@ -419,7 +468,7 @@ class GcsClient:
|
|
|
419
468
|
|
|
420
469
|
Parameters
|
|
421
470
|
----------
|
|
422
|
-
id :
|
|
471
|
+
id : int
|
|
423
472
|
|
|
424
473
|
request_options : typing.Optional[RequestOptions]
|
|
425
474
|
Request-specific configuration.
|
|
@@ -431,21 +480,29 @@ class GcsClient:
|
|
|
431
480
|
|
|
432
481
|
Examples
|
|
433
482
|
--------
|
|
434
|
-
from label_studio_sdk
|
|
483
|
+
from label_studio_sdk import LabelStudio
|
|
435
484
|
|
|
436
485
|
client = LabelStudio(
|
|
437
486
|
api_key="YOUR_API_KEY",
|
|
438
487
|
)
|
|
439
488
|
client.export_storage.gcs.sync(
|
|
440
|
-
id=
|
|
489
|
+
id=1,
|
|
441
490
|
)
|
|
442
491
|
"""
|
|
443
492
|
_response = self._client_wrapper.httpx_client.request(
|
|
444
|
-
f"api/storages/export/gcs/{jsonable_encoder(id)}/sync",
|
|
493
|
+
f"api/storages/export/gcs/{jsonable_encoder(id)}/sync",
|
|
494
|
+
method="POST",
|
|
495
|
+
request_options=request_options,
|
|
445
496
|
)
|
|
446
497
|
try:
|
|
447
498
|
if 200 <= _response.status_code < 300:
|
|
448
|
-
return
|
|
499
|
+
return typing.cast(
|
|
500
|
+
GcsExportStorage,
|
|
501
|
+
parse_obj_as(
|
|
502
|
+
type_=GcsExportStorage, # type: ignore
|
|
503
|
+
object_=_response.json(),
|
|
504
|
+
),
|
|
505
|
+
)
|
|
449
506
|
_response_json = _response.json()
|
|
450
507
|
except JSONDecodeError:
|
|
451
508
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -460,6 +517,7 @@ class AsyncGcsClient:
|
|
|
460
517
|
self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
461
518
|
) -> typing.List[GcsExportStorage]:
|
|
462
519
|
"""
|
|
520
|
+
|
|
463
521
|
You can connect your Google Cloud Storage bucket to Label Studio as a source storage or target storage. Use this API request to get a list of all GCS export (target) storage connections for a specific project.
|
|
464
522
|
|
|
465
523
|
The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](../projects/list).
|
|
@@ -481,19 +539,38 @@ class AsyncGcsClient:
|
|
|
481
539
|
|
|
482
540
|
Examples
|
|
483
541
|
--------
|
|
484
|
-
|
|
542
|
+
import asyncio
|
|
543
|
+
|
|
544
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
485
545
|
|
|
486
546
|
client = AsyncLabelStudio(
|
|
487
547
|
api_key="YOUR_API_KEY",
|
|
488
548
|
)
|
|
489
|
-
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
async def main() -> None:
|
|
552
|
+
await client.export_storage.gcs.list()
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
asyncio.run(main())
|
|
490
556
|
"""
|
|
491
557
|
_response = await self._client_wrapper.httpx_client.request(
|
|
492
|
-
"api/storages/export/gcs",
|
|
558
|
+
"api/storages/export/gcs",
|
|
559
|
+
method="GET",
|
|
560
|
+
params={
|
|
561
|
+
"project": project,
|
|
562
|
+
},
|
|
563
|
+
request_options=request_options,
|
|
493
564
|
)
|
|
494
565
|
try:
|
|
495
566
|
if 200 <= _response.status_code < 300:
|
|
496
|
-
return
|
|
567
|
+
return typing.cast(
|
|
568
|
+
typing.List[GcsExportStorage],
|
|
569
|
+
parse_obj_as(
|
|
570
|
+
type_=typing.List[GcsExportStorage], # type: ignore
|
|
571
|
+
object_=_response.json(),
|
|
572
|
+
),
|
|
573
|
+
)
|
|
497
574
|
_response_json = _response.json()
|
|
498
575
|
except JSONDecodeError:
|
|
499
576
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -513,6 +590,7 @@ class AsyncGcsClient:
|
|
|
513
590
|
request_options: typing.Optional[RequestOptions] = None,
|
|
514
591
|
) -> GcsCreateResponse:
|
|
515
592
|
"""
|
|
593
|
+
|
|
516
594
|
Create a new target storage connection to Google Cloud Storage.
|
|
517
595
|
|
|
518
596
|
For information about the required fields and prerequisites, see [Google Cloud Storage](https://labelstud.io/guide/storage#Google-Cloud-Storage) in the Label Studio documentation.
|
|
@@ -555,12 +633,20 @@ class AsyncGcsClient:
|
|
|
555
633
|
|
|
556
634
|
Examples
|
|
557
635
|
--------
|
|
558
|
-
|
|
636
|
+
import asyncio
|
|
637
|
+
|
|
638
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
559
639
|
|
|
560
640
|
client = AsyncLabelStudio(
|
|
561
641
|
api_key="YOUR_API_KEY",
|
|
562
642
|
)
|
|
563
|
-
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
async def main() -> None:
|
|
646
|
+
await client.export_storage.gcs.create()
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
asyncio.run(main())
|
|
564
650
|
"""
|
|
565
651
|
_response = await self._client_wrapper.httpx_client.request(
|
|
566
652
|
"api/storages/export/gcs",
|
|
@@ -575,12 +661,21 @@ class AsyncGcsClient:
|
|
|
575
661
|
"google_application_credentials": google_application_credentials,
|
|
576
662
|
"google_project_id": google_project_id,
|
|
577
663
|
},
|
|
664
|
+
headers={
|
|
665
|
+
"content-type": "application/json",
|
|
666
|
+
},
|
|
578
667
|
request_options=request_options,
|
|
579
668
|
omit=OMIT,
|
|
580
669
|
)
|
|
581
670
|
try:
|
|
582
671
|
if 200 <= _response.status_code < 300:
|
|
583
|
-
return
|
|
672
|
+
return typing.cast(
|
|
673
|
+
GcsCreateResponse,
|
|
674
|
+
parse_obj_as(
|
|
675
|
+
type_=GcsCreateResponse, # type: ignore
|
|
676
|
+
object_=_response.json(),
|
|
677
|
+
),
|
|
678
|
+
)
|
|
584
679
|
_response_json = _response.json()
|
|
585
680
|
except JSONDecodeError:
|
|
586
681
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -601,6 +696,7 @@ class AsyncGcsClient:
|
|
|
601
696
|
request_options: typing.Optional[RequestOptions] = None,
|
|
602
697
|
) -> None:
|
|
603
698
|
"""
|
|
699
|
+
|
|
604
700
|
Validate a specific GCS export storage connection. This is useful to ensure that the storage configuration settings are correct and operational before attempting to export data.
|
|
605
701
|
|
|
606
702
|
Parameters
|
|
@@ -641,12 +737,20 @@ class AsyncGcsClient:
|
|
|
641
737
|
|
|
642
738
|
Examples
|
|
643
739
|
--------
|
|
644
|
-
|
|
740
|
+
import asyncio
|
|
741
|
+
|
|
742
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
645
743
|
|
|
646
744
|
client = AsyncLabelStudio(
|
|
647
745
|
api_key="YOUR_API_KEY",
|
|
648
746
|
)
|
|
649
|
-
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
async def main() -> None:
|
|
750
|
+
await client.export_storage.gcs.validate()
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
asyncio.run(main())
|
|
650
754
|
"""
|
|
651
755
|
_response = await self._client_wrapper.httpx_client.request(
|
|
652
756
|
"api/storages/export/gcs/validate",
|
|
@@ -662,6 +766,9 @@ class AsyncGcsClient:
|
|
|
662
766
|
"google_application_credentials": google_application_credentials,
|
|
663
767
|
"google_project_id": google_project_id,
|
|
664
768
|
},
|
|
769
|
+
headers={
|
|
770
|
+
"content-type": "application/json",
|
|
771
|
+
},
|
|
665
772
|
request_options=request_options,
|
|
666
773
|
omit=OMIT,
|
|
667
774
|
)
|
|
@@ -675,6 +782,7 @@ class AsyncGcsClient:
|
|
|
675
782
|
|
|
676
783
|
async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> GcsExportStorage:
|
|
677
784
|
"""
|
|
785
|
+
|
|
678
786
|
Get a specific GCS export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
|
|
679
787
|
|
|
680
788
|
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
@@ -694,21 +802,37 @@ class AsyncGcsClient:
|
|
|
694
802
|
|
|
695
803
|
Examples
|
|
696
804
|
--------
|
|
697
|
-
|
|
805
|
+
import asyncio
|
|
806
|
+
|
|
807
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
698
808
|
|
|
699
809
|
client = AsyncLabelStudio(
|
|
700
810
|
api_key="YOUR_API_KEY",
|
|
701
811
|
)
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
)
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
async def main() -> None:
|
|
815
|
+
await client.export_storage.gcs.get(
|
|
816
|
+
id=1,
|
|
817
|
+
)
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
asyncio.run(main())
|
|
705
821
|
"""
|
|
706
822
|
_response = await self._client_wrapper.httpx_client.request(
|
|
707
|
-
f"api/storages/export/gcs/{jsonable_encoder(id)}",
|
|
823
|
+
f"api/storages/export/gcs/{jsonable_encoder(id)}",
|
|
824
|
+
method="GET",
|
|
825
|
+
request_options=request_options,
|
|
708
826
|
)
|
|
709
827
|
try:
|
|
710
828
|
if 200 <= _response.status_code < 300:
|
|
711
|
-
return
|
|
829
|
+
return typing.cast(
|
|
830
|
+
GcsExportStorage,
|
|
831
|
+
parse_obj_as(
|
|
832
|
+
type_=GcsExportStorage, # type: ignore
|
|
833
|
+
object_=_response.json(),
|
|
834
|
+
),
|
|
835
|
+
)
|
|
712
836
|
_response_json = _response.json()
|
|
713
837
|
except JSONDecodeError:
|
|
714
838
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -716,6 +840,7 @@ class AsyncGcsClient:
|
|
|
716
840
|
|
|
717
841
|
async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
718
842
|
"""
|
|
843
|
+
|
|
719
844
|
Delete a specific GCS export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
|
|
720
845
|
|
|
721
846
|
Deleting an export/target storage connection does not affect tasks with synced data in Label Studio. If you want to remove the tasks that were synced from the external storage, you will need to delete them manually from within the Label Studio UI or use the [Delete tasks](../../tasks/delete-all-tasks) API.
|
|
@@ -734,17 +859,27 @@ class AsyncGcsClient:
|
|
|
734
859
|
|
|
735
860
|
Examples
|
|
736
861
|
--------
|
|
737
|
-
|
|
862
|
+
import asyncio
|
|
863
|
+
|
|
864
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
738
865
|
|
|
739
866
|
client = AsyncLabelStudio(
|
|
740
867
|
api_key="YOUR_API_KEY",
|
|
741
868
|
)
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
)
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
async def main() -> None:
|
|
872
|
+
await client.export_storage.gcs.delete(
|
|
873
|
+
id=1,
|
|
874
|
+
)
|
|
875
|
+
|
|
876
|
+
|
|
877
|
+
asyncio.run(main())
|
|
745
878
|
"""
|
|
746
879
|
_response = await self._client_wrapper.httpx_client.request(
|
|
747
|
-
f"api/storages/export/gcs/{jsonable_encoder(id)}",
|
|
880
|
+
f"api/storages/export/gcs/{jsonable_encoder(id)}",
|
|
881
|
+
method="DELETE",
|
|
882
|
+
request_options=request_options,
|
|
748
883
|
)
|
|
749
884
|
try:
|
|
750
885
|
if 200 <= _response.status_code < 300:
|
|
@@ -769,6 +904,7 @@ class AsyncGcsClient:
|
|
|
769
904
|
request_options: typing.Optional[RequestOptions] = None,
|
|
770
905
|
) -> GcsUpdateResponse:
|
|
771
906
|
"""
|
|
907
|
+
|
|
772
908
|
Update a specific GCS export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
|
|
773
909
|
|
|
774
910
|
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
@@ -812,14 +948,22 @@ class AsyncGcsClient:
|
|
|
812
948
|
|
|
813
949
|
Examples
|
|
814
950
|
--------
|
|
815
|
-
|
|
951
|
+
import asyncio
|
|
952
|
+
|
|
953
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
816
954
|
|
|
817
955
|
client = AsyncLabelStudio(
|
|
818
956
|
api_key="YOUR_API_KEY",
|
|
819
957
|
)
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
)
|
|
958
|
+
|
|
959
|
+
|
|
960
|
+
async def main() -> None:
|
|
961
|
+
await client.export_storage.gcs.update(
|
|
962
|
+
id=1,
|
|
963
|
+
)
|
|
964
|
+
|
|
965
|
+
|
|
966
|
+
asyncio.run(main())
|
|
823
967
|
"""
|
|
824
968
|
_response = await self._client_wrapper.httpx_client.request(
|
|
825
969
|
f"api/storages/export/gcs/{jsonable_encoder(id)}",
|
|
@@ -834,19 +978,29 @@ class AsyncGcsClient:
|
|
|
834
978
|
"google_application_credentials": google_application_credentials,
|
|
835
979
|
"google_project_id": google_project_id,
|
|
836
980
|
},
|
|
981
|
+
headers={
|
|
982
|
+
"content-type": "application/json",
|
|
983
|
+
},
|
|
837
984
|
request_options=request_options,
|
|
838
985
|
omit=OMIT,
|
|
839
986
|
)
|
|
840
987
|
try:
|
|
841
988
|
if 200 <= _response.status_code < 300:
|
|
842
|
-
return
|
|
989
|
+
return typing.cast(
|
|
990
|
+
GcsUpdateResponse,
|
|
991
|
+
parse_obj_as(
|
|
992
|
+
type_=GcsUpdateResponse, # type: ignore
|
|
993
|
+
object_=_response.json(),
|
|
994
|
+
),
|
|
995
|
+
)
|
|
843
996
|
_response_json = _response.json()
|
|
844
997
|
except JSONDecodeError:
|
|
845
998
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
846
999
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
847
1000
|
|
|
848
|
-
async def sync(self, id:
|
|
1001
|
+
async def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> GcsExportStorage:
|
|
849
1002
|
"""
|
|
1003
|
+
|
|
850
1004
|
Sync tasks to a GCS export/target storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
|
|
851
1005
|
|
|
852
1006
|
Sync operations with external buckets only go one way. They either create tasks from objects in the bucket (source/import storage) or push annotations to the output bucket (export/target storage). Changing something on the bucket side doesn’t guarantee consistency in results.
|
|
@@ -855,7 +1009,7 @@ class AsyncGcsClient:
|
|
|
855
1009
|
|
|
856
1010
|
Parameters
|
|
857
1011
|
----------
|
|
858
|
-
id :
|
|
1012
|
+
id : int
|
|
859
1013
|
|
|
860
1014
|
request_options : typing.Optional[RequestOptions]
|
|
861
1015
|
Request-specific configuration.
|
|
@@ -867,21 +1021,37 @@ class AsyncGcsClient:
|
|
|
867
1021
|
|
|
868
1022
|
Examples
|
|
869
1023
|
--------
|
|
870
|
-
|
|
1024
|
+
import asyncio
|
|
1025
|
+
|
|
1026
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
871
1027
|
|
|
872
1028
|
client = AsyncLabelStudio(
|
|
873
1029
|
api_key="YOUR_API_KEY",
|
|
874
1030
|
)
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
)
|
|
1031
|
+
|
|
1032
|
+
|
|
1033
|
+
async def main() -> None:
|
|
1034
|
+
await client.export_storage.gcs.sync(
|
|
1035
|
+
id=1,
|
|
1036
|
+
)
|
|
1037
|
+
|
|
1038
|
+
|
|
1039
|
+
asyncio.run(main())
|
|
878
1040
|
"""
|
|
879
1041
|
_response = await self._client_wrapper.httpx_client.request(
|
|
880
|
-
f"api/storages/export/gcs/{jsonable_encoder(id)}/sync",
|
|
1042
|
+
f"api/storages/export/gcs/{jsonable_encoder(id)}/sync",
|
|
1043
|
+
method="POST",
|
|
1044
|
+
request_options=request_options,
|
|
881
1045
|
)
|
|
882
1046
|
try:
|
|
883
1047
|
if 200 <= _response.status_code < 300:
|
|
884
|
-
return
|
|
1048
|
+
return typing.cast(
|
|
1049
|
+
GcsExportStorage,
|
|
1050
|
+
parse_obj_as(
|
|
1051
|
+
type_=GcsExportStorage, # type: ignore
|
|
1052
|
+
object_=_response.json(),
|
|
1053
|
+
),
|
|
1054
|
+
)
|
|
885
1055
|
_response_json = _response.json()
|
|
886
1056
|
except JSONDecodeError:
|
|
887
1057
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|