label-studio-sdk 1.0.3__py3-none-any.whl → 1.0.4__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 (57) hide show
  1. label_studio_sdk/__init__.py +10 -0
  2. label_studio_sdk/actions/client.py +8 -8
  3. label_studio_sdk/annotations/client.py +24 -24
  4. label_studio_sdk/base_client.py +3 -0
  5. label_studio_sdk/core/client_wrapper.py +1 -1
  6. label_studio_sdk/core/http_client.py +36 -8
  7. label_studio_sdk/core/request_options.py +2 -2
  8. label_studio_sdk/export_storage/__init__.py +2 -1
  9. label_studio_sdk/export_storage/azure/client.py +28 -28
  10. label_studio_sdk/export_storage/client.py +7 -4
  11. label_studio_sdk/export_storage/gcs/client.py +28 -28
  12. label_studio_sdk/export_storage/local/client.py +28 -28
  13. label_studio_sdk/export_storage/redis/client.py +28 -28
  14. label_studio_sdk/export_storage/s3/client.py +28 -28
  15. label_studio_sdk/export_storage/s3s/__init__.py +2 -0
  16. label_studio_sdk/export_storage/s3s/client.py +836 -0
  17. label_studio_sdk/files/client.py +24 -24
  18. label_studio_sdk/import_storage/__init__.py +2 -1
  19. label_studio_sdk/import_storage/azure/client.py +28 -28
  20. label_studio_sdk/import_storage/client.py +7 -4
  21. label_studio_sdk/import_storage/gcs/client.py +28 -28
  22. label_studio_sdk/import_storage/local/client.py +28 -28
  23. label_studio_sdk/import_storage/redis/client.py +28 -28
  24. label_studio_sdk/import_storage/s3/client.py +28 -28
  25. label_studio_sdk/import_storage/s3s/__init__.py +2 -0
  26. label_studio_sdk/import_storage/s3s/client.py +1054 -0
  27. label_studio_sdk/label_interface/base.py +2 -2
  28. label_studio_sdk/label_interface/control_tags.py +32 -18
  29. label_studio_sdk/label_interface/create.py +241 -0
  30. label_studio_sdk/label_interface/interface.py +68 -0
  31. label_studio_sdk/label_interface/object_tags.py +26 -10
  32. label_studio_sdk/label_interface/objects.py +5 -5
  33. label_studio_sdk/ml/client.py +36 -36
  34. label_studio_sdk/predictions/client.py +24 -24
  35. label_studio_sdk/projects/client.py +86 -56
  36. label_studio_sdk/projects/client_ext.py +16 -1
  37. label_studio_sdk/projects/exports/client.py +38 -38
  38. label_studio_sdk/tasks/client.py +70 -60
  39. label_studio_sdk/tasks/client_ext.py +4 -0
  40. label_studio_sdk/types/__init__.py +8 -0
  41. label_studio_sdk/types/s3s_export_storage.py +80 -0
  42. label_studio_sdk/types/s3s_import_storage.py +129 -0
  43. label_studio_sdk/types/s3s_import_storage_status.py +7 -0
  44. label_studio_sdk/types/workspace.py +77 -0
  45. label_studio_sdk/users/client.py +32 -32
  46. label_studio_sdk/views/client.py +24 -24
  47. label_studio_sdk/webhooks/client.py +24 -24
  48. label_studio_sdk/workspaces/__init__.py +6 -0
  49. label_studio_sdk/workspaces/client.py +569 -0
  50. label_studio_sdk/workspaces/members/__init__.py +5 -0
  51. label_studio_sdk/workspaces/members/client.py +297 -0
  52. label_studio_sdk/workspaces/members/types/__init__.py +6 -0
  53. label_studio_sdk/workspaces/members/types/members_create_response.py +32 -0
  54. label_studio_sdk/workspaces/members/types/members_list_response_item.py +32 -0
  55. {label_studio_sdk-1.0.3.dist-info → label_studio_sdk-1.0.4.dist-info}/METADATA +11 -12
  56. {label_studio_sdk-1.0.3.dist-info → label_studio_sdk-1.0.4.dist-info}/RECORD +57 -41
  57. {label_studio_sdk-1.0.3.dist-info → label_studio_sdk-1.0.4.dist-info}/WHEEL +0 -0
