label-studio-sdk 1.0.0__py3-none-any.whl → 1.0.1__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.

Files changed (87) hide show
  1. label_studio_sdk/__init__.py +30 -4
  2. label_studio_sdk/_extensions/pager_ext.py +49 -0
  3. label_studio_sdk/_legacy/objects.py +46 -7
  4. label_studio_sdk/_legacy/schema/label_config_schema.json +14 -14
  5. label_studio_sdk/actions/__init__.py +25 -0
  6. label_studio_sdk/actions/client.py +79 -6
  7. label_studio_sdk/actions/types/__init__.py +25 -0
  8. label_studio_sdk/actions/types/actions_create_request_filters.py +43 -0
  9. label_studio_sdk/actions/types/actions_create_request_filters_conjunction.py +5 -0
  10. label_studio_sdk/actions/types/actions_create_request_filters_items_item.py +49 -0
  11. label_studio_sdk/actions/types/actions_create_request_filters_items_item_filter.py +31 -0
  12. label_studio_sdk/actions/types/actions_create_request_filters_items_item_operator.py +23 -0
  13. label_studio_sdk/actions/types/actions_create_request_id.py +19 -0
  14. label_studio_sdk/actions/types/actions_create_request_ordering_item.py +31 -0
  15. label_studio_sdk/actions/types/actions_create_request_selected_items.py +10 -0
  16. label_studio_sdk/actions/types/actions_create_request_selected_items_excluded.py +39 -0
  17. label_studio_sdk/actions/types/actions_create_request_selected_items_included.py +39 -0
  18. label_studio_sdk/base_client.py +183 -0
  19. label_studio_sdk/client.py +17 -175
  20. label_studio_sdk/core/client_wrapper.py +1 -1
  21. label_studio_sdk/core/http_client.py +5 -1
  22. label_studio_sdk/export_storage/azure/client.py +176 -10
  23. label_studio_sdk/export_storage/azure/types/azure_create_response.py +15 -0
  24. label_studio_sdk/export_storage/azure/types/azure_update_response.py +15 -0
  25. label_studio_sdk/export_storage/gcs/client.py +180 -14
  26. label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +16 -1
  27. label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +16 -1
  28. label_studio_sdk/export_storage/local/client.py +168 -22
  29. label_studio_sdk/export_storage/local/types/local_create_response.py +12 -2
  30. label_studio_sdk/export_storage/local/types/local_update_response.py +12 -2
  31. label_studio_sdk/export_storage/redis/client.py +234 -30
  32. label_studio_sdk/export_storage/redis/types/redis_create_response.py +20 -5
  33. label_studio_sdk/export_storage/redis/types/redis_update_response.py +20 -5
  34. label_studio_sdk/export_storage/s3/client.py +214 -26
  35. label_studio_sdk/export_storage/s3/types/s3create_response.py +15 -0
  36. label_studio_sdk/export_storage/s3/types/s3update_response.py +15 -0
  37. label_studio_sdk/import_storage/azure/client.py +266 -90
  38. label_studio_sdk/import_storage/azure/types/azure_create_response.py +28 -18
  39. label_studio_sdk/import_storage/azure/types/azure_update_response.py +28 -18
  40. label_studio_sdk/import_storage/gcs/client.py +270 -94
  41. label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +28 -18
  42. label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +28 -18
  43. label_studio_sdk/import_storage/local/client.py +168 -22
  44. label_studio_sdk/import_storage/local/types/local_create_response.py +12 -2
  45. label_studio_sdk/import_storage/local/types/local_update_response.py +12 -2
  46. label_studio_sdk/import_storage/redis/client.py +206 -50
  47. label_studio_sdk/import_storage/redis/types/redis_create_response.py +20 -10
  48. label_studio_sdk/import_storage/redis/types/redis_update_response.py +20 -10
  49. label_studio_sdk/import_storage/s3/client.py +336 -110
  50. label_studio_sdk/import_storage/s3/types/s3create_response.py +35 -25
  51. label_studio_sdk/import_storage/s3/types/s3update_response.py +35 -25
  52. label_studio_sdk/{_legacy/label_interface → label_interface}/base.py +10 -0
  53. label_studio_sdk/{_legacy/label_interface → label_interface}/control_tags.py +109 -71
  54. label_studio_sdk/{_legacy/label_interface → label_interface}/interface.py +96 -50
  55. label_studio_sdk/{_legacy/label_interface → label_interface}/object_tags.py +8 -13
  56. label_studio_sdk/label_interface/region.py +75 -0
  57. label_studio_sdk/projects/client.py +4 -2
  58. label_studio_sdk/projects/client_ext.py +19 -0
  59. label_studio_sdk/tasks/client.py +26 -2
  60. label_studio_sdk/tasks/client_ext.py +18 -0
  61. label_studio_sdk/types/annotation.py +5 -5
  62. label_studio_sdk/types/task.py +1 -1
  63. label_studio_sdk/views/__init__.py +8 -4
  64. label_studio_sdk/views/types/__init__.py +8 -4
  65. label_studio_sdk/views/types/views_create_request_data.py +2 -2
  66. label_studio_sdk/views/types/views_create_request_data_filters.py +5 -5
  67. label_studio_sdk/views/types/views_create_request_data_filters_conjunction.py +1 -1
  68. label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +10 -8
  69. label_studio_sdk/views/types/views_create_request_data_filters_items_item_filter.py +31 -0
  70. label_studio_sdk/views/types/views_create_request_data_filters_items_item_operator.py +23 -0
  71. label_studio_sdk/views/types/views_create_request_data_ordering_item.py +27 -34
  72. label_studio_sdk/views/types/views_update_request_data.py +2 -2
  73. label_studio_sdk/views/types/views_update_request_data_filters.py +5 -5
  74. label_studio_sdk/views/types/views_update_request_data_filters_conjunction.py +1 -1
  75. label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +10 -8
  76. label_studio_sdk/views/types/views_update_request_data_filters_items_item_filter.py +31 -0
  77. label_studio_sdk/views/types/views_update_request_data_filters_items_item_operator.py +23 -0
  78. label_studio_sdk/views/types/views_update_request_data_ordering_item.py +27 -34
  79. {label_studio_sdk-1.0.0.dist-info → label_studio_sdk-1.0.1.dist-info}/METADATA +17 -161
  80. {label_studio_sdk-1.0.0.dist-info → label_studio_sdk-1.0.1.dist-info}/RECORD +84 -67
  81. label_studio_sdk/_legacy/label_interface/region.py +0 -43
  82. label_studio_sdk/views/types/views_create_request_data_ordering_item_direction.py +0 -5
  83. label_studio_sdk/views/types/views_update_request_data_ordering_item_direction.py +0 -5
  84. /label_studio_sdk/{_legacy/label_interface → label_interface}/__init__.py +0 -0
  85. /label_studio_sdk/{_legacy/label_interface → label_interface}/data_examples.json +0 -0
  86. /label_studio_sdk/{_legacy/label_interface → label_interface}/label_tags.py +0 -0
  87. {label_studio_sdk-1.0.0.dist-info → label_studio_sdk-1.0.1.dist-info}/WHEEL +0 -0
