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.s3import_storage import S3ImportStorage
|
|
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.s3create_response import S3CreateResponse
|
|
11
|
+
from ...core.jsonable_encoder import jsonable_encoder
|
|
13
12
|
from .types.s3update_response import S3UpdateResponse
|
|
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 S3Client:
|
|
|
24
24
|
self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
25
25
|
) -> typing.List[S3ImportStorage]:
|
|
26
26
|
"""
|
|
27
|
+
|
|
27
28
|
You can connect your S3 bucket to Label Studio as a source storage or target storage. Use this API request to get a list of all Google import (source) 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 S3Client:
|
|
|
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 S3Client:
|
|
|
53
54
|
client.import_storage.s3.list()
|
|
54
55
|
"""
|
|
55
56
|
_response = self._client_wrapper.httpx_client.request(
|
|
56
|
-
"api/storages/s3/",
|
|
57
|
+
"api/storages/s3/",
|
|
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[S3ImportStorage],
|
|
68
|
+
parse_obj_as(
|
|
69
|
+
type_=typing.List[S3ImportStorage], # 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)
|
|
@@ -85,6 +97,7 @@ class S3Client:
|
|
|
85
97
|
request_options: typing.Optional[RequestOptions] = None,
|
|
86
98
|
) -> S3CreateResponse:
|
|
87
99
|
"""
|
|
100
|
+
|
|
88
101
|
Create a new source storage connection to a S3 bucket.
|
|
89
102
|
|
|
90
103
|
For information about the required fields and prerequisites, see [Amazon S3](https://labelstud.io/guide/storage#Amazon-S3) in the Label Studio documentation.
|
|
@@ -153,7 +166,7 @@ class S3Client:
|
|
|
153
166
|
|
|
154
167
|
Examples
|
|
155
168
|
--------
|
|
156
|
-
from label_studio_sdk
|
|
169
|
+
from label_studio_sdk import LabelStudio
|
|
157
170
|
|
|
158
171
|
client = LabelStudio(
|
|
159
172
|
api_key="YOUR_API_KEY",
|
|
@@ -181,12 +194,21 @@ class S3Client:
|
|
|
181
194
|
"region_name": region_name,
|
|
182
195
|
"s3_endpoint": s3endpoint,
|
|
183
196
|
},
|
|
197
|
+
headers={
|
|
198
|
+
"content-type": "application/json",
|
|
199
|
+
},
|
|
184
200
|
request_options=request_options,
|
|
185
201
|
omit=OMIT,
|
|
186
202
|
)
|
|
187
203
|
try:
|
|
188
204
|
if 200 <= _response.status_code < 300:
|
|
189
|
-
return
|
|
205
|
+
return typing.cast(
|
|
206
|
+
S3CreateResponse,
|
|
207
|
+
parse_obj_as(
|
|
208
|
+
type_=S3CreateResponse, # type: ignore
|
|
209
|
+
object_=_response.json(),
|
|
210
|
+
),
|
|
211
|
+
)
|
|
190
212
|
_response_json = _response.json()
|
|
191
213
|
except JSONDecodeError:
|
|
192
214
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -215,6 +237,7 @@ class S3Client:
|
|
|
215
237
|
request_options: typing.Optional[RequestOptions] = None,
|
|
216
238
|
) -> None:
|
|
217
239
|
"""
|
|
240
|
+
|
|
218
241
|
Validate a specific S3 import storage connection. This is useful to ensure that the storage configuration settings are correct and operational before attempting to import data.
|
|
219
242
|
|
|
220
243
|
Parameters
|
|
@@ -279,7 +302,7 @@ class S3Client:
|
|
|
279
302
|
|
|
280
303
|
Examples
|
|
281
304
|
--------
|
|
282
|
-
from label_studio_sdk
|
|
305
|
+
from label_studio_sdk import LabelStudio
|
|
283
306
|
|
|
284
307
|
client = LabelStudio(
|
|
285
308
|
api_key="YOUR_API_KEY",
|
|
@@ -308,6 +331,9 @@ class S3Client:
|
|
|
308
331
|
"region_name": region_name,
|
|
309
332
|
"s3_endpoint": s3endpoint,
|
|
310
333
|
},
|
|
334
|
+
headers={
|
|
335
|
+
"content-type": "application/json",
|
|
336
|
+
},
|
|
311
337
|
request_options=request_options,
|
|
312
338
|
omit=OMIT,
|
|
313
339
|
)
|
|
@@ -321,6 +347,7 @@ class S3Client:
|
|
|
321
347
|
|
|
322
348
|
def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3ImportStorage:
|
|
323
349
|
"""
|
|
350
|
+
|
|
324
351
|
Get a specific S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
325
352
|
|
|
326
353
|
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
@@ -340,7 +367,7 @@ class S3Client:
|
|
|
340
367
|
|
|
341
368
|
Examples
|
|
342
369
|
--------
|
|
343
|
-
from label_studio_sdk
|
|
370
|
+
from label_studio_sdk import LabelStudio
|
|
344
371
|
|
|
345
372
|
client = LabelStudio(
|
|
346
373
|
api_key="YOUR_API_KEY",
|
|
@@ -350,11 +377,19 @@ class S3Client:
|
|
|
350
377
|
)
|
|
351
378
|
"""
|
|
352
379
|
_response = self._client_wrapper.httpx_client.request(
|
|
353
|
-
f"api/storages/s3/{jsonable_encoder(id)}",
|
|
380
|
+
f"api/storages/s3/{jsonable_encoder(id)}",
|
|
381
|
+
method="GET",
|
|
382
|
+
request_options=request_options,
|
|
354
383
|
)
|
|
355
384
|
try:
|
|
356
385
|
if 200 <= _response.status_code < 300:
|
|
357
|
-
return
|
|
386
|
+
return typing.cast(
|
|
387
|
+
S3ImportStorage,
|
|
388
|
+
parse_obj_as(
|
|
389
|
+
type_=S3ImportStorage, # type: ignore
|
|
390
|
+
object_=_response.json(),
|
|
391
|
+
),
|
|
392
|
+
)
|
|
358
393
|
_response_json = _response.json()
|
|
359
394
|
except JSONDecodeError:
|
|
360
395
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -362,6 +397,7 @@ class S3Client:
|
|
|
362
397
|
|
|
363
398
|
def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
364
399
|
"""
|
|
400
|
+
|
|
365
401
|
Delete a specific S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
366
402
|
|
|
367
403
|
Deleting a source storage connection does not affect tasks with synced data in Label Studio. The sync process is designed to import new or updated tasks from the connected storage into the project, but it does not track deletions of files from the storage. Therefore, if you remove the external storage connection, the tasks that were created from that storage will remain in the project.
|
|
@@ -382,7 +418,7 @@ class S3Client:
|
|
|
382
418
|
|
|
383
419
|
Examples
|
|
384
420
|
--------
|
|
385
|
-
from label_studio_sdk
|
|
421
|
+
from label_studio_sdk import LabelStudio
|
|
386
422
|
|
|
387
423
|
client = LabelStudio(
|
|
388
424
|
api_key="YOUR_API_KEY",
|
|
@@ -392,7 +428,9 @@ class S3Client:
|
|
|
392
428
|
)
|
|
393
429
|
"""
|
|
394
430
|
_response = self._client_wrapper.httpx_client.request(
|
|
395
|
-
f"api/storages/s3/{jsonable_encoder(id)}",
|
|
431
|
+
f"api/storages/s3/{jsonable_encoder(id)}",
|
|
432
|
+
method="DELETE",
|
|
433
|
+
request_options=request_options,
|
|
396
434
|
)
|
|
397
435
|
try:
|
|
398
436
|
if 200 <= _response.status_code < 300:
|
|
@@ -425,6 +463,7 @@ class S3Client:
|
|
|
425
463
|
request_options: typing.Optional[RequestOptions] = None,
|
|
426
464
|
) -> S3UpdateResponse:
|
|
427
465
|
"""
|
|
466
|
+
|
|
428
467
|
Update a specific S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
429
468
|
|
|
430
469
|
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
@@ -492,7 +531,7 @@ class S3Client:
|
|
|
492
531
|
|
|
493
532
|
Examples
|
|
494
533
|
--------
|
|
495
|
-
from label_studio_sdk
|
|
534
|
+
from label_studio_sdk import LabelStudio
|
|
496
535
|
|
|
497
536
|
client = LabelStudio(
|
|
498
537
|
api_key="YOUR_API_KEY",
|
|
@@ -522,12 +561,21 @@ class S3Client:
|
|
|
522
561
|
"region_name": region_name,
|
|
523
562
|
"s3_endpoint": s3endpoint,
|
|
524
563
|
},
|
|
564
|
+
headers={
|
|
565
|
+
"content-type": "application/json",
|
|
566
|
+
},
|
|
525
567
|
request_options=request_options,
|
|
526
568
|
omit=OMIT,
|
|
527
569
|
)
|
|
528
570
|
try:
|
|
529
571
|
if 200 <= _response.status_code < 300:
|
|
530
|
-
return
|
|
572
|
+
return typing.cast(
|
|
573
|
+
S3UpdateResponse,
|
|
574
|
+
parse_obj_as(
|
|
575
|
+
type_=S3UpdateResponse, # type: ignore
|
|
576
|
+
object_=_response.json(),
|
|
577
|
+
),
|
|
578
|
+
)
|
|
531
579
|
_response_json = _response.json()
|
|
532
580
|
except JSONDecodeError:
|
|
533
581
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -535,6 +583,7 @@ class S3Client:
|
|
|
535
583
|
|
|
536
584
|
def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3ImportStorage:
|
|
537
585
|
"""
|
|
586
|
+
|
|
538
587
|
Sync tasks from an S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
539
588
|
|
|
540
589
|
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.
|
|
@@ -556,7 +605,7 @@ class S3Client:
|
|
|
556
605
|
|
|
557
606
|
Examples
|
|
558
607
|
--------
|
|
559
|
-
from label_studio_sdk
|
|
608
|
+
from label_studio_sdk import LabelStudio
|
|
560
609
|
|
|
561
610
|
client = LabelStudio(
|
|
562
611
|
api_key="YOUR_API_KEY",
|
|
@@ -566,11 +615,19 @@ class S3Client:
|
|
|
566
615
|
)
|
|
567
616
|
"""
|
|
568
617
|
_response = self._client_wrapper.httpx_client.request(
|
|
569
|
-
f"api/storages/s3/{jsonable_encoder(id)}/sync",
|
|
618
|
+
f"api/storages/s3/{jsonable_encoder(id)}/sync",
|
|
619
|
+
method="POST",
|
|
620
|
+
request_options=request_options,
|
|
570
621
|
)
|
|
571
622
|
try:
|
|
572
623
|
if 200 <= _response.status_code < 300:
|
|
573
|
-
return
|
|
624
|
+
return typing.cast(
|
|
625
|
+
S3ImportStorage,
|
|
626
|
+
parse_obj_as(
|
|
627
|
+
type_=S3ImportStorage, # type: ignore
|
|
628
|
+
object_=_response.json(),
|
|
629
|
+
),
|
|
630
|
+
)
|
|
574
631
|
_response_json = _response.json()
|
|
575
632
|
except JSONDecodeError:
|
|
576
633
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -585,6 +642,7 @@ class AsyncS3Client:
|
|
|
585
642
|
self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
586
643
|
) -> typing.List[S3ImportStorage]:
|
|
587
644
|
"""
|
|
645
|
+
|
|
588
646
|
You can connect your S3 bucket to Label Studio as a source storage or target storage. Use this API request to get a list of all Google import (source) storage connections for a specific project.
|
|
589
647
|
|
|
590
648
|
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).
|
|
@@ -606,19 +664,38 @@ class AsyncS3Client:
|
|
|
606
664
|
|
|
607
665
|
Examples
|
|
608
666
|
--------
|
|
609
|
-
|
|
667
|
+
import asyncio
|
|
668
|
+
|
|
669
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
610
670
|
|
|
611
671
|
client = AsyncLabelStudio(
|
|
612
672
|
api_key="YOUR_API_KEY",
|
|
613
673
|
)
|
|
614
|
-
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
async def main() -> None:
|
|
677
|
+
await client.import_storage.s3.list()
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
asyncio.run(main())
|
|
615
681
|
"""
|
|
616
682
|
_response = await self._client_wrapper.httpx_client.request(
|
|
617
|
-
"api/storages/s3/",
|
|
683
|
+
"api/storages/s3/",
|
|
684
|
+
method="GET",
|
|
685
|
+
params={
|
|
686
|
+
"project": project,
|
|
687
|
+
},
|
|
688
|
+
request_options=request_options,
|
|
618
689
|
)
|
|
619
690
|
try:
|
|
620
691
|
if 200 <= _response.status_code < 300:
|
|
621
|
-
return
|
|
692
|
+
return typing.cast(
|
|
693
|
+
typing.List[S3ImportStorage],
|
|
694
|
+
parse_obj_as(
|
|
695
|
+
type_=typing.List[S3ImportStorage], # type: ignore
|
|
696
|
+
object_=_response.json(),
|
|
697
|
+
),
|
|
698
|
+
)
|
|
622
699
|
_response_json = _response.json()
|
|
623
700
|
except JSONDecodeError:
|
|
624
701
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -646,6 +723,7 @@ class AsyncS3Client:
|
|
|
646
723
|
request_options: typing.Optional[RequestOptions] = None,
|
|
647
724
|
) -> S3CreateResponse:
|
|
648
725
|
"""
|
|
726
|
+
|
|
649
727
|
Create a new source storage connection to a S3 bucket.
|
|
650
728
|
|
|
651
729
|
For information about the required fields and prerequisites, see [Amazon S3](https://labelstud.io/guide/storage#Amazon-S3) in the Label Studio documentation.
|
|
@@ -714,12 +792,20 @@ class AsyncS3Client:
|
|
|
714
792
|
|
|
715
793
|
Examples
|
|
716
794
|
--------
|
|
717
|
-
|
|
795
|
+
import asyncio
|
|
796
|
+
|
|
797
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
718
798
|
|
|
719
799
|
client = AsyncLabelStudio(
|
|
720
800
|
api_key="YOUR_API_KEY",
|
|
721
801
|
)
|
|
722
|
-
|
|
802
|
+
|
|
803
|
+
|
|
804
|
+
async def main() -> None:
|
|
805
|
+
await client.import_storage.s3.create()
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
asyncio.run(main())
|
|
723
809
|
"""
|
|
724
810
|
_response = await self._client_wrapper.httpx_client.request(
|
|
725
811
|
"api/storages/s3/",
|
|
@@ -742,12 +828,21 @@ class AsyncS3Client:
|
|
|
742
828
|
"region_name": region_name,
|
|
743
829
|
"s3_endpoint": s3endpoint,
|
|
744
830
|
},
|
|
831
|
+
headers={
|
|
832
|
+
"content-type": "application/json",
|
|
833
|
+
},
|
|
745
834
|
request_options=request_options,
|
|
746
835
|
omit=OMIT,
|
|
747
836
|
)
|
|
748
837
|
try:
|
|
749
838
|
if 200 <= _response.status_code < 300:
|
|
750
|
-
return
|
|
839
|
+
return typing.cast(
|
|
840
|
+
S3CreateResponse,
|
|
841
|
+
parse_obj_as(
|
|
842
|
+
type_=S3CreateResponse, # type: ignore
|
|
843
|
+
object_=_response.json(),
|
|
844
|
+
),
|
|
845
|
+
)
|
|
751
846
|
_response_json = _response.json()
|
|
752
847
|
except JSONDecodeError:
|
|
753
848
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -776,6 +871,7 @@ class AsyncS3Client:
|
|
|
776
871
|
request_options: typing.Optional[RequestOptions] = None,
|
|
777
872
|
) -> None:
|
|
778
873
|
"""
|
|
874
|
+
|
|
779
875
|
Validate a specific S3 import storage connection. This is useful to ensure that the storage configuration settings are correct and operational before attempting to import data.
|
|
780
876
|
|
|
781
877
|
Parameters
|
|
@@ -840,12 +936,20 @@ class AsyncS3Client:
|
|
|
840
936
|
|
|
841
937
|
Examples
|
|
842
938
|
--------
|
|
843
|
-
|
|
939
|
+
import asyncio
|
|
940
|
+
|
|
941
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
844
942
|
|
|
845
943
|
client = AsyncLabelStudio(
|
|
846
944
|
api_key="YOUR_API_KEY",
|
|
847
945
|
)
|
|
848
|
-
|
|
946
|
+
|
|
947
|
+
|
|
948
|
+
async def main() -> None:
|
|
949
|
+
await client.import_storage.s3.validate()
|
|
950
|
+
|
|
951
|
+
|
|
952
|
+
asyncio.run(main())
|
|
849
953
|
"""
|
|
850
954
|
_response = await self._client_wrapper.httpx_client.request(
|
|
851
955
|
"api/storages/s3/validate",
|
|
@@ -869,6 +973,9 @@ class AsyncS3Client:
|
|
|
869
973
|
"region_name": region_name,
|
|
870
974
|
"s3_endpoint": s3endpoint,
|
|
871
975
|
},
|
|
976
|
+
headers={
|
|
977
|
+
"content-type": "application/json",
|
|
978
|
+
},
|
|
872
979
|
request_options=request_options,
|
|
873
980
|
omit=OMIT,
|
|
874
981
|
)
|
|
@@ -882,6 +989,7 @@ class AsyncS3Client:
|
|
|
882
989
|
|
|
883
990
|
async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3ImportStorage:
|
|
884
991
|
"""
|
|
992
|
+
|
|
885
993
|
Get a specific S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
886
994
|
|
|
887
995
|
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
@@ -901,21 +1009,37 @@ class AsyncS3Client:
|
|
|
901
1009
|
|
|
902
1010
|
Examples
|
|
903
1011
|
--------
|
|
904
|
-
|
|
1012
|
+
import asyncio
|
|
1013
|
+
|
|
1014
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
905
1015
|
|
|
906
1016
|
client = AsyncLabelStudio(
|
|
907
1017
|
api_key="YOUR_API_KEY",
|
|
908
1018
|
)
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
)
|
|
1019
|
+
|
|
1020
|
+
|
|
1021
|
+
async def main() -> None:
|
|
1022
|
+
await client.import_storage.s3.get(
|
|
1023
|
+
id=1,
|
|
1024
|
+
)
|
|
1025
|
+
|
|
1026
|
+
|
|
1027
|
+
asyncio.run(main())
|
|
912
1028
|
"""
|
|
913
1029
|
_response = await self._client_wrapper.httpx_client.request(
|
|
914
|
-
f"api/storages/s3/{jsonable_encoder(id)}",
|
|
1030
|
+
f"api/storages/s3/{jsonable_encoder(id)}",
|
|
1031
|
+
method="GET",
|
|
1032
|
+
request_options=request_options,
|
|
915
1033
|
)
|
|
916
1034
|
try:
|
|
917
1035
|
if 200 <= _response.status_code < 300:
|
|
918
|
-
return
|
|
1036
|
+
return typing.cast(
|
|
1037
|
+
S3ImportStorage,
|
|
1038
|
+
parse_obj_as(
|
|
1039
|
+
type_=S3ImportStorage, # type: ignore
|
|
1040
|
+
object_=_response.json(),
|
|
1041
|
+
),
|
|
1042
|
+
)
|
|
919
1043
|
_response_json = _response.json()
|
|
920
1044
|
except JSONDecodeError:
|
|
921
1045
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -923,6 +1047,7 @@ class AsyncS3Client:
|
|
|
923
1047
|
|
|
924
1048
|
async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
925
1049
|
"""
|
|
1050
|
+
|
|
926
1051
|
Delete a specific S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
927
1052
|
|
|
928
1053
|
Deleting a source storage connection does not affect tasks with synced data in Label Studio. The sync process is designed to import new or updated tasks from the connected storage into the project, but it does not track deletions of files from the storage. Therefore, if you remove the external storage connection, the tasks that were created from that storage will remain in the project.
|
|
@@ -943,17 +1068,27 @@ class AsyncS3Client:
|
|
|
943
1068
|
|
|
944
1069
|
Examples
|
|
945
1070
|
--------
|
|
946
|
-
|
|
1071
|
+
import asyncio
|
|
1072
|
+
|
|
1073
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
947
1074
|
|
|
948
1075
|
client = AsyncLabelStudio(
|
|
949
1076
|
api_key="YOUR_API_KEY",
|
|
950
1077
|
)
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
)
|
|
1078
|
+
|
|
1079
|
+
|
|
1080
|
+
async def main() -> None:
|
|
1081
|
+
await client.import_storage.s3.delete(
|
|
1082
|
+
id=1,
|
|
1083
|
+
)
|
|
1084
|
+
|
|
1085
|
+
|
|
1086
|
+
asyncio.run(main())
|
|
954
1087
|
"""
|
|
955
1088
|
_response = await self._client_wrapper.httpx_client.request(
|
|
956
|
-
f"api/storages/s3/{jsonable_encoder(id)}",
|
|
1089
|
+
f"api/storages/s3/{jsonable_encoder(id)}",
|
|
1090
|
+
method="DELETE",
|
|
1091
|
+
request_options=request_options,
|
|
957
1092
|
)
|
|
958
1093
|
try:
|
|
959
1094
|
if 200 <= _response.status_code < 300:
|
|
@@ -986,6 +1121,7 @@ class AsyncS3Client:
|
|
|
986
1121
|
request_options: typing.Optional[RequestOptions] = None,
|
|
987
1122
|
) -> S3UpdateResponse:
|
|
988
1123
|
"""
|
|
1124
|
+
|
|
989
1125
|
Update a specific S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
990
1126
|
|
|
991
1127
|
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
@@ -1053,14 +1189,22 @@ class AsyncS3Client:
|
|
|
1053
1189
|
|
|
1054
1190
|
Examples
|
|
1055
1191
|
--------
|
|
1056
|
-
|
|
1192
|
+
import asyncio
|
|
1193
|
+
|
|
1194
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
1057
1195
|
|
|
1058
1196
|
client = AsyncLabelStudio(
|
|
1059
1197
|
api_key="YOUR_API_KEY",
|
|
1060
1198
|
)
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
)
|
|
1199
|
+
|
|
1200
|
+
|
|
1201
|
+
async def main() -> None:
|
|
1202
|
+
await client.import_storage.s3.update(
|
|
1203
|
+
id=1,
|
|
1204
|
+
)
|
|
1205
|
+
|
|
1206
|
+
|
|
1207
|
+
asyncio.run(main())
|
|
1064
1208
|
"""
|
|
1065
1209
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1066
1210
|
f"api/storages/s3/{jsonable_encoder(id)}",
|
|
@@ -1083,12 +1227,21 @@ class AsyncS3Client:
|
|
|
1083
1227
|
"region_name": region_name,
|
|
1084
1228
|
"s3_endpoint": s3endpoint,
|
|
1085
1229
|
},
|
|
1230
|
+
headers={
|
|
1231
|
+
"content-type": "application/json",
|
|
1232
|
+
},
|
|
1086
1233
|
request_options=request_options,
|
|
1087
1234
|
omit=OMIT,
|
|
1088
1235
|
)
|
|
1089
1236
|
try:
|
|
1090
1237
|
if 200 <= _response.status_code < 300:
|
|
1091
|
-
return
|
|
1238
|
+
return typing.cast(
|
|
1239
|
+
S3UpdateResponse,
|
|
1240
|
+
parse_obj_as(
|
|
1241
|
+
type_=S3UpdateResponse, # type: ignore
|
|
1242
|
+
object_=_response.json(),
|
|
1243
|
+
),
|
|
1244
|
+
)
|
|
1092
1245
|
_response_json = _response.json()
|
|
1093
1246
|
except JSONDecodeError:
|
|
1094
1247
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -1096,6 +1249,7 @@ class AsyncS3Client:
|
|
|
1096
1249
|
|
|
1097
1250
|
async def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3ImportStorage:
|
|
1098
1251
|
"""
|
|
1252
|
+
|
|
1099
1253
|
Sync tasks from an S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
1100
1254
|
|
|
1101
1255
|
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.
|
|
@@ -1117,21 +1271,37 @@ class AsyncS3Client:
|
|
|
1117
1271
|
|
|
1118
1272
|
Examples
|
|
1119
1273
|
--------
|
|
1120
|
-
|
|
1274
|
+
import asyncio
|
|
1275
|
+
|
|
1276
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
1121
1277
|
|
|
1122
1278
|
client = AsyncLabelStudio(
|
|
1123
1279
|
api_key="YOUR_API_KEY",
|
|
1124
1280
|
)
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
)
|
|
1281
|
+
|
|
1282
|
+
|
|
1283
|
+
async def main() -> None:
|
|
1284
|
+
await client.import_storage.s3.sync(
|
|
1285
|
+
id=1,
|
|
1286
|
+
)
|
|
1287
|
+
|
|
1288
|
+
|
|
1289
|
+
asyncio.run(main())
|
|
1128
1290
|
"""
|
|
1129
1291
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1130
|
-
f"api/storages/s3/{jsonable_encoder(id)}/sync",
|
|
1292
|
+
f"api/storages/s3/{jsonable_encoder(id)}/sync",
|
|
1293
|
+
method="POST",
|
|
1294
|
+
request_options=request_options,
|
|
1131
1295
|
)
|
|
1132
1296
|
try:
|
|
1133
1297
|
if 200 <= _response.status_code < 300:
|
|
1134
|
-
return
|
|
1298
|
+
return typing.cast(
|
|
1299
|
+
S3ImportStorage,
|
|
1300
|
+
parse_obj_as(
|
|
1301
|
+
type_=S3ImportStorage, # type: ignore
|
|
1302
|
+
object_=_response.json(),
|
|
1303
|
+
),
|
|
1304
|
+
)
|
|
1135
1305
|
_response_json = _response.json()
|
|
1136
1306
|
except JSONDecodeError:
|
|
1137
1307
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|