label-studio-sdk 1.0.8__py3-none-any.whl → 1.0.11__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 +37 -8
- 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 +5 -0
- 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 +54 -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 +37 -19
- 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/__init__.py +3 -1
- label_studio_sdk/errors/bad_request_error.py +2 -3
- label_studio_sdk/errors/not_found_error.py +9 -0
- label_studio_sdk/errors/unauthorized_error.py +9 -0
- 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/jwt_settings/__init__.py +2 -0
- label_studio_sdk/jwt_settings/client.py +259 -0
- label_studio_sdk/label_interface/control_tags.py +16 -3
- label_studio_sdk/label_interface/interface.py +80 -1
- label_studio_sdk/label_interface/object_tags.py +2 -2
- 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 +5 -1
- label_studio_sdk/projects/client.py +313 -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 +200 -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/pauses/__init__.py +2 -0
- label_studio_sdk/projects/pauses/client.py +704 -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 +34 -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/tokens/__init__.py +2 -0
- label_studio_sdk/tokens/client.py +470 -0
- label_studio_sdk/tokens/client_ext.py +94 -0
- label_studio_sdk/types/__init__.py +20 -6
- label_studio_sdk/types/access_token_response.py +22 -0
- 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/api_token_response.py +32 -0
- 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/jwt_settings_response.py +32 -0
- 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/pause.py +34 -0
- label_studio_sdk/types/pause_paused_by.py +5 -0
- label_studio_sdk/types/prediction.py +21 -30
- label_studio_sdk/types/project.py +58 -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.11.dist-info}/METADATA +8 -5
- {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.11.dist-info}/RECORD +215 -188
- {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.11.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.11.dist-info}/LICENSE +0 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
3
|
import typing
|
|
4
|
-
from
|
|
5
|
-
|
|
6
|
-
from ...core.api_error import ApiError
|
|
7
|
-
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
|
-
from ...core.jsonable_encoder import jsonable_encoder
|
|
9
|
-
from ...core.pydantic_utilities import pydantic_v1
|
|
4
|
+
from ...core.client_wrapper import SyncClientWrapper
|
|
10
5
|
from ...core.request_options import RequestOptions
|
|
11
6
|
from ...types.gcs_import_storage import GcsImportStorage
|
|
7
|
+
from ...core.pydantic_utilities import parse_obj_as
|
|
8
|
+
from json.decoder import JSONDecodeError
|
|
9
|
+
from ...core.api_error import ApiError
|
|
12
10
|
from .types.gcs_create_response import GcsCreateResponse
|
|
11
|
+
from ...core.jsonable_encoder import jsonable_encoder
|
|
13
12
|
from .types.gcs_update_response import GcsUpdateResponse
|
|
13
|
+
from ...core.client_wrapper import AsyncClientWrapper
|
|
14
14
|
|
|
15
15
|
# this is used as the default value for optional parameters
|
|
16
16
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -24,6 +24,7 @@ class GcsClient:
|
|
|
24
24
|
self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
25
25
|
) -> typing.List[GcsImportStorage]:
|
|
26
26
|
"""
|
|
27
|
+
|
|
27
28
|
You can connect your Google Cloud Storage bucket to Label Studio as a source storage or target storage. Use this API request to get a list of all 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 GcsClient:
|
|
|
45
46
|
|
|
46
47
|
Examples
|
|
47
48
|
--------
|
|
48
|
-
from label_studio_sdk
|
|
49
|
+
from label_studio_sdk import LabelStudio
|
|
49
50
|
|
|
50
51
|
client = LabelStudio(
|
|
51
52
|
api_key="YOUR_API_KEY",
|
|
@@ -53,11 +54,22 @@ class GcsClient:
|
|
|
53
54
|
client.import_storage.gcs.list()
|
|
54
55
|
"""
|
|
55
56
|
_response = self._client_wrapper.httpx_client.request(
|
|
56
|
-
"api/storages/gcs/",
|
|
57
|
+
"api/storages/gcs/",
|
|
58
|
+
method="GET",
|
|
59
|
+
params={
|
|
60
|
+
"project": project,
|
|
61
|
+
},
|
|
62
|
+
request_options=request_options,
|
|
57
63
|
)
|
|
58
64
|
try:
|
|
59
65
|
if 200 <= _response.status_code < 300:
|
|
60
|
-
return
|
|
66
|
+
return typing.cast(
|
|
67
|
+
typing.List[GcsImportStorage],
|
|
68
|
+
parse_obj_as(
|
|
69
|
+
type_=typing.List[GcsImportStorage], # 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)
|
|
@@ -80,6 +92,7 @@ class GcsClient:
|
|
|
80
92
|
request_options: typing.Optional[RequestOptions] = None,
|
|
81
93
|
) -> GcsCreateResponse:
|
|
82
94
|
"""
|
|
95
|
+
|
|
83
96
|
Create a new source storage connection to a Google Cloud Storage bucket.
|
|
84
97
|
|
|
85
98
|
For information about the required fields and prerequisites, see [Google Cloud Storage](https://labelstud.io/guide/storage#Google-Cloud-Storage) in the Label Studio documentation.
|
|
@@ -133,7 +146,7 @@ class GcsClient:
|
|
|
133
146
|
|
|
134
147
|
Examples
|
|
135
148
|
--------
|
|
136
|
-
from label_studio_sdk
|
|
149
|
+
from label_studio_sdk import LabelStudio
|
|
137
150
|
|
|
138
151
|
client = LabelStudio(
|
|
139
152
|
api_key="YOUR_API_KEY",
|
|
@@ -156,12 +169,21 @@ class GcsClient:
|
|
|
156
169
|
"google_application_credentials": google_application_credentials,
|
|
157
170
|
"google_project_id": google_project_id,
|
|
158
171
|
},
|
|
172
|
+
headers={
|
|
173
|
+
"content-type": "application/json",
|
|
174
|
+
},
|
|
159
175
|
request_options=request_options,
|
|
160
176
|
omit=OMIT,
|
|
161
177
|
)
|
|
162
178
|
try:
|
|
163
179
|
if 200 <= _response.status_code < 300:
|
|
164
|
-
return
|
|
180
|
+
return typing.cast(
|
|
181
|
+
GcsCreateResponse,
|
|
182
|
+
parse_obj_as(
|
|
183
|
+
type_=GcsCreateResponse, # type: ignore
|
|
184
|
+
object_=_response.json(),
|
|
185
|
+
),
|
|
186
|
+
)
|
|
165
187
|
_response_json = _response.json()
|
|
166
188
|
except JSONDecodeError:
|
|
167
189
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -185,6 +207,7 @@ class GcsClient:
|
|
|
185
207
|
request_options: typing.Optional[RequestOptions] = None,
|
|
186
208
|
) -> None:
|
|
187
209
|
"""
|
|
210
|
+
|
|
188
211
|
Validate a specific GCS import storage connection. This is useful to ensure that the storage configuration settings are correct and operational before attempting to import data.
|
|
189
212
|
|
|
190
213
|
Parameters
|
|
@@ -234,7 +257,7 @@ class GcsClient:
|
|
|
234
257
|
|
|
235
258
|
Examples
|
|
236
259
|
--------
|
|
237
|
-
from label_studio_sdk
|
|
260
|
+
from label_studio_sdk import LabelStudio
|
|
238
261
|
|
|
239
262
|
client = LabelStudio(
|
|
240
263
|
api_key="YOUR_API_KEY",
|
|
@@ -258,6 +281,9 @@ class GcsClient:
|
|
|
258
281
|
"google_application_credentials": google_application_credentials,
|
|
259
282
|
"google_project_id": google_project_id,
|
|
260
283
|
},
|
|
284
|
+
headers={
|
|
285
|
+
"content-type": "application/json",
|
|
286
|
+
},
|
|
261
287
|
request_options=request_options,
|
|
262
288
|
omit=OMIT,
|
|
263
289
|
)
|
|
@@ -271,6 +297,7 @@ class GcsClient:
|
|
|
271
297
|
|
|
272
298
|
def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> GcsImportStorage:
|
|
273
299
|
"""
|
|
300
|
+
|
|
274
301
|
Get a specific GCS import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
275
302
|
|
|
276
303
|
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
@@ -290,7 +317,7 @@ class GcsClient:
|
|
|
290
317
|
|
|
291
318
|
Examples
|
|
292
319
|
--------
|
|
293
|
-
from label_studio_sdk
|
|
320
|
+
from label_studio_sdk import LabelStudio
|
|
294
321
|
|
|
295
322
|
client = LabelStudio(
|
|
296
323
|
api_key="YOUR_API_KEY",
|
|
@@ -300,11 +327,19 @@ class GcsClient:
|
|
|
300
327
|
)
|
|
301
328
|
"""
|
|
302
329
|
_response = self._client_wrapper.httpx_client.request(
|
|
303
|
-
f"api/storages/gcs/{jsonable_encoder(id)}",
|
|
330
|
+
f"api/storages/gcs/{jsonable_encoder(id)}",
|
|
331
|
+
method="GET",
|
|
332
|
+
request_options=request_options,
|
|
304
333
|
)
|
|
305
334
|
try:
|
|
306
335
|
if 200 <= _response.status_code < 300:
|
|
307
|
-
return
|
|
336
|
+
return typing.cast(
|
|
337
|
+
GcsImportStorage,
|
|
338
|
+
parse_obj_as(
|
|
339
|
+
type_=GcsImportStorage, # type: ignore
|
|
340
|
+
object_=_response.json(),
|
|
341
|
+
),
|
|
342
|
+
)
|
|
308
343
|
_response_json = _response.json()
|
|
309
344
|
except JSONDecodeError:
|
|
310
345
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -312,6 +347,7 @@ class GcsClient:
|
|
|
312
347
|
|
|
313
348
|
def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
314
349
|
"""
|
|
350
|
+
|
|
315
351
|
Delete a specific GCS import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
316
352
|
|
|
317
353
|
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.
|
|
@@ -332,7 +368,7 @@ class GcsClient:
|
|
|
332
368
|
|
|
333
369
|
Examples
|
|
334
370
|
--------
|
|
335
|
-
from label_studio_sdk
|
|
371
|
+
from label_studio_sdk import LabelStudio
|
|
336
372
|
|
|
337
373
|
client = LabelStudio(
|
|
338
374
|
api_key="YOUR_API_KEY",
|
|
@@ -342,7 +378,9 @@ class GcsClient:
|
|
|
342
378
|
)
|
|
343
379
|
"""
|
|
344
380
|
_response = self._client_wrapper.httpx_client.request(
|
|
345
|
-
f"api/storages/gcs/{jsonable_encoder(id)}",
|
|
381
|
+
f"api/storages/gcs/{jsonable_encoder(id)}",
|
|
382
|
+
method="DELETE",
|
|
383
|
+
request_options=request_options,
|
|
346
384
|
)
|
|
347
385
|
try:
|
|
348
386
|
if 200 <= _response.status_code < 300:
|
|
@@ -370,6 +408,7 @@ class GcsClient:
|
|
|
370
408
|
request_options: typing.Optional[RequestOptions] = None,
|
|
371
409
|
) -> GcsUpdateResponse:
|
|
372
410
|
"""
|
|
411
|
+
|
|
373
412
|
Update a specific GCS import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
374
413
|
|
|
375
414
|
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
@@ -422,7 +461,7 @@ class GcsClient:
|
|
|
422
461
|
|
|
423
462
|
Examples
|
|
424
463
|
--------
|
|
425
|
-
from label_studio_sdk
|
|
464
|
+
from label_studio_sdk import LabelStudio
|
|
426
465
|
|
|
427
466
|
client = LabelStudio(
|
|
428
467
|
api_key="YOUR_API_KEY",
|
|
@@ -447,12 +486,21 @@ class GcsClient:
|
|
|
447
486
|
"google_application_credentials": google_application_credentials,
|
|
448
487
|
"google_project_id": google_project_id,
|
|
449
488
|
},
|
|
489
|
+
headers={
|
|
490
|
+
"content-type": "application/json",
|
|
491
|
+
},
|
|
450
492
|
request_options=request_options,
|
|
451
493
|
omit=OMIT,
|
|
452
494
|
)
|
|
453
495
|
try:
|
|
454
496
|
if 200 <= _response.status_code < 300:
|
|
455
|
-
return
|
|
497
|
+
return typing.cast(
|
|
498
|
+
GcsUpdateResponse,
|
|
499
|
+
parse_obj_as(
|
|
500
|
+
type_=GcsUpdateResponse, # type: ignore
|
|
501
|
+
object_=_response.json(),
|
|
502
|
+
),
|
|
503
|
+
)
|
|
456
504
|
_response_json = _response.json()
|
|
457
505
|
except JSONDecodeError:
|
|
458
506
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -460,6 +508,7 @@ class GcsClient:
|
|
|
460
508
|
|
|
461
509
|
def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> GcsImportStorage:
|
|
462
510
|
"""
|
|
511
|
+
|
|
463
512
|
Sync tasks from a GCS import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
464
513
|
|
|
465
514
|
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.
|
|
@@ -481,7 +530,7 @@ class GcsClient:
|
|
|
481
530
|
|
|
482
531
|
Examples
|
|
483
532
|
--------
|
|
484
|
-
from label_studio_sdk
|
|
533
|
+
from label_studio_sdk import LabelStudio
|
|
485
534
|
|
|
486
535
|
client = LabelStudio(
|
|
487
536
|
api_key="YOUR_API_KEY",
|
|
@@ -491,11 +540,19 @@ class GcsClient:
|
|
|
491
540
|
)
|
|
492
541
|
"""
|
|
493
542
|
_response = self._client_wrapper.httpx_client.request(
|
|
494
|
-
f"api/storages/gcs/{jsonable_encoder(id)}/sync",
|
|
543
|
+
f"api/storages/gcs/{jsonable_encoder(id)}/sync",
|
|
544
|
+
method="POST",
|
|
545
|
+
request_options=request_options,
|
|
495
546
|
)
|
|
496
547
|
try:
|
|
497
548
|
if 200 <= _response.status_code < 300:
|
|
498
|
-
return
|
|
549
|
+
return typing.cast(
|
|
550
|
+
GcsImportStorage,
|
|
551
|
+
parse_obj_as(
|
|
552
|
+
type_=GcsImportStorage, # type: ignore
|
|
553
|
+
object_=_response.json(),
|
|
554
|
+
),
|
|
555
|
+
)
|
|
499
556
|
_response_json = _response.json()
|
|
500
557
|
except JSONDecodeError:
|
|
501
558
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -510,6 +567,7 @@ class AsyncGcsClient:
|
|
|
510
567
|
self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
511
568
|
) -> typing.List[GcsImportStorage]:
|
|
512
569
|
"""
|
|
570
|
+
|
|
513
571
|
You can connect your Google Cloud Storage bucket to Label Studio as a source storage or target storage. Use this API request to get a list of all Google import (source) storage connections for a specific project.
|
|
514
572
|
|
|
515
573
|
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).
|
|
@@ -531,19 +589,38 @@ class AsyncGcsClient:
|
|
|
531
589
|
|
|
532
590
|
Examples
|
|
533
591
|
--------
|
|
534
|
-
|
|
592
|
+
import asyncio
|
|
593
|
+
|
|
594
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
535
595
|
|
|
536
596
|
client = AsyncLabelStudio(
|
|
537
597
|
api_key="YOUR_API_KEY",
|
|
538
598
|
)
|
|
539
|
-
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
async def main() -> None:
|
|
602
|
+
await client.import_storage.gcs.list()
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
asyncio.run(main())
|
|
540
606
|
"""
|
|
541
607
|
_response = await self._client_wrapper.httpx_client.request(
|
|
542
|
-
"api/storages/gcs/",
|
|
608
|
+
"api/storages/gcs/",
|
|
609
|
+
method="GET",
|
|
610
|
+
params={
|
|
611
|
+
"project": project,
|
|
612
|
+
},
|
|
613
|
+
request_options=request_options,
|
|
543
614
|
)
|
|
544
615
|
try:
|
|
545
616
|
if 200 <= _response.status_code < 300:
|
|
546
|
-
return
|
|
617
|
+
return typing.cast(
|
|
618
|
+
typing.List[GcsImportStorage],
|
|
619
|
+
parse_obj_as(
|
|
620
|
+
type_=typing.List[GcsImportStorage], # type: ignore
|
|
621
|
+
object_=_response.json(),
|
|
622
|
+
),
|
|
623
|
+
)
|
|
547
624
|
_response_json = _response.json()
|
|
548
625
|
except JSONDecodeError:
|
|
549
626
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -566,6 +643,7 @@ class AsyncGcsClient:
|
|
|
566
643
|
request_options: typing.Optional[RequestOptions] = None,
|
|
567
644
|
) -> GcsCreateResponse:
|
|
568
645
|
"""
|
|
646
|
+
|
|
569
647
|
Create a new source storage connection to a Google Cloud Storage bucket.
|
|
570
648
|
|
|
571
649
|
For information about the required fields and prerequisites, see [Google Cloud Storage](https://labelstud.io/guide/storage#Google-Cloud-Storage) in the Label Studio documentation.
|
|
@@ -619,12 +697,20 @@ class AsyncGcsClient:
|
|
|
619
697
|
|
|
620
698
|
Examples
|
|
621
699
|
--------
|
|
622
|
-
|
|
700
|
+
import asyncio
|
|
701
|
+
|
|
702
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
623
703
|
|
|
624
704
|
client = AsyncLabelStudio(
|
|
625
705
|
api_key="YOUR_API_KEY",
|
|
626
706
|
)
|
|
627
|
-
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
async def main() -> None:
|
|
710
|
+
await client.import_storage.gcs.create()
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
asyncio.run(main())
|
|
628
714
|
"""
|
|
629
715
|
_response = await self._client_wrapper.httpx_client.request(
|
|
630
716
|
"api/storages/gcs/",
|
|
@@ -642,12 +728,21 @@ class AsyncGcsClient:
|
|
|
642
728
|
"google_application_credentials": google_application_credentials,
|
|
643
729
|
"google_project_id": google_project_id,
|
|
644
730
|
},
|
|
731
|
+
headers={
|
|
732
|
+
"content-type": "application/json",
|
|
733
|
+
},
|
|
645
734
|
request_options=request_options,
|
|
646
735
|
omit=OMIT,
|
|
647
736
|
)
|
|
648
737
|
try:
|
|
649
738
|
if 200 <= _response.status_code < 300:
|
|
650
|
-
return
|
|
739
|
+
return typing.cast(
|
|
740
|
+
GcsCreateResponse,
|
|
741
|
+
parse_obj_as(
|
|
742
|
+
type_=GcsCreateResponse, # type: ignore
|
|
743
|
+
object_=_response.json(),
|
|
744
|
+
),
|
|
745
|
+
)
|
|
651
746
|
_response_json = _response.json()
|
|
652
747
|
except JSONDecodeError:
|
|
653
748
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -671,6 +766,7 @@ class AsyncGcsClient:
|
|
|
671
766
|
request_options: typing.Optional[RequestOptions] = None,
|
|
672
767
|
) -> None:
|
|
673
768
|
"""
|
|
769
|
+
|
|
674
770
|
Validate a specific GCS import storage connection. This is useful to ensure that the storage configuration settings are correct and operational before attempting to import data.
|
|
675
771
|
|
|
676
772
|
Parameters
|
|
@@ -720,12 +816,20 @@ class AsyncGcsClient:
|
|
|
720
816
|
|
|
721
817
|
Examples
|
|
722
818
|
--------
|
|
723
|
-
|
|
819
|
+
import asyncio
|
|
820
|
+
|
|
821
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
724
822
|
|
|
725
823
|
client = AsyncLabelStudio(
|
|
726
824
|
api_key="YOUR_API_KEY",
|
|
727
825
|
)
|
|
728
|
-
|
|
826
|
+
|
|
827
|
+
|
|
828
|
+
async def main() -> None:
|
|
829
|
+
await client.import_storage.gcs.validate()
|
|
830
|
+
|
|
831
|
+
|
|
832
|
+
asyncio.run(main())
|
|
729
833
|
"""
|
|
730
834
|
_response = await self._client_wrapper.httpx_client.request(
|
|
731
835
|
"api/storages/gcs/validate",
|
|
@@ -744,6 +848,9 @@ class AsyncGcsClient:
|
|
|
744
848
|
"google_application_credentials": google_application_credentials,
|
|
745
849
|
"google_project_id": google_project_id,
|
|
746
850
|
},
|
|
851
|
+
headers={
|
|
852
|
+
"content-type": "application/json",
|
|
853
|
+
},
|
|
747
854
|
request_options=request_options,
|
|
748
855
|
omit=OMIT,
|
|
749
856
|
)
|
|
@@ -757,6 +864,7 @@ class AsyncGcsClient:
|
|
|
757
864
|
|
|
758
865
|
async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> GcsImportStorage:
|
|
759
866
|
"""
|
|
867
|
+
|
|
760
868
|
Get a specific GCS import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
761
869
|
|
|
762
870
|
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
@@ -776,21 +884,37 @@ class AsyncGcsClient:
|
|
|
776
884
|
|
|
777
885
|
Examples
|
|
778
886
|
--------
|
|
779
|
-
|
|
887
|
+
import asyncio
|
|
888
|
+
|
|
889
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
780
890
|
|
|
781
891
|
client = AsyncLabelStudio(
|
|
782
892
|
api_key="YOUR_API_KEY",
|
|
783
893
|
)
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
)
|
|
894
|
+
|
|
895
|
+
|
|
896
|
+
async def main() -> None:
|
|
897
|
+
await client.import_storage.gcs.get(
|
|
898
|
+
id=1,
|
|
899
|
+
)
|
|
900
|
+
|
|
901
|
+
|
|
902
|
+
asyncio.run(main())
|
|
787
903
|
"""
|
|
788
904
|
_response = await self._client_wrapper.httpx_client.request(
|
|
789
|
-
f"api/storages/gcs/{jsonable_encoder(id)}",
|
|
905
|
+
f"api/storages/gcs/{jsonable_encoder(id)}",
|
|
906
|
+
method="GET",
|
|
907
|
+
request_options=request_options,
|
|
790
908
|
)
|
|
791
909
|
try:
|
|
792
910
|
if 200 <= _response.status_code < 300:
|
|
793
|
-
return
|
|
911
|
+
return typing.cast(
|
|
912
|
+
GcsImportStorage,
|
|
913
|
+
parse_obj_as(
|
|
914
|
+
type_=GcsImportStorage, # type: ignore
|
|
915
|
+
object_=_response.json(),
|
|
916
|
+
),
|
|
917
|
+
)
|
|
794
918
|
_response_json = _response.json()
|
|
795
919
|
except JSONDecodeError:
|
|
796
920
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -798,6 +922,7 @@ class AsyncGcsClient:
|
|
|
798
922
|
|
|
799
923
|
async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
800
924
|
"""
|
|
925
|
+
|
|
801
926
|
Delete a specific GCS import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
802
927
|
|
|
803
928
|
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.
|
|
@@ -818,17 +943,27 @@ class AsyncGcsClient:
|
|
|
818
943
|
|
|
819
944
|
Examples
|
|
820
945
|
--------
|
|
821
|
-
|
|
946
|
+
import asyncio
|
|
947
|
+
|
|
948
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
822
949
|
|
|
823
950
|
client = AsyncLabelStudio(
|
|
824
951
|
api_key="YOUR_API_KEY",
|
|
825
952
|
)
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
)
|
|
953
|
+
|
|
954
|
+
|
|
955
|
+
async def main() -> None:
|
|
956
|
+
await client.import_storage.gcs.delete(
|
|
957
|
+
id=1,
|
|
958
|
+
)
|
|
959
|
+
|
|
960
|
+
|
|
961
|
+
asyncio.run(main())
|
|
829
962
|
"""
|
|
830
963
|
_response = await self._client_wrapper.httpx_client.request(
|
|
831
|
-
f"api/storages/gcs/{jsonable_encoder(id)}",
|
|
964
|
+
f"api/storages/gcs/{jsonable_encoder(id)}",
|
|
965
|
+
method="DELETE",
|
|
966
|
+
request_options=request_options,
|
|
832
967
|
)
|
|
833
968
|
try:
|
|
834
969
|
if 200 <= _response.status_code < 300:
|
|
@@ -856,6 +991,7 @@ class AsyncGcsClient:
|
|
|
856
991
|
request_options: typing.Optional[RequestOptions] = None,
|
|
857
992
|
) -> GcsUpdateResponse:
|
|
858
993
|
"""
|
|
994
|
+
|
|
859
995
|
Update a specific GCS import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
860
996
|
|
|
861
997
|
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
@@ -908,14 +1044,22 @@ class AsyncGcsClient:
|
|
|
908
1044
|
|
|
909
1045
|
Examples
|
|
910
1046
|
--------
|
|
911
|
-
|
|
1047
|
+
import asyncio
|
|
1048
|
+
|
|
1049
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
912
1050
|
|
|
913
1051
|
client = AsyncLabelStudio(
|
|
914
1052
|
api_key="YOUR_API_KEY",
|
|
915
1053
|
)
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
)
|
|
1054
|
+
|
|
1055
|
+
|
|
1056
|
+
async def main() -> None:
|
|
1057
|
+
await client.import_storage.gcs.update(
|
|
1058
|
+
id=1,
|
|
1059
|
+
)
|
|
1060
|
+
|
|
1061
|
+
|
|
1062
|
+
asyncio.run(main())
|
|
919
1063
|
"""
|
|
920
1064
|
_response = await self._client_wrapper.httpx_client.request(
|
|
921
1065
|
f"api/storages/gcs/{jsonable_encoder(id)}",
|
|
@@ -933,12 +1077,21 @@ class AsyncGcsClient:
|
|
|
933
1077
|
"google_application_credentials": google_application_credentials,
|
|
934
1078
|
"google_project_id": google_project_id,
|
|
935
1079
|
},
|
|
1080
|
+
headers={
|
|
1081
|
+
"content-type": "application/json",
|
|
1082
|
+
},
|
|
936
1083
|
request_options=request_options,
|
|
937
1084
|
omit=OMIT,
|
|
938
1085
|
)
|
|
939
1086
|
try:
|
|
940
1087
|
if 200 <= _response.status_code < 300:
|
|
941
|
-
return
|
|
1088
|
+
return typing.cast(
|
|
1089
|
+
GcsUpdateResponse,
|
|
1090
|
+
parse_obj_as(
|
|
1091
|
+
type_=GcsUpdateResponse, # type: ignore
|
|
1092
|
+
object_=_response.json(),
|
|
1093
|
+
),
|
|
1094
|
+
)
|
|
942
1095
|
_response_json = _response.json()
|
|
943
1096
|
except JSONDecodeError:
|
|
944
1097
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -946,6 +1099,7 @@ class AsyncGcsClient:
|
|
|
946
1099
|
|
|
947
1100
|
async def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> GcsImportStorage:
|
|
948
1101
|
"""
|
|
1102
|
+
|
|
949
1103
|
Sync tasks from a GCS import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
950
1104
|
|
|
951
1105
|
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.
|
|
@@ -967,21 +1121,37 @@ class AsyncGcsClient:
|
|
|
967
1121
|
|
|
968
1122
|
Examples
|
|
969
1123
|
--------
|
|
970
|
-
|
|
1124
|
+
import asyncio
|
|
1125
|
+
|
|
1126
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
971
1127
|
|
|
972
1128
|
client = AsyncLabelStudio(
|
|
973
1129
|
api_key="YOUR_API_KEY",
|
|
974
1130
|
)
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
)
|
|
1131
|
+
|
|
1132
|
+
|
|
1133
|
+
async def main() -> None:
|
|
1134
|
+
await client.import_storage.gcs.sync(
|
|
1135
|
+
id=1,
|
|
1136
|
+
)
|
|
1137
|
+
|
|
1138
|
+
|
|
1139
|
+
asyncio.run(main())
|
|
978
1140
|
"""
|
|
979
1141
|
_response = await self._client_wrapper.httpx_client.request(
|
|
980
|
-
f"api/storages/gcs/{jsonable_encoder(id)}/sync",
|
|
1142
|
+
f"api/storages/gcs/{jsonable_encoder(id)}/sync",
|
|
1143
|
+
method="POST",
|
|
1144
|
+
request_options=request_options,
|
|
981
1145
|
)
|
|
982
1146
|
try:
|
|
983
1147
|
if 200 <= _response.status_code < 300:
|
|
984
|
-
return
|
|
1148
|
+
return typing.cast(
|
|
1149
|
+
GcsImportStorage,
|
|
1150
|
+
parse_obj_as(
|
|
1151
|
+
type_=GcsImportStorage, # type: ignore
|
|
1152
|
+
object_=_response.json(),
|
|
1153
|
+
),
|
|
1154
|
+
)
|
|
985
1155
|
_response_json = _response.json()
|
|
986
1156
|
except JSONDecodeError:
|
|
987
1157
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|