@@ -66,6 +66,9 @@ class S3Client:
66
66
  def create(
67
67
  self,
68
68
  *,
69
+ can_delete_objects: typing.Optional[bool] = OMIT,
70
+ title: typing.Optional[str] = OMIT,
71
+ description: typing.Optional[str] = OMIT,
69
72
  project: typing.Optional[int] = OMIT,
70
73
  bucket: typing.Optional[str] = OMIT,
71
74
  prefix: typing.Optional[str] = OMIT,
@@ -86,6 +89,15 @@ class S3Client:
86
89
 
87
90
  Parameters
88
91
  ----------
92
+ can_delete_objects : typing.Optional[bool]
93
+ Deletion from storage enabled.
94
+
95
+ title : typing.Optional[str]
96
+ Storage title
97
+
98
+ description : typing.Optional[str]
99
+ Storage description
100
+
89
101
  project : typing.Optional[int]
90
102
  Project ID
91
103
 
@@ -134,6 +146,9 @@ class S3Client:
134
146
  "api/storages/export/s3",
135
147
  method="POST",
136
148
  json={
149
+ "can_delete_objects": can_delete_objects,
150
+ "title": title,
151
+ "description": description,
137
152
  "project": project,
138
153
  "bucket": bucket,
139
154
  "prefix": prefix,
@@ -156,42 +171,106 @@ class S3Client:
156
171
  raise ApiError(status_code=_response.status_code, body=_response_json)
157
172
 
158
173
  def validate(
159
- self, *, request: S3ExportStorage, request_options: typing.Optional[RequestOptions] = None
160
- ) -> S3ExportStorage:
174
+ self,
175
+ *,
176
+ id: typing.Optional[int] = OMIT,
177
+ can_delete_objects: typing.Optional[bool] = OMIT,
178
+ title: typing.Optional[str] = OMIT,
179
+ description: typing.Optional[str] = OMIT,
180
+ project: typing.Optional[int] = OMIT,
181
+ bucket: typing.Optional[str] = OMIT,
182
+ prefix: typing.Optional[str] = OMIT,
183
+ aws_access_key_id: typing.Optional[str] = OMIT,
184
+ aws_secret_access_key: typing.Optional[str] = OMIT,
185
+ aws_session_token: typing.Optional[str] = OMIT,
186
+ aws_sse_kms_key_id: typing.Optional[str] = OMIT,
187
+ region_name: typing.Optional[str] = OMIT,
188
+ s3endpoint: typing.Optional[str] = OMIT,
189
+ request_options: typing.Optional[RequestOptions] = None,
190
+ ) -> None:
161
191
  """
162
192
  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.
163
193
 
164
194
  Parameters
165
195
  ----------
166
- request : S3ExportStorage
196
+ id : typing.Optional[int]
197
+ Storage ID. If set, storage with specified ID will be updated
198
+
199
+ can_delete_objects : typing.Optional[bool]
200
+ Deletion from storage enabled.
201
+
202
+ title : typing.Optional[str]
203
+ Storage title
204
+
205
+ description : typing.Optional[str]
206
+ Storage description
207
+
208
+ project : typing.Optional[int]
209
+ Project ID
210
+
211
+ bucket : typing.Optional[str]
212
+ S3 bucket name
213
+
214
+ prefix : typing.Optional[str]
215
+ S3 bucket prefix
216
+
217
+ aws_access_key_id : typing.Optional[str]
218
+ AWS_ACCESS_KEY_ID
219
+
220
+ aws_secret_access_key : typing.Optional[str]
221
+ AWS_SECRET_ACCESS_KEY
222
+
223
+ aws_session_token : typing.Optional[str]
224
+ AWS_SESSION_TOKEN
225
+
226
+ aws_sse_kms_key_id : typing.Optional[str]
227
+ AWS SSE KMS Key ID
228
+
229
+ region_name : typing.Optional[str]
230
+ AWS Region
231
+
232
+ s3endpoint : typing.Optional[str]
233
+ S3 Endpoint
167
234
 
168
235
  request_options : typing.Optional[RequestOptions]
169
236
  Request-specific configuration.
170
237
 
171
238
  Returns
172
239
  -------
173
- S3ExportStorage
174
-
240
+ None
175
241
 
176
242
  Examples
177
243
  --------
178
- from label_studio_sdk import S3ExportStorage
179
244
  from label_studio_sdk.client import LabelStudio
180
245
 
181
246
  client = LabelStudio(
182
247
  api_key="YOUR_API_KEY",
183
248
  )
184
- client.export_storage.s3.validate(
185
- request=S3ExportStorage(
186
- project=1,
187
- ),
188
- )
249
+ client.export_storage.s3.validate()
189
250
  """
190
251
  _response = self._client_wrapper.httpx_client.request(
191
- "api/storages/export/s3/validate", method="POST", json=request, request_options=request_options, omit=OMIT
252
+ "api/storages/export/s3/validate",
253
+ method="POST",
254
+ json={
255
+ "id": id,
256
+ "can_delete_objects": can_delete_objects,
257
+ "title": title,
258
+ "description": description,
259
+ "project": project,
260
+ "bucket": bucket,
261
+ "prefix": prefix,
262
+ "aws_access_key_id": aws_access_key_id,
263
+ "aws_secret_access_key": aws_secret_access_key,
264
+ "aws_session_token": aws_session_token,
265
+ "aws_sse_kms_key_id": aws_sse_kms_key_id,
266
+ "region_name": region_name,
267
+ "s3_endpoint": s3endpoint,
268
+ },
269
+ request_options=request_options,
270
+ omit=OMIT,
192
271
  )
193
272
  if 200 <= _response.status_code < 300:
194
- return pydantic_v1.parse_obj_as(S3ExportStorage, _response.json()) # type: ignore
273
+ return
195
274
  try:
196
275
  _response_json = _response.json()
197
276
  except JSONDecodeError:
@@ -283,6 +362,9 @@ class S3Client:
283
362
  self,
284
363
  id: int,
285
364
  *,
365
+ can_delete_objects: typing.Optional[bool] = OMIT,
366
+ title: typing.Optional[str] = OMIT,
367
+ description: typing.Optional[str] = OMIT,
286
368
  project: typing.Optional[int] = OMIT,
287
369
  bucket: typing.Optional[str] = OMIT,
288
370
  prefix: typing.Optional[str] = OMIT,
@@ -304,6 +386,15 @@ class S3Client:
304
386
  id : int
305
387
  A unique integer value identifying this s3 export storage.
306
388
 
389
+ can_delete_objects : typing.Optional[bool]
390
+ Deletion from storage enabled.
391
+
392
+ title : typing.Optional[str]
393
+ Storage title
394
+
395
+ description : typing.Optional[str]
396
+ Storage description
397
+
307
398
  project : typing.Optional[int]
308
399
  Project ID
309
400
 
@@ -354,6 +445,9 @@ class S3Client:
354
445
  f"api/storages/export/s3/{jsonable_encoder(id)}",
355
446
  method="PATCH",
356
447
  json={
448
+ "can_delete_objects": can_delete_objects,
449
+ "title": title,
450
+ "description": description,
357
451
  "project": project,
358
452
  "bucket": bucket,
359
453
  "prefix": prefix,
@@ -468,6 +562,9 @@ class AsyncS3Client:
468
562
  async def create(
469
563
  self,
470
564
  *,
565
+ can_delete_objects: typing.Optional[bool] = OMIT,
566
+ title: typing.Optional[str] = OMIT,
567
+ description: typing.Optional[str] = OMIT,
471
568
  project: typing.Optional[int] = OMIT,
472
569
  bucket: typing.Optional[str] = OMIT,
473
570
  prefix: typing.Optional[str] = OMIT,
@@ -488,6 +585,15 @@ class AsyncS3Client:
488
585
 
489
586
  Parameters
490
587
  ----------
588
+ can_delete_objects : typing.Optional[bool]
589
+ Deletion from storage enabled.
590
+
591
+ title : typing.Optional[str]
592
+ Storage title
593
+
594
+ description : typing.Optional[str]
595
+ Storage description
596
+
491
597
  project : typing.Optional[int]
492
598
  Project ID
493
599
 
@@ -536,6 +642,9 @@ class AsyncS3Client:
536
642
  "api/storages/export/s3",
537
643
  method="POST",
538
644
  json={
645
+ "can_delete_objects": can_delete_objects,
646
+ "title": title,
647
+ "description": description,
539
648
  "project": project,
540
649
  "bucket": bucket,
541
650
  "prefix": prefix,
@@ -558,42 +667,106 @@ class AsyncS3Client:
558
667
  raise ApiError(status_code=_response.status_code, body=_response_json)
559
668
 
560
669
  async def validate(
561
- self, *, request: S3ExportStorage, request_options: typing.Optional[RequestOptions] = None
562
- ) -> S3ExportStorage:
670
+ self,
671
+ *,
672
+ id: typing.Optional[int] = OMIT,
673
+ can_delete_objects: typing.Optional[bool] = OMIT,
674
+ title: typing.Optional[str] = OMIT,
675
+ description: typing.Optional[str] = OMIT,
676
+ project: typing.Optional[int] = OMIT,
677
+ bucket: typing.Optional[str] = OMIT,
678
+ prefix: typing.Optional[str] = OMIT,
679
+ aws_access_key_id: typing.Optional[str] = OMIT,
680
+ aws_secret_access_key: typing.Optional[str] = OMIT,
681
+ aws_session_token: typing.Optional[str] = OMIT,
682
+ aws_sse_kms_key_id: typing.Optional[str] = OMIT,
683
+ region_name: typing.Optional[str] = OMIT,
684
+ s3endpoint: typing.Optional[str] = OMIT,
685
+ request_options: typing.Optional[RequestOptions] = None,
686
+ ) -> None:
563
687
  """
564
688
  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.
565
689
 
566
690
  Parameters
567
691
  ----------
568
- request : S3ExportStorage
692
+ id : typing.Optional[int]
693
+ Storage ID. If set, storage with specified ID will be updated
694
+
695
+ can_delete_objects : typing.Optional[bool]
696
+ Deletion from storage enabled.
697
+
698
+ title : typing.Optional[str]
699
+ Storage title
700
+
701
+ description : typing.Optional[str]
702
+ Storage description
703
+
704
+ project : typing.Optional[int]
705
+ Project ID
706
+
707
+ bucket : typing.Optional[str]
708
+ S3 bucket name
709
+
710
+ prefix : typing.Optional[str]
711
+ S3 bucket prefix
712
+
713
+ aws_access_key_id : typing.Optional[str]
714
+ AWS_ACCESS_KEY_ID
715
+
716
+ aws_secret_access_key : typing.Optional[str]
717
+ AWS_SECRET_ACCESS_KEY
718
+
719
+ aws_session_token : typing.Optional[str]
720
+ AWS_SESSION_TOKEN
721
+
722
+ aws_sse_kms_key_id : typing.Optional[str]
723
+ AWS SSE KMS Key ID
724
+
725
+ region_name : typing.Optional[str]
726
+ AWS Region
727
+
728
+ s3endpoint : typing.Optional[str]
729
+ S3 Endpoint
569
730
 
570
731
  request_options : typing.Optional[RequestOptions]
571
732
  Request-specific configuration.
572
733
 
573
734
  Returns
574
735
  -------
575
- S3ExportStorage
576
-
736
+ None
577
737
 
578
738
  Examples
579
739
  --------
580
- from label_studio_sdk import S3ExportStorage
581
740
  from label_studio_sdk.client import AsyncLabelStudio
582
741
 
583
742
  client = AsyncLabelStudio(
584
743
  api_key="YOUR_API_KEY",
585
744
  )
586
- await client.export_storage.s3.validate(
587
- request=S3ExportStorage(
588
- project=1,
589
- ),
590
- )
745
+ await client.export_storage.s3.validate()
591
746
  """
592
747
  _response = await self._client_wrapper.httpx_client.request(
593
- "api/storages/export/s3/validate", method="POST", json=request, request_options=request_options, omit=OMIT
748
+ "api/storages/export/s3/validate",
749
+ method="POST",
750
+ json={
751
+ "id": id,
752
+ "can_delete_objects": can_delete_objects,
753
+ "title": title,
754
+ "description": description,
755
+ "project": project,
756
+ "bucket": bucket,
757
+ "prefix": prefix,
758
+ "aws_access_key_id": aws_access_key_id,
759
+ "aws_secret_access_key": aws_secret_access_key,
760
+ "aws_session_token": aws_session_token,
761
+ "aws_sse_kms_key_id": aws_sse_kms_key_id,
762
+ "region_name": region_name,
763
+ "s3_endpoint": s3endpoint,
764
+ },
765
+ request_options=request_options,
766
+ omit=OMIT,
594
767
  )
595
768
  if 200 <= _response.status_code < 300:
596
- return pydantic_v1.parse_obj_as(S3ExportStorage, _response.json()) # type: ignore
769
+ return
597
770
  try:
598
771
  _response_json = _response.json()
599
772
  except JSONDecodeError:
@@ -685,6 +858,9 @@ class AsyncS3Client:
685
858
  self,
686
859
  id: int,
687
860
  *,
861
+ can_delete_objects: typing.Optional[bool] = OMIT,
862
+ title: typing.Optional[str] = OMIT,
863
+ description: typing.Optional[str] = OMIT,
688
864
  project: typing.Optional[int] = OMIT,
689
865
  bucket: typing.Optional[str] = OMIT,
690
866
  prefix: typing.Optional[str] = OMIT,
@@ -706,6 +882,15 @@ class AsyncS3Client:
706
882
  id : int
707
883
  A unique integer value identifying this s3 export storage.
708
884
 
885
+ can_delete_objects : typing.Optional[bool]
886
+ Deletion from storage enabled.
887
+
888
+ title : typing.Optional[str]
889
+ Storage title
890
+
891
+ description : typing.Optional[str]
892
+ Storage description
893
+
709
894
  project : typing.Optional[int]
710
895
  Project ID
711
896
 
@@ -756,6 +941,9 @@ class AsyncS3Client:
756
941
  f"api/storages/export/s3/{jsonable_encoder(id)}",
757
942
  method="PATCH",
758
943
  json={
944
+ "can_delete_objects": can_delete_objects,
945
+ "title": title,
946
+ "description": description,
759
947
  "project": project,
760
948
  "bucket": bucket,
761
949
  "prefix": prefix,
@@ -8,6 +8,21 @@ from ....core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
8
8
 
9
9
 
10
10
  class S3CreateResponse(pydantic_v1.BaseModel):
11
+ can_delete_objects: typing.Optional[bool] = pydantic_v1.Field(default=None)
12
+ """
13
+ Deletion from storage enabled.
14
+ """
15
+
16
+ title: typing.Optional[str] = pydantic_v1.Field(default=None)
17
+ """
18
+ Storage title
19
+ """
20
+
21
+ description: typing.Optional[str] = pydantic_v1.Field(default=None)
22
+ """
23
+ Storage description
24
+ """
25
+
11
26
  project: typing.Optional[int] = pydantic_v1.Field(default=None)
12
27
  """
13
28
  Project ID
@@ -8,6 +8,21 @@ from ....core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
8
8
 
9
9
 
10
10
  class S3UpdateResponse(pydantic_v1.BaseModel):
11
+ can_delete_objects: typing.Optional[bool] = pydantic_v1.Field(default=None)
12
+ """
13
+ Deletion from storage enabled.
14
+ """
15
+
16
+ title: typing.Optional[str] = pydantic_v1.Field(default=None)
17
+ """
18
+ Storage title
19
+ """
20
+
21
+ description: typing.Optional[str] = pydantic_v1.Field(default=None)
22
+ """
23
+ Storage description
24
+ """
25
+
11
26
  project: typing.Optional[int] = pydantic_v1.Field(default=None)
12
27
  """
13
28
  Project ID