label-studio-sdk 1.0.7__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 +26 -7
- label_studio_sdk/_extensions/label_studio_tools/core/label_config.py +13 -4
- label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py +16 -4
- label_studio_sdk/_extensions/label_studio_tools/core/utils/json_schema.py +86 -0
- label_studio_sdk/_extensions/pager_ext.py +8 -0
- label_studio_sdk/_legacy/schema/label_config_schema.json +42 -11
- 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 +66 -18
- 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 +205 -10
- label_studio_sdk/label_interface/interface.py +80 -6
- label_studio_sdk/label_interface/region.py +1 -10
- 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 +656 -21
- 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 +389 -75
- 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 +16 -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 +47 -0
- 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 +47 -26
- label_studio_sdk/types/model_provider_connection_budget_reset_period.py +5 -0
- 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 +46 -48
- label_studio_sdk/types/task_annotators_item.py +1 -1
- label_studio_sdk/types/task_comment_authors_item.py +5 -0
- 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.7.dist-info → label_studio_sdk-1.0.10.dist-info}/METADATA +9 -5
- {label_studio_sdk-1.0.7.dist-info → label_studio_sdk-1.0.10.dist-info}/RECORD +203 -186
- {label_studio_sdk-1.0.7.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.7.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.s3export_storage import S3ExportStorage
|
|
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[S3ExportStorage]:
|
|
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 S3 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 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.export_storage.s3.list()
|
|
54
55
|
"""
|
|
55
56
|
_response = self._client_wrapper.httpx_client.request(
|
|
56
|
-
"api/storages/export/s3",
|
|
57
|
+
"api/storages/export/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[S3ExportStorage],
|
|
68
|
+
parse_obj_as(
|
|
69
|
+
type_=typing.List[S3ExportStorage], # 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)
|
|
@@ -81,6 +93,7 @@ class S3Client:
|
|
|
81
93
|
request_options: typing.Optional[RequestOptions] = None,
|
|
82
94
|
) -> S3CreateResponse:
|
|
83
95
|
"""
|
|
96
|
+
|
|
84
97
|
Create a new target storage connection to S3 storage.
|
|
85
98
|
|
|
86
99
|
For information about the required fields and prerequisites, see [Amazon S3](https://labelstud.io/guide/storage#Amazon-S3) in the Label Studio documentation.
|
|
@@ -135,7 +148,7 @@ class S3Client:
|
|
|
135
148
|
|
|
136
149
|
Examples
|
|
137
150
|
--------
|
|
138
|
-
from label_studio_sdk
|
|
151
|
+
from label_studio_sdk import LabelStudio
|
|
139
152
|
|
|
140
153
|
client = LabelStudio(
|
|
141
154
|
api_key="YOUR_API_KEY",
|
|
@@ -159,12 +172,21 @@ class S3Client:
|
|
|
159
172
|
"region_name": region_name,
|
|
160
173
|
"s3_endpoint": s3endpoint,
|
|
161
174
|
},
|
|
175
|
+
headers={
|
|
176
|
+
"content-type": "application/json",
|
|
177
|
+
},
|
|
162
178
|
request_options=request_options,
|
|
163
179
|
omit=OMIT,
|
|
164
180
|
)
|
|
165
181
|
try:
|
|
166
182
|
if 200 <= _response.status_code < 300:
|
|
167
|
-
return
|
|
183
|
+
return typing.cast(
|
|
184
|
+
S3CreateResponse,
|
|
185
|
+
parse_obj_as(
|
|
186
|
+
type_=S3CreateResponse, # type: ignore
|
|
187
|
+
object_=_response.json(),
|
|
188
|
+
),
|
|
189
|
+
)
|
|
168
190
|
_response_json = _response.json()
|
|
169
191
|
except JSONDecodeError:
|
|
170
192
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -189,6 +211,7 @@ class S3Client:
|
|
|
189
211
|
request_options: typing.Optional[RequestOptions] = None,
|
|
190
212
|
) -> None:
|
|
191
213
|
"""
|
|
214
|
+
|
|
192
215
|
Validate a specific S3 export storage connection. This is useful to ensure that the storage configuration settings are correct and operational before attempting to export data.
|
|
193
216
|
|
|
194
217
|
Parameters
|
|
@@ -241,7 +264,7 @@ class S3Client:
|
|
|
241
264
|
|
|
242
265
|
Examples
|
|
243
266
|
--------
|
|
244
|
-
from label_studio_sdk
|
|
267
|
+
from label_studio_sdk import LabelStudio
|
|
245
268
|
|
|
246
269
|
client = LabelStudio(
|
|
247
270
|
api_key="YOUR_API_KEY",
|
|
@@ -266,6 +289,9 @@ class S3Client:
|
|
|
266
289
|
"region_name": region_name,
|
|
267
290
|
"s3_endpoint": s3endpoint,
|
|
268
291
|
},
|
|
292
|
+
headers={
|
|
293
|
+
"content-type": "application/json",
|
|
294
|
+
},
|
|
269
295
|
request_options=request_options,
|
|
270
296
|
omit=OMIT,
|
|
271
297
|
)
|
|
@@ -279,6 +305,7 @@ class S3Client:
|
|
|
279
305
|
|
|
280
306
|
def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3ExportStorage:
|
|
281
307
|
"""
|
|
308
|
+
|
|
282
309
|
Get a specific S3 export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
|
|
283
310
|
|
|
284
311
|
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
@@ -298,7 +325,7 @@ class S3Client:
|
|
|
298
325
|
|
|
299
326
|
Examples
|
|
300
327
|
--------
|
|
301
|
-
from label_studio_sdk
|
|
328
|
+
from label_studio_sdk import LabelStudio
|
|
302
329
|
|
|
303
330
|
client = LabelStudio(
|
|
304
331
|
api_key="YOUR_API_KEY",
|
|
@@ -308,11 +335,19 @@ class S3Client:
|
|
|
308
335
|
)
|
|
309
336
|
"""
|
|
310
337
|
_response = self._client_wrapper.httpx_client.request(
|
|
311
|
-
f"api/storages/export/s3/{jsonable_encoder(id)}",
|
|
338
|
+
f"api/storages/export/s3/{jsonable_encoder(id)}",
|
|
339
|
+
method="GET",
|
|
340
|
+
request_options=request_options,
|
|
312
341
|
)
|
|
313
342
|
try:
|
|
314
343
|
if 200 <= _response.status_code < 300:
|
|
315
|
-
return
|
|
344
|
+
return typing.cast(
|
|
345
|
+
S3ExportStorage,
|
|
346
|
+
parse_obj_as(
|
|
347
|
+
type_=S3ExportStorage, # type: ignore
|
|
348
|
+
object_=_response.json(),
|
|
349
|
+
),
|
|
350
|
+
)
|
|
316
351
|
_response_json = _response.json()
|
|
317
352
|
except JSONDecodeError:
|
|
318
353
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -320,6 +355,7 @@ class S3Client:
|
|
|
320
355
|
|
|
321
356
|
def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
322
357
|
"""
|
|
358
|
+
|
|
323
359
|
Delete a specific S3 export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
|
|
324
360
|
|
|
325
361
|
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.
|
|
@@ -338,7 +374,7 @@ class S3Client:
|
|
|
338
374
|
|
|
339
375
|
Examples
|
|
340
376
|
--------
|
|
341
|
-
from label_studio_sdk
|
|
377
|
+
from label_studio_sdk import LabelStudio
|
|
342
378
|
|
|
343
379
|
client = LabelStudio(
|
|
344
380
|
api_key="YOUR_API_KEY",
|
|
@@ -348,7 +384,9 @@ class S3Client:
|
|
|
348
384
|
)
|
|
349
385
|
"""
|
|
350
386
|
_response = self._client_wrapper.httpx_client.request(
|
|
351
|
-
f"api/storages/export/s3/{jsonable_encoder(id)}",
|
|
387
|
+
f"api/storages/export/s3/{jsonable_encoder(id)}",
|
|
388
|
+
method="DELETE",
|
|
389
|
+
request_options=request_options,
|
|
352
390
|
)
|
|
353
391
|
try:
|
|
354
392
|
if 200 <= _response.status_code < 300:
|
|
@@ -377,6 +415,7 @@ class S3Client:
|
|
|
377
415
|
request_options: typing.Optional[RequestOptions] = None,
|
|
378
416
|
) -> S3UpdateResponse:
|
|
379
417
|
"""
|
|
418
|
+
|
|
380
419
|
Update a specific S3 export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
|
|
381
420
|
|
|
382
421
|
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
@@ -432,7 +471,7 @@ class S3Client:
|
|
|
432
471
|
|
|
433
472
|
Examples
|
|
434
473
|
--------
|
|
435
|
-
from label_studio_sdk
|
|
474
|
+
from label_studio_sdk import LabelStudio
|
|
436
475
|
|
|
437
476
|
client = LabelStudio(
|
|
438
477
|
api_key="YOUR_API_KEY",
|
|
@@ -458,19 +497,29 @@ class S3Client:
|
|
|
458
497
|
"region_name": region_name,
|
|
459
498
|
"s3_endpoint": s3endpoint,
|
|
460
499
|
},
|
|
500
|
+
headers={
|
|
501
|
+
"content-type": "application/json",
|
|
502
|
+
},
|
|
461
503
|
request_options=request_options,
|
|
462
504
|
omit=OMIT,
|
|
463
505
|
)
|
|
464
506
|
try:
|
|
465
507
|
if 200 <= _response.status_code < 300:
|
|
466
|
-
return
|
|
508
|
+
return typing.cast(
|
|
509
|
+
S3UpdateResponse,
|
|
510
|
+
parse_obj_as(
|
|
511
|
+
type_=S3UpdateResponse, # type: ignore
|
|
512
|
+
object_=_response.json(),
|
|
513
|
+
),
|
|
514
|
+
)
|
|
467
515
|
_response_json = _response.json()
|
|
468
516
|
except JSONDecodeError:
|
|
469
517
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
470
518
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
471
519
|
|
|
472
|
-
def sync(self, id:
|
|
520
|
+
def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3ExportStorage:
|
|
473
521
|
"""
|
|
522
|
+
|
|
474
523
|
Sync tasks to an S3 export/target storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
|
|
475
524
|
|
|
476
525
|
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.
|
|
@@ -479,7 +528,7 @@ class S3Client:
|
|
|
479
528
|
|
|
480
529
|
Parameters
|
|
481
530
|
----------
|
|
482
|
-
id :
|
|
531
|
+
id : int
|
|
483
532
|
|
|
484
533
|
request_options : typing.Optional[RequestOptions]
|
|
485
534
|
Request-specific configuration.
|
|
@@ -491,21 +540,29 @@ class S3Client:
|
|
|
491
540
|
|
|
492
541
|
Examples
|
|
493
542
|
--------
|
|
494
|
-
from label_studio_sdk
|
|
543
|
+
from label_studio_sdk import LabelStudio
|
|
495
544
|
|
|
496
545
|
client = LabelStudio(
|
|
497
546
|
api_key="YOUR_API_KEY",
|
|
498
547
|
)
|
|
499
548
|
client.export_storage.s3.sync(
|
|
500
|
-
id=
|
|
549
|
+
id=1,
|
|
501
550
|
)
|
|
502
551
|
"""
|
|
503
552
|
_response = self._client_wrapper.httpx_client.request(
|
|
504
|
-
f"api/storages/export/s3/{jsonable_encoder(id)}/sync",
|
|
553
|
+
f"api/storages/export/s3/{jsonable_encoder(id)}/sync",
|
|
554
|
+
method="POST",
|
|
555
|
+
request_options=request_options,
|
|
505
556
|
)
|
|
506
557
|
try:
|
|
507
558
|
if 200 <= _response.status_code < 300:
|
|
508
|
-
return
|
|
559
|
+
return typing.cast(
|
|
560
|
+
S3ExportStorage,
|
|
561
|
+
parse_obj_as(
|
|
562
|
+
type_=S3ExportStorage, # type: ignore
|
|
563
|
+
object_=_response.json(),
|
|
564
|
+
),
|
|
565
|
+
)
|
|
509
566
|
_response_json = _response.json()
|
|
510
567
|
except JSONDecodeError:
|
|
511
568
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -520,6 +577,7 @@ class AsyncS3Client:
|
|
|
520
577
|
self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
521
578
|
) -> typing.List[S3ExportStorage]:
|
|
522
579
|
"""
|
|
580
|
+
|
|
523
581
|
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 S3 export (target) storage connections for a specific project.
|
|
524
582
|
|
|
525
583
|
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).
|
|
@@ -541,19 +599,38 @@ class AsyncS3Client:
|
|
|
541
599
|
|
|
542
600
|
Examples
|
|
543
601
|
--------
|
|
544
|
-
|
|
602
|
+
import asyncio
|
|
603
|
+
|
|
604
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
545
605
|
|
|
546
606
|
client = AsyncLabelStudio(
|
|
547
607
|
api_key="YOUR_API_KEY",
|
|
548
608
|
)
|
|
549
|
-
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
async def main() -> None:
|
|
612
|
+
await client.export_storage.s3.list()
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
asyncio.run(main())
|
|
550
616
|
"""
|
|
551
617
|
_response = await self._client_wrapper.httpx_client.request(
|
|
552
|
-
"api/storages/export/s3",
|
|
618
|
+
"api/storages/export/s3",
|
|
619
|
+
method="GET",
|
|
620
|
+
params={
|
|
621
|
+
"project": project,
|
|
622
|
+
},
|
|
623
|
+
request_options=request_options,
|
|
553
624
|
)
|
|
554
625
|
try:
|
|
555
626
|
if 200 <= _response.status_code < 300:
|
|
556
|
-
return
|
|
627
|
+
return typing.cast(
|
|
628
|
+
typing.List[S3ExportStorage],
|
|
629
|
+
parse_obj_as(
|
|
630
|
+
type_=typing.List[S3ExportStorage], # type: ignore
|
|
631
|
+
object_=_response.json(),
|
|
632
|
+
),
|
|
633
|
+
)
|
|
557
634
|
_response_json = _response.json()
|
|
558
635
|
except JSONDecodeError:
|
|
559
636
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -577,6 +654,7 @@ class AsyncS3Client:
|
|
|
577
654
|
request_options: typing.Optional[RequestOptions] = None,
|
|
578
655
|
) -> S3CreateResponse:
|
|
579
656
|
"""
|
|
657
|
+
|
|
580
658
|
Create a new target storage connection to S3 storage.
|
|
581
659
|
|
|
582
660
|
For information about the required fields and prerequisites, see [Amazon S3](https://labelstud.io/guide/storage#Amazon-S3) in the Label Studio documentation.
|
|
@@ -631,12 +709,20 @@ class AsyncS3Client:
|
|
|
631
709
|
|
|
632
710
|
Examples
|
|
633
711
|
--------
|
|
634
|
-
|
|
712
|
+
import asyncio
|
|
713
|
+
|
|
714
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
635
715
|
|
|
636
716
|
client = AsyncLabelStudio(
|
|
637
717
|
api_key="YOUR_API_KEY",
|
|
638
718
|
)
|
|
639
|
-
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
async def main() -> None:
|
|
722
|
+
await client.export_storage.s3.create()
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
asyncio.run(main())
|
|
640
726
|
"""
|
|
641
727
|
_response = await self._client_wrapper.httpx_client.request(
|
|
642
728
|
"api/storages/export/s3",
|
|
@@ -655,12 +741,21 @@ class AsyncS3Client:
|
|
|
655
741
|
"region_name": region_name,
|
|
656
742
|
"s3_endpoint": s3endpoint,
|
|
657
743
|
},
|
|
744
|
+
headers={
|
|
745
|
+
"content-type": "application/json",
|
|
746
|
+
},
|
|
658
747
|
request_options=request_options,
|
|
659
748
|
omit=OMIT,
|
|
660
749
|
)
|
|
661
750
|
try:
|
|
662
751
|
if 200 <= _response.status_code < 300:
|
|
663
|
-
return
|
|
752
|
+
return typing.cast(
|
|
753
|
+
S3CreateResponse,
|
|
754
|
+
parse_obj_as(
|
|
755
|
+
type_=S3CreateResponse, # type: ignore
|
|
756
|
+
object_=_response.json(),
|
|
757
|
+
),
|
|
758
|
+
)
|
|
664
759
|
_response_json = _response.json()
|
|
665
760
|
except JSONDecodeError:
|
|
666
761
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -685,6 +780,7 @@ class AsyncS3Client:
|
|
|
685
780
|
request_options: typing.Optional[RequestOptions] = None,
|
|
686
781
|
) -> None:
|
|
687
782
|
"""
|
|
783
|
+
|
|
688
784
|
Validate a specific S3 export storage connection. This is useful to ensure that the storage configuration settings are correct and operational before attempting to export data.
|
|
689
785
|
|
|
690
786
|
Parameters
|
|
@@ -737,12 +833,20 @@ class AsyncS3Client:
|
|
|
737
833
|
|
|
738
834
|
Examples
|
|
739
835
|
--------
|
|
740
|
-
|
|
836
|
+
import asyncio
|
|
837
|
+
|
|
838
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
741
839
|
|
|
742
840
|
client = AsyncLabelStudio(
|
|
743
841
|
api_key="YOUR_API_KEY",
|
|
744
842
|
)
|
|
745
|
-
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
async def main() -> None:
|
|
846
|
+
await client.export_storage.s3.validate()
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
asyncio.run(main())
|
|
746
850
|
"""
|
|
747
851
|
_response = await self._client_wrapper.httpx_client.request(
|
|
748
852
|
"api/storages/export/s3/validate",
|
|
@@ -762,6 +866,9 @@ class AsyncS3Client:
|
|
|
762
866
|
"region_name": region_name,
|
|
763
867
|
"s3_endpoint": s3endpoint,
|
|
764
868
|
},
|
|
869
|
+
headers={
|
|
870
|
+
"content-type": "application/json",
|
|
871
|
+
},
|
|
765
872
|
request_options=request_options,
|
|
766
873
|
omit=OMIT,
|
|
767
874
|
)
|
|
@@ -775,6 +882,7 @@ class AsyncS3Client:
|
|
|
775
882
|
|
|
776
883
|
async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3ExportStorage:
|
|
777
884
|
"""
|
|
885
|
+
|
|
778
886
|
Get a specific S3 export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
|
|
779
887
|
|
|
780
888
|
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
@@ -794,21 +902,37 @@ class AsyncS3Client:
|
|
|
794
902
|
|
|
795
903
|
Examples
|
|
796
904
|
--------
|
|
797
|
-
|
|
905
|
+
import asyncio
|
|
906
|
+
|
|
907
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
798
908
|
|
|
799
909
|
client = AsyncLabelStudio(
|
|
800
910
|
api_key="YOUR_API_KEY",
|
|
801
911
|
)
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
)
|
|
912
|
+
|
|
913
|
+
|
|
914
|
+
async def main() -> None:
|
|
915
|
+
await client.export_storage.s3.get(
|
|
916
|
+
id=1,
|
|
917
|
+
)
|
|
918
|
+
|
|
919
|
+
|
|
920
|
+
asyncio.run(main())
|
|
805
921
|
"""
|
|
806
922
|
_response = await self._client_wrapper.httpx_client.request(
|
|
807
|
-
f"api/storages/export/s3/{jsonable_encoder(id)}",
|
|
923
|
+
f"api/storages/export/s3/{jsonable_encoder(id)}",
|
|
924
|
+
method="GET",
|
|
925
|
+
request_options=request_options,
|
|
808
926
|
)
|
|
809
927
|
try:
|
|
810
928
|
if 200 <= _response.status_code < 300:
|
|
811
|
-
return
|
|
929
|
+
return typing.cast(
|
|
930
|
+
S3ExportStorage,
|
|
931
|
+
parse_obj_as(
|
|
932
|
+
type_=S3ExportStorage, # type: ignore
|
|
933
|
+
object_=_response.json(),
|
|
934
|
+
),
|
|
935
|
+
)
|
|
812
936
|
_response_json = _response.json()
|
|
813
937
|
except JSONDecodeError:
|
|
814
938
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -816,6 +940,7 @@ class AsyncS3Client:
|
|
|
816
940
|
|
|
817
941
|
async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
818
942
|
"""
|
|
943
|
+
|
|
819
944
|
Delete a specific S3 export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
|
|
820
945
|
|
|
821
946
|
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.
|
|
@@ -834,17 +959,27 @@ class AsyncS3Client:
|
|
|
834
959
|
|
|
835
960
|
Examples
|
|
836
961
|
--------
|
|
837
|
-
|
|
962
|
+
import asyncio
|
|
963
|
+
|
|
964
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
838
965
|
|
|
839
966
|
client = AsyncLabelStudio(
|
|
840
967
|
api_key="YOUR_API_KEY",
|
|
841
968
|
)
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
)
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
async def main() -> None:
|
|
972
|
+
await client.export_storage.s3.delete(
|
|
973
|
+
id=1,
|
|
974
|
+
)
|
|
975
|
+
|
|
976
|
+
|
|
977
|
+
asyncio.run(main())
|
|
845
978
|
"""
|
|
846
979
|
_response = await self._client_wrapper.httpx_client.request(
|
|
847
|
-
f"api/storages/export/s3/{jsonable_encoder(id)}",
|
|
980
|
+
f"api/storages/export/s3/{jsonable_encoder(id)}",
|
|
981
|
+
method="DELETE",
|
|
982
|
+
request_options=request_options,
|
|
848
983
|
)
|
|
849
984
|
try:
|
|
850
985
|
if 200 <= _response.status_code < 300:
|
|
@@ -873,6 +1008,7 @@ class AsyncS3Client:
|
|
|
873
1008
|
request_options: typing.Optional[RequestOptions] = None,
|
|
874
1009
|
) -> S3UpdateResponse:
|
|
875
1010
|
"""
|
|
1011
|
+
|
|
876
1012
|
Update a specific S3 export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
|
|
877
1013
|
|
|
878
1014
|
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
@@ -928,14 +1064,22 @@ class AsyncS3Client:
|
|
|
928
1064
|
|
|
929
1065
|
Examples
|
|
930
1066
|
--------
|
|
931
|
-
|
|
1067
|
+
import asyncio
|
|
1068
|
+
|
|
1069
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
932
1070
|
|
|
933
1071
|
client = AsyncLabelStudio(
|
|
934
1072
|
api_key="YOUR_API_KEY",
|
|
935
1073
|
)
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
)
|
|
1074
|
+
|
|
1075
|
+
|
|
1076
|
+
async def main() -> None:
|
|
1077
|
+
await client.export_storage.s3.update(
|
|
1078
|
+
id=1,
|
|
1079
|
+
)
|
|
1080
|
+
|
|
1081
|
+
|
|
1082
|
+
asyncio.run(main())
|
|
939
1083
|
"""
|
|
940
1084
|
_response = await self._client_wrapper.httpx_client.request(
|
|
941
1085
|
f"api/storages/export/s3/{jsonable_encoder(id)}",
|
|
@@ -954,19 +1098,29 @@ class AsyncS3Client:
|
|
|
954
1098
|
"region_name": region_name,
|
|
955
1099
|
"s3_endpoint": s3endpoint,
|
|
956
1100
|
},
|
|
1101
|
+
headers={
|
|
1102
|
+
"content-type": "application/json",
|
|
1103
|
+
},
|
|
957
1104
|
request_options=request_options,
|
|
958
1105
|
omit=OMIT,
|
|
959
1106
|
)
|
|
960
1107
|
try:
|
|
961
1108
|
if 200 <= _response.status_code < 300:
|
|
962
|
-
return
|
|
1109
|
+
return typing.cast(
|
|
1110
|
+
S3UpdateResponse,
|
|
1111
|
+
parse_obj_as(
|
|
1112
|
+
type_=S3UpdateResponse, # type: ignore
|
|
1113
|
+
object_=_response.json(),
|
|
1114
|
+
),
|
|
1115
|
+
)
|
|
963
1116
|
_response_json = _response.json()
|
|
964
1117
|
except JSONDecodeError:
|
|
965
1118
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
966
1119
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
967
1120
|
|
|
968
|
-
async def sync(self, id:
|
|
1121
|
+
async def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3ExportStorage:
|
|
969
1122
|
"""
|
|
1123
|
+
|
|
970
1124
|
Sync tasks to an S3 export/target storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
|
|
971
1125
|
|
|
972
1126
|
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.
|
|
@@ -975,7 +1129,7 @@ class AsyncS3Client:
|
|
|
975
1129
|
|
|
976
1130
|
Parameters
|
|
977
1131
|
----------
|
|
978
|
-
id :
|
|
1132
|
+
id : int
|
|
979
1133
|
|
|
980
1134
|
request_options : typing.Optional[RequestOptions]
|
|
981
1135
|
Request-specific configuration.
|
|
@@ -987,21 +1141,37 @@ class AsyncS3Client:
|
|
|
987
1141
|
|
|
988
1142
|
Examples
|
|
989
1143
|
--------
|
|
990
|
-
|
|
1144
|
+
import asyncio
|
|
1145
|
+
|
|
1146
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
991
1147
|
|
|
992
1148
|
client = AsyncLabelStudio(
|
|
993
1149
|
api_key="YOUR_API_KEY",
|
|
994
1150
|
)
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
)
|
|
1151
|
+
|
|
1152
|
+
|
|
1153
|
+
async def main() -> None:
|
|
1154
|
+
await client.export_storage.s3.sync(
|
|
1155
|
+
id=1,
|
|
1156
|
+
)
|
|
1157
|
+
|
|
1158
|
+
|
|
1159
|
+
asyncio.run(main())
|
|
998
1160
|
"""
|
|
999
1161
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1000
|
-
f"api/storages/export/s3/{jsonable_encoder(id)}/sync",
|
|
1162
|
+
f"api/storages/export/s3/{jsonable_encoder(id)}/sync",
|
|
1163
|
+
method="POST",
|
|
1164
|
+
request_options=request_options,
|
|
1001
1165
|
)
|
|
1002
1166
|
try:
|
|
1003
1167
|
if 200 <= _response.status_code < 300:
|
|
1004
|
-
return
|
|
1168
|
+
return typing.cast(
|
|
1169
|
+
S3ExportStorage,
|
|
1170
|
+
parse_obj_as(
|
|
1171
|
+
type_=S3ExportStorage, # type: ignore
|
|
1172
|
+
object_=_response.json(),
|
|
1173
|
+
),
|
|
1174
|
+
)
|
|
1005
1175
|
_response_json = _response.json()
|
|
1006
1176
|
except JSONDecodeError:
|
|
1007
1177
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|