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.local_files_export_storage import LocalFilesExportStorage
|
|
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.local_create_response import LocalCreateResponse
|
|
11
|
+
from ...core.jsonable_encoder import jsonable_encoder
|
|
13
12
|
from .types.local_update_response import LocalUpdateResponse
|
|
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 LocalClient:
|
|
|
24
24
|
self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
25
25
|
) -> typing.List[LocalFilesExportStorage]:
|
|
26
26
|
"""
|
|
27
|
+
|
|
27
28
|
You can connect a local file directory to Label Studio as a source storage or target storage. Use this API request to get a list of all local file 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 LocalClient:
|
|
|
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 LocalClient:
|
|
|
53
54
|
client.export_storage.local.list()
|
|
54
55
|
"""
|
|
55
56
|
_response = self._client_wrapper.httpx_client.request(
|
|
56
|
-
"api/storages/export/localfiles",
|
|
57
|
+
"api/storages/export/localfiles",
|
|
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[LocalFilesExportStorage],
|
|
68
|
+
parse_obj_as(
|
|
69
|
+
type_=typing.List[LocalFilesExportStorage], # 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)
|
|
@@ -75,6 +87,7 @@ class LocalClient:
|
|
|
75
87
|
request_options: typing.Optional[RequestOptions] = None,
|
|
76
88
|
) -> LocalCreateResponse:
|
|
77
89
|
"""
|
|
90
|
+
|
|
78
91
|
Create a new target storage connection to a local file directory.
|
|
79
92
|
|
|
80
93
|
For information about the required fields and prerequisites, see [Local storage](https://labelstud.io/guide/storage#Local-storage) in the Label Studio documentation.
|
|
@@ -111,7 +124,7 @@ class LocalClient:
|
|
|
111
124
|
|
|
112
125
|
Examples
|
|
113
126
|
--------
|
|
114
|
-
from label_studio_sdk
|
|
127
|
+
from label_studio_sdk import LabelStudio
|
|
115
128
|
|
|
116
129
|
client = LabelStudio(
|
|
117
130
|
api_key="YOUR_API_KEY",
|
|
@@ -129,12 +142,21 @@ class LocalClient:
|
|
|
129
142
|
"regex_filter": regex_filter,
|
|
130
143
|
"use_blob_urls": use_blob_urls,
|
|
131
144
|
},
|
|
145
|
+
headers={
|
|
146
|
+
"content-type": "application/json",
|
|
147
|
+
},
|
|
132
148
|
request_options=request_options,
|
|
133
149
|
omit=OMIT,
|
|
134
150
|
)
|
|
135
151
|
try:
|
|
136
152
|
if 200 <= _response.status_code < 300:
|
|
137
|
-
return
|
|
153
|
+
return typing.cast(
|
|
154
|
+
LocalCreateResponse,
|
|
155
|
+
parse_obj_as(
|
|
156
|
+
type_=LocalCreateResponse, # type: ignore
|
|
157
|
+
object_=_response.json(),
|
|
158
|
+
),
|
|
159
|
+
)
|
|
138
160
|
_response_json = _response.json()
|
|
139
161
|
except JSONDecodeError:
|
|
140
162
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -153,6 +175,7 @@ class LocalClient:
|
|
|
153
175
|
request_options: typing.Optional[RequestOptions] = None,
|
|
154
176
|
) -> None:
|
|
155
177
|
"""
|
|
178
|
+
|
|
156
179
|
Validate a specific local file export storage connection. This is useful to ensure that the storage configuration settings are correct and operational before attempting to export data.
|
|
157
180
|
|
|
158
181
|
Parameters
|
|
@@ -187,7 +210,7 @@ class LocalClient:
|
|
|
187
210
|
|
|
188
211
|
Examples
|
|
189
212
|
--------
|
|
190
|
-
from label_studio_sdk
|
|
213
|
+
from label_studio_sdk import LabelStudio
|
|
191
214
|
|
|
192
215
|
client = LabelStudio(
|
|
193
216
|
api_key="YOUR_API_KEY",
|
|
@@ -206,6 +229,9 @@ class LocalClient:
|
|
|
206
229
|
"regex_filter": regex_filter,
|
|
207
230
|
"use_blob_urls": use_blob_urls,
|
|
208
231
|
},
|
|
232
|
+
headers={
|
|
233
|
+
"content-type": "application/json",
|
|
234
|
+
},
|
|
209
235
|
request_options=request_options,
|
|
210
236
|
omit=OMIT,
|
|
211
237
|
)
|
|
@@ -219,6 +245,7 @@ class LocalClient:
|
|
|
219
245
|
|
|
220
246
|
def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> LocalFilesExportStorage:
|
|
221
247
|
"""
|
|
248
|
+
|
|
222
249
|
Get a specific local file export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
|
|
223
250
|
|
|
224
251
|
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
@@ -238,7 +265,7 @@ class LocalClient:
|
|
|
238
265
|
|
|
239
266
|
Examples
|
|
240
267
|
--------
|
|
241
|
-
from label_studio_sdk
|
|
268
|
+
from label_studio_sdk import LabelStudio
|
|
242
269
|
|
|
243
270
|
client = LabelStudio(
|
|
244
271
|
api_key="YOUR_API_KEY",
|
|
@@ -248,11 +275,19 @@ class LocalClient:
|
|
|
248
275
|
)
|
|
249
276
|
"""
|
|
250
277
|
_response = self._client_wrapper.httpx_client.request(
|
|
251
|
-
f"api/storages/export/localfiles/{jsonable_encoder(id)}",
|
|
278
|
+
f"api/storages/export/localfiles/{jsonable_encoder(id)}",
|
|
279
|
+
method="GET",
|
|
280
|
+
request_options=request_options,
|
|
252
281
|
)
|
|
253
282
|
try:
|
|
254
283
|
if 200 <= _response.status_code < 300:
|
|
255
|
-
return
|
|
284
|
+
return typing.cast(
|
|
285
|
+
LocalFilesExportStorage,
|
|
286
|
+
parse_obj_as(
|
|
287
|
+
type_=LocalFilesExportStorage, # type: ignore
|
|
288
|
+
object_=_response.json(),
|
|
289
|
+
),
|
|
290
|
+
)
|
|
256
291
|
_response_json = _response.json()
|
|
257
292
|
except JSONDecodeError:
|
|
258
293
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -260,6 +295,7 @@ class LocalClient:
|
|
|
260
295
|
|
|
261
296
|
def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
262
297
|
"""
|
|
298
|
+
|
|
263
299
|
Delete a specific local file export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
|
|
264
300
|
|
|
265
301
|
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.
|
|
@@ -278,7 +314,7 @@ class LocalClient:
|
|
|
278
314
|
|
|
279
315
|
Examples
|
|
280
316
|
--------
|
|
281
|
-
from label_studio_sdk
|
|
317
|
+
from label_studio_sdk import LabelStudio
|
|
282
318
|
|
|
283
319
|
client = LabelStudio(
|
|
284
320
|
api_key="YOUR_API_KEY",
|
|
@@ -288,7 +324,9 @@ class LocalClient:
|
|
|
288
324
|
)
|
|
289
325
|
"""
|
|
290
326
|
_response = self._client_wrapper.httpx_client.request(
|
|
291
|
-
f"api/storages/export/localfiles/{jsonable_encoder(id)}",
|
|
327
|
+
f"api/storages/export/localfiles/{jsonable_encoder(id)}",
|
|
328
|
+
method="DELETE",
|
|
329
|
+
request_options=request_options,
|
|
292
330
|
)
|
|
293
331
|
try:
|
|
294
332
|
if 200 <= _response.status_code < 300:
|
|
@@ -311,6 +349,7 @@ class LocalClient:
|
|
|
311
349
|
request_options: typing.Optional[RequestOptions] = None,
|
|
312
350
|
) -> LocalUpdateResponse:
|
|
313
351
|
"""
|
|
352
|
+
|
|
314
353
|
Update a specific local file export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
|
|
315
354
|
|
|
316
355
|
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
@@ -348,7 +387,7 @@ class LocalClient:
|
|
|
348
387
|
|
|
349
388
|
Examples
|
|
350
389
|
--------
|
|
351
|
-
from label_studio_sdk
|
|
390
|
+
from label_studio_sdk import LabelStudio
|
|
352
391
|
|
|
353
392
|
client = LabelStudio(
|
|
354
393
|
api_key="YOUR_API_KEY",
|
|
@@ -368,19 +407,29 @@ class LocalClient:
|
|
|
368
407
|
"regex_filter": regex_filter,
|
|
369
408
|
"use_blob_urls": use_blob_urls,
|
|
370
409
|
},
|
|
410
|
+
headers={
|
|
411
|
+
"content-type": "application/json",
|
|
412
|
+
},
|
|
371
413
|
request_options=request_options,
|
|
372
414
|
omit=OMIT,
|
|
373
415
|
)
|
|
374
416
|
try:
|
|
375
417
|
if 200 <= _response.status_code < 300:
|
|
376
|
-
return
|
|
418
|
+
return typing.cast(
|
|
419
|
+
LocalUpdateResponse,
|
|
420
|
+
parse_obj_as(
|
|
421
|
+
type_=LocalUpdateResponse, # type: ignore
|
|
422
|
+
object_=_response.json(),
|
|
423
|
+
),
|
|
424
|
+
)
|
|
377
425
|
_response_json = _response.json()
|
|
378
426
|
except JSONDecodeError:
|
|
379
427
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
380
428
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
381
429
|
|
|
382
|
-
def sync(self, id:
|
|
430
|
+
def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> LocalFilesExportStorage:
|
|
383
431
|
"""
|
|
432
|
+
|
|
384
433
|
Sync tasks to an local file export/target storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
|
|
385
434
|
|
|
386
435
|
Sync operations with external local file directories only go one way. They either create tasks from objects in the directory (source/import storage) or push annotations to the output directory (export/target storage). Changing something on the local file side doesn’t guarantee consistency in results.
|
|
@@ -389,7 +438,7 @@ class LocalClient:
|
|
|
389
438
|
|
|
390
439
|
Parameters
|
|
391
440
|
----------
|
|
392
|
-
id :
|
|
441
|
+
id : int
|
|
393
442
|
|
|
394
443
|
request_options : typing.Optional[RequestOptions]
|
|
395
444
|
Request-specific configuration.
|
|
@@ -401,13 +450,13 @@ class LocalClient:
|
|
|
401
450
|
|
|
402
451
|
Examples
|
|
403
452
|
--------
|
|
404
|
-
from label_studio_sdk
|
|
453
|
+
from label_studio_sdk import LabelStudio
|
|
405
454
|
|
|
406
455
|
client = LabelStudio(
|
|
407
456
|
api_key="YOUR_API_KEY",
|
|
408
457
|
)
|
|
409
458
|
client.export_storage.local.sync(
|
|
410
|
-
id=
|
|
459
|
+
id=1,
|
|
411
460
|
)
|
|
412
461
|
"""
|
|
413
462
|
_response = self._client_wrapper.httpx_client.request(
|
|
@@ -417,7 +466,13 @@ class LocalClient:
|
|
|
417
466
|
)
|
|
418
467
|
try:
|
|
419
468
|
if 200 <= _response.status_code < 300:
|
|
420
|
-
return
|
|
469
|
+
return typing.cast(
|
|
470
|
+
LocalFilesExportStorage,
|
|
471
|
+
parse_obj_as(
|
|
472
|
+
type_=LocalFilesExportStorage, # type: ignore
|
|
473
|
+
object_=_response.json(),
|
|
474
|
+
),
|
|
475
|
+
)
|
|
421
476
|
_response_json = _response.json()
|
|
422
477
|
except JSONDecodeError:
|
|
423
478
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -432,6 +487,7 @@ class AsyncLocalClient:
|
|
|
432
487
|
self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
433
488
|
) -> typing.List[LocalFilesExportStorage]:
|
|
434
489
|
"""
|
|
490
|
+
|
|
435
491
|
You can connect a local file directory to Label Studio as a source storage or target storage. Use this API request to get a list of all local file export (target) storage connections for a specific project.
|
|
436
492
|
|
|
437
493
|
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).
|
|
@@ -453,19 +509,38 @@ class AsyncLocalClient:
|
|
|
453
509
|
|
|
454
510
|
Examples
|
|
455
511
|
--------
|
|
456
|
-
|
|
512
|
+
import asyncio
|
|
513
|
+
|
|
514
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
457
515
|
|
|
458
516
|
client = AsyncLabelStudio(
|
|
459
517
|
api_key="YOUR_API_KEY",
|
|
460
518
|
)
|
|
461
|
-
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
async def main() -> None:
|
|
522
|
+
await client.export_storage.local.list()
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
asyncio.run(main())
|
|
462
526
|
"""
|
|
463
527
|
_response = await self._client_wrapper.httpx_client.request(
|
|
464
|
-
"api/storages/export/localfiles",
|
|
528
|
+
"api/storages/export/localfiles",
|
|
529
|
+
method="GET",
|
|
530
|
+
params={
|
|
531
|
+
"project": project,
|
|
532
|
+
},
|
|
533
|
+
request_options=request_options,
|
|
465
534
|
)
|
|
466
535
|
try:
|
|
467
536
|
if 200 <= _response.status_code < 300:
|
|
468
|
-
return
|
|
537
|
+
return typing.cast(
|
|
538
|
+
typing.List[LocalFilesExportStorage],
|
|
539
|
+
parse_obj_as(
|
|
540
|
+
type_=typing.List[LocalFilesExportStorage], # type: ignore
|
|
541
|
+
object_=_response.json(),
|
|
542
|
+
),
|
|
543
|
+
)
|
|
469
544
|
_response_json = _response.json()
|
|
470
545
|
except JSONDecodeError:
|
|
471
546
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -483,6 +558,7 @@ class AsyncLocalClient:
|
|
|
483
558
|
request_options: typing.Optional[RequestOptions] = None,
|
|
484
559
|
) -> LocalCreateResponse:
|
|
485
560
|
"""
|
|
561
|
+
|
|
486
562
|
Create a new target storage connection to a local file directory.
|
|
487
563
|
|
|
488
564
|
For information about the required fields and prerequisites, see [Local storage](https://labelstud.io/guide/storage#Local-storage) in the Label Studio documentation.
|
|
@@ -519,12 +595,20 @@ class AsyncLocalClient:
|
|
|
519
595
|
|
|
520
596
|
Examples
|
|
521
597
|
--------
|
|
522
|
-
|
|
598
|
+
import asyncio
|
|
599
|
+
|
|
600
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
523
601
|
|
|
524
602
|
client = AsyncLabelStudio(
|
|
525
603
|
api_key="YOUR_API_KEY",
|
|
526
604
|
)
|
|
527
|
-
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
async def main() -> None:
|
|
608
|
+
await client.export_storage.local.create()
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
asyncio.run(main())
|
|
528
612
|
"""
|
|
529
613
|
_response = await self._client_wrapper.httpx_client.request(
|
|
530
614
|
"api/storages/export/localfiles",
|
|
@@ -537,12 +621,21 @@ class AsyncLocalClient:
|
|
|
537
621
|
"regex_filter": regex_filter,
|
|
538
622
|
"use_blob_urls": use_blob_urls,
|
|
539
623
|
},
|
|
624
|
+
headers={
|
|
625
|
+
"content-type": "application/json",
|
|
626
|
+
},
|
|
540
627
|
request_options=request_options,
|
|
541
628
|
omit=OMIT,
|
|
542
629
|
)
|
|
543
630
|
try:
|
|
544
631
|
if 200 <= _response.status_code < 300:
|
|
545
|
-
return
|
|
632
|
+
return typing.cast(
|
|
633
|
+
LocalCreateResponse,
|
|
634
|
+
parse_obj_as(
|
|
635
|
+
type_=LocalCreateResponse, # type: ignore
|
|
636
|
+
object_=_response.json(),
|
|
637
|
+
),
|
|
638
|
+
)
|
|
546
639
|
_response_json = _response.json()
|
|
547
640
|
except JSONDecodeError:
|
|
548
641
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -561,6 +654,7 @@ class AsyncLocalClient:
|
|
|
561
654
|
request_options: typing.Optional[RequestOptions] = None,
|
|
562
655
|
) -> None:
|
|
563
656
|
"""
|
|
657
|
+
|
|
564
658
|
Validate a specific local file export storage connection. This is useful to ensure that the storage configuration settings are correct and operational before attempting to export data.
|
|
565
659
|
|
|
566
660
|
Parameters
|
|
@@ -595,12 +689,20 @@ class AsyncLocalClient:
|
|
|
595
689
|
|
|
596
690
|
Examples
|
|
597
691
|
--------
|
|
598
|
-
|
|
692
|
+
import asyncio
|
|
693
|
+
|
|
694
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
599
695
|
|
|
600
696
|
client = AsyncLabelStudio(
|
|
601
697
|
api_key="YOUR_API_KEY",
|
|
602
698
|
)
|
|
603
|
-
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
async def main() -> None:
|
|
702
|
+
await client.export_storage.local.validate()
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
asyncio.run(main())
|
|
604
706
|
"""
|
|
605
707
|
_response = await self._client_wrapper.httpx_client.request(
|
|
606
708
|
"api/storages/export/localfiles/validate",
|
|
@@ -614,6 +716,9 @@ class AsyncLocalClient:
|
|
|
614
716
|
"regex_filter": regex_filter,
|
|
615
717
|
"use_blob_urls": use_blob_urls,
|
|
616
718
|
},
|
|
719
|
+
headers={
|
|
720
|
+
"content-type": "application/json",
|
|
721
|
+
},
|
|
617
722
|
request_options=request_options,
|
|
618
723
|
omit=OMIT,
|
|
619
724
|
)
|
|
@@ -627,6 +732,7 @@ class AsyncLocalClient:
|
|
|
627
732
|
|
|
628
733
|
async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> LocalFilesExportStorage:
|
|
629
734
|
"""
|
|
735
|
+
|
|
630
736
|
Get a specific local file export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
|
|
631
737
|
|
|
632
738
|
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
@@ -646,21 +752,37 @@ class AsyncLocalClient:
|
|
|
646
752
|
|
|
647
753
|
Examples
|
|
648
754
|
--------
|
|
649
|
-
|
|
755
|
+
import asyncio
|
|
756
|
+
|
|
757
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
650
758
|
|
|
651
759
|
client = AsyncLabelStudio(
|
|
652
760
|
api_key="YOUR_API_KEY",
|
|
653
761
|
)
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
)
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
async def main() -> None:
|
|
765
|
+
await client.export_storage.local.get(
|
|
766
|
+
id=1,
|
|
767
|
+
)
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
asyncio.run(main())
|
|
657
771
|
"""
|
|
658
772
|
_response = await self._client_wrapper.httpx_client.request(
|
|
659
|
-
f"api/storages/export/localfiles/{jsonable_encoder(id)}",
|
|
773
|
+
f"api/storages/export/localfiles/{jsonable_encoder(id)}",
|
|
774
|
+
method="GET",
|
|
775
|
+
request_options=request_options,
|
|
660
776
|
)
|
|
661
777
|
try:
|
|
662
778
|
if 200 <= _response.status_code < 300:
|
|
663
|
-
return
|
|
779
|
+
return typing.cast(
|
|
780
|
+
LocalFilesExportStorage,
|
|
781
|
+
parse_obj_as(
|
|
782
|
+
type_=LocalFilesExportStorage, # type: ignore
|
|
783
|
+
object_=_response.json(),
|
|
784
|
+
),
|
|
785
|
+
)
|
|
664
786
|
_response_json = _response.json()
|
|
665
787
|
except JSONDecodeError:
|
|
666
788
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -668,6 +790,7 @@ class AsyncLocalClient:
|
|
|
668
790
|
|
|
669
791
|
async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
670
792
|
"""
|
|
793
|
+
|
|
671
794
|
Delete a specific local file export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
|
|
672
795
|
|
|
673
796
|
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.
|
|
@@ -686,17 +809,27 @@ class AsyncLocalClient:
|
|
|
686
809
|
|
|
687
810
|
Examples
|
|
688
811
|
--------
|
|
689
|
-
|
|
812
|
+
import asyncio
|
|
813
|
+
|
|
814
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
690
815
|
|
|
691
816
|
client = AsyncLabelStudio(
|
|
692
817
|
api_key="YOUR_API_KEY",
|
|
693
818
|
)
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
)
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
async def main() -> None:
|
|
822
|
+
await client.export_storage.local.delete(
|
|
823
|
+
id=1,
|
|
824
|
+
)
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
asyncio.run(main())
|
|
697
828
|
"""
|
|
698
829
|
_response = await self._client_wrapper.httpx_client.request(
|
|
699
|
-
f"api/storages/export/localfiles/{jsonable_encoder(id)}",
|
|
830
|
+
f"api/storages/export/localfiles/{jsonable_encoder(id)}",
|
|
831
|
+
method="DELETE",
|
|
832
|
+
request_options=request_options,
|
|
700
833
|
)
|
|
701
834
|
try:
|
|
702
835
|
if 200 <= _response.status_code < 300:
|
|
@@ -719,6 +852,7 @@ class AsyncLocalClient:
|
|
|
719
852
|
request_options: typing.Optional[RequestOptions] = None,
|
|
720
853
|
) -> LocalUpdateResponse:
|
|
721
854
|
"""
|
|
855
|
+
|
|
722
856
|
Update a specific local file export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
|
|
723
857
|
|
|
724
858
|
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
@@ -756,14 +890,22 @@ class AsyncLocalClient:
|
|
|
756
890
|
|
|
757
891
|
Examples
|
|
758
892
|
--------
|
|
759
|
-
|
|
893
|
+
import asyncio
|
|
894
|
+
|
|
895
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
760
896
|
|
|
761
897
|
client = AsyncLabelStudio(
|
|
762
898
|
api_key="YOUR_API_KEY",
|
|
763
899
|
)
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
)
|
|
900
|
+
|
|
901
|
+
|
|
902
|
+
async def main() -> None:
|
|
903
|
+
await client.export_storage.local.update(
|
|
904
|
+
id=1,
|
|
905
|
+
)
|
|
906
|
+
|
|
907
|
+
|
|
908
|
+
asyncio.run(main())
|
|
767
909
|
"""
|
|
768
910
|
_response = await self._client_wrapper.httpx_client.request(
|
|
769
911
|
f"api/storages/export/localfiles/{jsonable_encoder(id)}",
|
|
@@ -776,21 +918,31 @@ class AsyncLocalClient:
|
|
|
776
918
|
"regex_filter": regex_filter,
|
|
777
919
|
"use_blob_urls": use_blob_urls,
|
|
778
920
|
},
|
|
921
|
+
headers={
|
|
922
|
+
"content-type": "application/json",
|
|
923
|
+
},
|
|
779
924
|
request_options=request_options,
|
|
780
925
|
omit=OMIT,
|
|
781
926
|
)
|
|
782
927
|
try:
|
|
783
928
|
if 200 <= _response.status_code < 300:
|
|
784
|
-
return
|
|
929
|
+
return typing.cast(
|
|
930
|
+
LocalUpdateResponse,
|
|
931
|
+
parse_obj_as(
|
|
932
|
+
type_=LocalUpdateResponse, # type: ignore
|
|
933
|
+
object_=_response.json(),
|
|
934
|
+
),
|
|
935
|
+
)
|
|
785
936
|
_response_json = _response.json()
|
|
786
937
|
except JSONDecodeError:
|
|
787
938
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
788
939
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
789
940
|
|
|
790
941
|
async def sync(
|
|
791
|
-
self, id:
|
|
942
|
+
self, id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
792
943
|
) -> LocalFilesExportStorage:
|
|
793
944
|
"""
|
|
945
|
+
|
|
794
946
|
Sync tasks to an local file export/target storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
|
|
795
947
|
|
|
796
948
|
Sync operations with external local file directories only go one way. They either create tasks from objects in the directory (source/import storage) or push annotations to the output directory (export/target storage). Changing something on the local file side doesn’t guarantee consistency in results.
|
|
@@ -799,7 +951,7 @@ class AsyncLocalClient:
|
|
|
799
951
|
|
|
800
952
|
Parameters
|
|
801
953
|
----------
|
|
802
|
-
id :
|
|
954
|
+
id : int
|
|
803
955
|
|
|
804
956
|
request_options : typing.Optional[RequestOptions]
|
|
805
957
|
Request-specific configuration.
|
|
@@ -811,14 +963,22 @@ class AsyncLocalClient:
|
|
|
811
963
|
|
|
812
964
|
Examples
|
|
813
965
|
--------
|
|
814
|
-
|
|
966
|
+
import asyncio
|
|
967
|
+
|
|
968
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
815
969
|
|
|
816
970
|
client = AsyncLabelStudio(
|
|
817
971
|
api_key="YOUR_API_KEY",
|
|
818
972
|
)
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
)
|
|
973
|
+
|
|
974
|
+
|
|
975
|
+
async def main() -> None:
|
|
976
|
+
await client.export_storage.local.sync(
|
|
977
|
+
id=1,
|
|
978
|
+
)
|
|
979
|
+
|
|
980
|
+
|
|
981
|
+
asyncio.run(main())
|
|
822
982
|
"""
|
|
823
983
|
_response = await self._client_wrapper.httpx_client.request(
|
|
824
984
|
f"api/storages/export/localfiles/{jsonable_encoder(id)}/sync",
|
|
@@ -827,7 +987,13 @@ class AsyncLocalClient:
|
|
|
827
987
|
)
|
|
828
988
|
try:
|
|
829
989
|
if 200 <= _response.status_code < 300:
|
|
830
|
-
return
|
|
990
|
+
return typing.cast(
|
|
991
|
+
LocalFilesExportStorage,
|
|
992
|
+
parse_obj_as(
|
|
993
|
+
type_=LocalFilesExportStorage, # type: ignore
|
|
994
|
+
object_=_response.json(),
|
|
995
|
+
),
|
|
996
|
+
)
|
|
831
997
|
_response_json = _response.json()
|
|
832
998
|
except JSONDecodeError:
|
|
833
999
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|