@@ -0,0 +1,6 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from . import members
4
+ from .members import MembersCreateResponse, MembersListResponseItem
5
+
6
+ __all__ = ["MembersCreateResponse", "MembersListResponseItem", "members"]
@@ -0,0 +1,569 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
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
10
+ from ..core.request_options import RequestOptions
11
+ from ..types.workspace import Workspace
12
+ from .members.client import AsyncMembersClient, MembersClient
13
+
14
+ # this is used as the default value for optional parameters
15
+ OMIT = typing.cast(typing.Any, ...)
16
+
17
+
18
+ class WorkspacesClient:
19
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
20
+ self._client_wrapper = client_wrapper
21
+ self.members = MembersClient(client_wrapper=self._client_wrapper)
22
+
23
+ def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[Workspace]:
24
+ """
25
+ List all workspaces for your organization.
26
+
27
+ Workspaces in Label Studio let you organize your projects and users into separate spaces. This is useful for managing different teams, departments, or projects within your organization.
28
+
29
+ For more information, see [Workspaces in Label Studio](https://docs.humansignal.com/guide/workspaces).
30
+
31
+ Parameters
32
+ ----------
33
+ request_options : typing.Optional[RequestOptions]
34
+ Request-specific configuration.
35
+
36
+ Returns
37
+ -------
38
+ typing.List[Workspace]
39
+
40
+
41
+ Examples
42
+ --------
43
+ from label_studio_sdk.client import LabelStudio
44
+
45
+ client = LabelStudio(
46
+ api_key="YOUR_API_KEY",
47
+ )
48
+ client.workspaces.list()
49
+ """
50
+ _response = self._client_wrapper.httpx_client.request(
51
+ "api/workspaces", method="GET", request_options=request_options
52
+ )
53
+ try:
54
+ if 200 <= _response.status_code < 300:
55
+ return pydantic_v1.parse_obj_as(typing.List[Workspace], _response.json()) # type: ignore
56
+ _response_json = _response.json()
57
+ except JSONDecodeError:
58
+ raise ApiError(status_code=_response.status_code, body=_response.text)
59
+ raise ApiError(status_code=_response.status_code, body=_response_json)
60
+
61
+ def create(
62
+ self,
63
+ *,
64
+ title: typing.Optional[str] = OMIT,
65
+ description: typing.Optional[str] = OMIT,
66
+ is_public: typing.Optional[bool] = OMIT,
67
+ is_personal: typing.Optional[bool] = OMIT,
68
+ is_archived: typing.Optional[bool] = OMIT,
69
+ color: typing.Optional[str] = OMIT,
70
+ request_options: typing.Optional[RequestOptions] = None,
71
+ ) -> Workspace:
72
+ """
73
+ Create a new workspace.
74
+
75
+ Workspaces in Label Studio let you organize your projects and users into separate spaces. This is useful for managing different teams, departments, or projects within your organization.
76
+
77
+ For more information, see [Workspaces in Label Studio](https://docs.humansignal.com/guide/workspaces).
78
+
79
+ Parameters
80
+ ----------
81
+ title : typing.Optional[str]
82
+ Workspace title
83
+
84
+ description : typing.Optional[str]
85
+ Workspace description
86
+
87
+ is_public : typing.Optional[bool]
88
+ Is workspace public
89
+
90
+ is_personal : typing.Optional[bool]
91
+ Is workspace personal
92
+
93
+ is_archived : typing.Optional[bool]
94
+ Is workspace archived
95
+
96
+ color : typing.Optional[str]
97
+ Workspace color in HEX format
98
+
99
+ request_options : typing.Optional[RequestOptions]
100
+ Request-specific configuration.
101
+
102
+ Returns
103
+ -------
104
+ Workspace
105
+
106
+
107
+ Examples
108
+ --------
109
+ from label_studio_sdk.client import LabelStudio
110
+
111
+ client = LabelStudio(
112
+ api_key="YOUR_API_KEY",
113
+ )
114
+ client.workspaces.create()
115
+ """
116
+ _response = self._client_wrapper.httpx_client.request(
117
+ "api/workspaces",
118
+ method="POST",
119
+ json={
120
+ "title": title,
121
+ "description": description,
122
+ "is_public": is_public,
123
+ "is_personal": is_personal,
124
+ "is_archived": is_archived,
125
+ "color": color,
126
+ },
127
+ request_options=request_options,
128
+ omit=OMIT,
129
+ )
130
+ try:
131
+ if 200 <= _response.status_code < 300:
132
+ return pydantic_v1.parse_obj_as(Workspace, _response.json()) # type: ignore
133
+ _response_json = _response.json()
134
+ except JSONDecodeError:
135
+ raise ApiError(status_code=_response.status_code, body=_response.text)
136
+ raise ApiError(status_code=_response.status_code, body=_response_json)
137
+
138
+ def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> Workspace:
139
+ """
140
+ Get information about a specific workspace. You will need to provide the workspace ID. You can find this using [List workspaces](list).
141
+
142
+ Parameters
143
+ ----------
144
+ id : int
145
+ Workspace ID
146
+
147
+ request_options : typing.Optional[RequestOptions]
148
+ Request-specific configuration.
149
+
150
+ Returns
151
+ -------
152
+ Workspace
153
+
154
+
155
+ Examples
156
+ --------
157
+ from label_studio_sdk.client import LabelStudio
158
+
159
+ client = LabelStudio(
160
+ api_key="YOUR_API_KEY",
161
+ )
162
+ client.workspaces.get(
163
+ id=1,
164
+ )
165
+ """
166
+ _response = self._client_wrapper.httpx_client.request(
167
+ f"api/workspaces/{jsonable_encoder(id)}", method="GET", request_options=request_options
168
+ )
169
+ try:
170
+ if 200 <= _response.status_code < 300:
171
+ return pydantic_v1.parse_obj_as(Workspace, _response.json()) # type: ignore
172
+ _response_json = _response.json()
173
+ except JSONDecodeError:
174
+ raise ApiError(status_code=_response.status_code, body=_response.text)
175
+ raise ApiError(status_code=_response.status_code, body=_response_json)
176
+
177
+ def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
178
+ """
179
+ Delete a specific workspace. You will need to provide the workspace ID. You can find this using [List workspaces](list).
180
+
181
+ Parameters
182
+ ----------
183
+ id : int
184
+ Workspace ID
185
+
186
+ request_options : typing.Optional[RequestOptions]
187
+ Request-specific configuration.
188
+
189
+ Returns
190
+ -------
191
+ None
192
+
193
+ Examples
194
+ --------
195
+ from label_studio_sdk.client import LabelStudio
196
+
197
+ client = LabelStudio(
198
+ api_key="YOUR_API_KEY",
199
+ )
200
+ client.workspaces.delete(
201
+ id=1,
202
+ )
203
+ """
204
+ _response = self._client_wrapper.httpx_client.request(
205
+ f"api/workspaces/{jsonable_encoder(id)}", method="DELETE", request_options=request_options
206
+ )
207
+ try:
208
+ if 200 <= _response.status_code < 300:
209
+ return
210
+ _response_json = _response.json()
211
+ except JSONDecodeError:
212
+ raise ApiError(status_code=_response.status_code, body=_response.text)
213
+ raise ApiError(status_code=_response.status_code, body=_response_json)
214
+
215
+ def update(
216
+ self,
217
+ id: int,
218
+ *,
219
+ title: typing.Optional[str] = OMIT,
220
+ description: typing.Optional[str] = OMIT,
221
+ is_public: typing.Optional[bool] = OMIT,
222
+ is_personal: typing.Optional[bool] = OMIT,
223
+ is_archived: typing.Optional[bool] = OMIT,
224
+ color: typing.Optional[str] = OMIT,
225
+ request_options: typing.Optional[RequestOptions] = None,
226
+ ) -> Workspace:
227
+ """
228
+ Update a specific workspace. You will need to provide the workspace ID. You can find this using [List workspaces](list).
229
+
230
+ Parameters
231
+ ----------
232
+ id : int
233
+ Workspace ID
234
+
235
+ title : typing.Optional[str]
236
+ Workspace title
237
+
238
+ description : typing.Optional[str]
239
+ Workspace description
240
+
241
+ is_public : typing.Optional[bool]
242
+ Is workspace public
243
+
244
+ is_personal : typing.Optional[bool]
245
+ Is workspace personal
246
+
247
+ is_archived : typing.Optional[bool]
248
+ Is workspace archived
249
+
250
+ color : typing.Optional[str]
251
+ Workspace color in HEX format
252
+
253
+ request_options : typing.Optional[RequestOptions]
254
+ Request-specific configuration.
255
+
256
+ Returns
257
+ -------
258
+ Workspace
259
+
260
+
261
+ Examples
262
+ --------
263
+ from label_studio_sdk.client import LabelStudio
264
+
265
+ client = LabelStudio(
266
+ api_key="YOUR_API_KEY",
267
+ )
268
+ client.workspaces.update(
269
+ id=1,
270
+ )
271
+ """
272
+ _response = self._client_wrapper.httpx_client.request(
273
+ f"api/workspaces/{jsonable_encoder(id)}",
274
+ method="PATCH",
275
+ json={
276
+ "title": title,
277
+ "description": description,
278
+ "is_public": is_public,
279
+ "is_personal": is_personal,
280
+ "is_archived": is_archived,
281
+ "color": color,
282
+ },
283
+ request_options=request_options,
284
+ omit=OMIT,
285
+ )
286
+ try:
287
+ if 200 <= _response.status_code < 300:
288
+ return pydantic_v1.parse_obj_as(Workspace, _response.json()) # type: ignore
289
+ _response_json = _response.json()
290
+ except JSONDecodeError:
291
+ raise ApiError(status_code=_response.status_code, body=_response.text)
292
+ raise ApiError(status_code=_response.status_code, body=_response_json)
293
+
294
+
295
+ class AsyncWorkspacesClient:
296
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
297
+ self._client_wrapper = client_wrapper
298
+ self.members = AsyncMembersClient(client_wrapper=self._client_wrapper)
299
+
300
+ async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[Workspace]:
301
+ """
302
+ List all workspaces for your organization.
303
+
304
+ Workspaces in Label Studio let you organize your projects and users into separate spaces. This is useful for managing different teams, departments, or projects within your organization.
305
+
306
+ For more information, see [Workspaces in Label Studio](https://docs.humansignal.com/guide/workspaces).
307
+
308
+ Parameters
309
+ ----------
310
+ request_options : typing.Optional[RequestOptions]
311
+ Request-specific configuration.
312
+
313
+ Returns
314
+ -------
315
+ typing.List[Workspace]
316
+
317
+
318
+ Examples
319
+ --------
320
+ from label_studio_sdk.client import AsyncLabelStudio
321
+
322
+ client = AsyncLabelStudio(
323
+ api_key="YOUR_API_KEY",
324
+ )
325
+ await client.workspaces.list()
326
+ """
327
+ _response = await self._client_wrapper.httpx_client.request(
328
+ "api/workspaces", method="GET", request_options=request_options
329
+ )
330
+ try:
331
+ if 200 <= _response.status_code < 300:
332
+ return pydantic_v1.parse_obj_as(typing.List[Workspace], _response.json()) # type: ignore
333
+ _response_json = _response.json()
334
+ except JSONDecodeError:
335
+ raise ApiError(status_code=_response.status_code, body=_response.text)
336
+ raise ApiError(status_code=_response.status_code, body=_response_json)
337
+
338
+ async def create(
339
+ self,
340
+ *,
341
+ title: typing.Optional[str] = OMIT,
342
+ description: typing.Optional[str] = OMIT,
343
+ is_public: typing.Optional[bool] = OMIT,
344
+ is_personal: typing.Optional[bool] = OMIT,
345
+ is_archived: typing.Optional[bool] = OMIT,
346
+ color: typing.Optional[str] = OMIT,
347
+ request_options: typing.Optional[RequestOptions] = None,
348
+ ) -> Workspace:
349
+ """
350
+ Create a new workspace.
351
+
352
+ Workspaces in Label Studio let you organize your projects and users into separate spaces. This is useful for managing different teams, departments, or projects within your organization.
353
+
354
+ For more information, see [Workspaces in Label Studio](https://docs.humansignal.com/guide/workspaces).
355
+
356
+ Parameters
357
+ ----------
358
+ title : typing.Optional[str]
359
+ Workspace title
360
+
361
+ description : typing.Optional[str]
362
+ Workspace description
363
+
364
+ is_public : typing.Optional[bool]
365
+ Is workspace public
366
+
367
+ is_personal : typing.Optional[bool]
368
+ Is workspace personal
369
+
370
+ is_archived : typing.Optional[bool]
371
+ Is workspace archived
372
+
373
+ color : typing.Optional[str]
374
+ Workspace color in HEX format
375
+
376
+ request_options : typing.Optional[RequestOptions]
377
+ Request-specific configuration.
378
+
379
+ Returns
380
+ -------
381
+ Workspace
382
+
383
+
384
+ Examples
385
+ --------
386
+ from label_studio_sdk.client import AsyncLabelStudio
387
+
388
+ client = AsyncLabelStudio(
389
+ api_key="YOUR_API_KEY",
390
+ )
391
+ await client.workspaces.create()
392
+ """
393
+ _response = await self._client_wrapper.httpx_client.request(
394
+ "api/workspaces",
395
+ method="POST",
396
+ json={
397
+ "title": title,
398
+ "description": description,
399
+ "is_public": is_public,
400
+ "is_personal": is_personal,
401
+ "is_archived": is_archived,
402
+ "color": color,
403
+ },
404
+ request_options=request_options,
405
+ omit=OMIT,
406
+ )
407
+ try:
408
+ if 200 <= _response.status_code < 300:
409
+ return pydantic_v1.parse_obj_as(Workspace, _response.json()) # type: ignore
410
+ _response_json = _response.json()
411
+ except JSONDecodeError:
412
+ raise ApiError(status_code=_response.status_code, body=_response.text)
413
+ raise ApiError(status_code=_response.status_code, body=_response_json)
414
+
415
+ async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> Workspace:
416
+ """
417
+ Get information about a specific workspace. You will need to provide the workspace ID. You can find this using [List workspaces](list).
418
+
419
+ Parameters
420
+ ----------
421
+ id : int
422
+ Workspace ID
423
+
424
+ request_options : typing.Optional[RequestOptions]
425
+ Request-specific configuration.
426
+
427
+ Returns
428
+ -------
429
+ Workspace
430
+
431
+
432
+ Examples
433
+ --------
434
+ from label_studio_sdk.client import AsyncLabelStudio
435
+
436
+ client = AsyncLabelStudio(
437
+ api_key="YOUR_API_KEY",
438
+ )
439
+ await client.workspaces.get(
440
+ id=1,
441
+ )
442
+ """
443
+ _response = await self._client_wrapper.httpx_client.request(
444
+ f"api/workspaces/{jsonable_encoder(id)}", method="GET", request_options=request_options
445
+ )
446
+ try:
447
+ if 200 <= _response.status_code < 300:
448
+ return pydantic_v1.parse_obj_as(Workspace, _response.json()) # type: ignore
449
+ _response_json = _response.json()
450
+ except JSONDecodeError:
451
+ raise ApiError(status_code=_response.status_code, body=_response.text)
452
+ raise ApiError(status_code=_response.status_code, body=_response_json)
453
+
454
+ async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
455
+ """
456
+ Delete a specific workspace. You will need to provide the workspace ID. You can find this using [List workspaces](list).
457
+
458
+ Parameters
459
+ ----------
460
+ id : int
461
+ Workspace ID
462
+
463
+ request_options : typing.Optional[RequestOptions]
464
+ Request-specific configuration.
465
+
466
+ Returns
467
+ -------
468
+ None
469
+
470
+ Examples
471
+ --------
472
+ from label_studio_sdk.client import AsyncLabelStudio
473
+
474
+ client = AsyncLabelStudio(
475
+ api_key="YOUR_API_KEY",
476
+ )
477
+ await client.workspaces.delete(
478
+ id=1,
479
+ )
480
+ """
481
+ _response = await self._client_wrapper.httpx_client.request(
482
+ f"api/workspaces/{jsonable_encoder(id)}", method="DELETE", request_options=request_options
483
+ )
484
+ try:
485
+ if 200 <= _response.status_code < 300:
486
+ return
487
+ _response_json = _response.json()
488
+ except JSONDecodeError:
489
+ raise ApiError(status_code=_response.status_code, body=_response.text)
490
+ raise ApiError(status_code=_response.status_code, body=_response_json)
491
+
492
+ async def update(
493
+ self,
494
+ id: int,
495
+ *,
496
+ title: typing.Optional[str] = OMIT,
497
+ description: typing.Optional[str] = OMIT,
498
+ is_public: typing.Optional[bool] = OMIT,
499
+ is_personal: typing.Optional[bool] = OMIT,
500
+ is_archived: typing.Optional[bool] = OMIT,
501
+ color: typing.Optional[str] = OMIT,
502
+ request_options: typing.Optional[RequestOptions] = None,
503
+ ) -> Workspace:
504
+ """
505
+ Update a specific workspace. You will need to provide the workspace ID. You can find this using [List workspaces](list).
506
+
507
+ Parameters
508
+ ----------
509
+ id : int
510
+ Workspace ID
511
+
512
+ title : typing.Optional[str]
513
+ Workspace title
514
+
515
+ description : typing.Optional[str]
516
+ Workspace description
517
+
518
+ is_public : typing.Optional[bool]
519
+ Is workspace public
520
+
521
+ is_personal : typing.Optional[bool]
522
+ Is workspace personal
523
+
524
+ is_archived : typing.Optional[bool]
525
+ Is workspace archived
526
+
527
+ color : typing.Optional[str]
528
+ Workspace color in HEX format
529
+
530
+ request_options : typing.Optional[RequestOptions]
531
+ Request-specific configuration.
532
+
533
+ Returns
534
+ -------
535
+ Workspace
536
+
537
+
538
+ Examples
539
+ --------
540
+ from label_studio_sdk.client import AsyncLabelStudio
541
+
542
+ client = AsyncLabelStudio(
543
+ api_key="YOUR_API_KEY",
544
+ )
545
+ await client.workspaces.update(
546
+ id=1,
547
+ )
548
+ """
549
+ _response = await self._client_wrapper.httpx_client.request(
550
+ f"api/workspaces/{jsonable_encoder(id)}",
551
+ method="PATCH",
552
+ json={
553
+ "title": title,
554
+ "description": description,
555
+ "is_public": is_public,
556
+ "is_personal": is_personal,
557
+ "is_archived": is_archived,
558
+ "color": color,
559
+ },
560
+ request_options=request_options,
561
+ omit=OMIT,
562
+ )
563
+ try:
564
+ if 200 <= _response.status_code < 300:
565
+ return pydantic_v1.parse_obj_as(Workspace, _response.json()) # type: ignore
566
+ _response_json = _response.json()
567
+ except JSONDecodeError:
568
+ raise ApiError(status_code=_response.status_code, body=_response.text)
569
+ raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .types import MembersCreateResponse, MembersListResponseItem
4
+
5
+ __all__ = ["MembersCreateResponse", "MembersListResponseItem"]