label-studio-sdk 2.0.11__py3-none-any.whl → 2.0.12__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 (31) hide show
  1. label_studio_sdk/__init__.py +10 -0
  2. label_studio_sdk/projects/__init__.py +8 -1
  3. label_studio_sdk/projects/client.py +8 -0
  4. label_studio_sdk/projects/members/client.py +137 -30
  5. label_studio_sdk/projects/roles/__init__.py +2 -0
  6. label_studio_sdk/projects/roles/client.py +555 -0
  7. label_studio_sdk/projects/stats/__init__.py +6 -0
  8. label_studio_sdk/projects/stats/client.py +280 -0
  9. label_studio_sdk/projects/stats/types/__init__.py +8 -0
  10. label_studio_sdk/projects/stats/types/stats_agreement_annotators_response.py +22 -0
  11. label_studio_sdk/projects/stats/types/stats_users_prediction_agreement_response.py +27 -0
  12. label_studio_sdk/projects/stats/types/stats_users_prediction_agreement_response_agreement_value.py +5 -0
  13. label_studio_sdk/types/__init__.py +10 -0
  14. label_studio_sdk/types/all_roles_project_list.py +5 -1
  15. label_studio_sdk/types/lse_project.py +5 -1
  16. label_studio_sdk/types/lse_project_create.py +5 -1
  17. label_studio_sdk/types/lse_project_response.py +5 -1
  18. label_studio_sdk/types/lse_project_update.py +5 -1
  19. label_studio_sdk/types/project.py +198 -0
  20. label_studio_sdk/types/project_member.py +19 -0
  21. label_studio_sdk/types/project_role.py +35 -0
  22. label_studio_sdk/types/project_sampling.py +7 -0
  23. label_studio_sdk/types/project_skip_queue.py +7 -0
  24. label_studio_sdk/workspaces/__init__.py +2 -2
  25. label_studio_sdk/workspaces/client.py +4 -0
  26. label_studio_sdk/workspaces/projects/__init__.py +2 -0
  27. label_studio_sdk/workspaces/projects/client.py +352 -0
  28. {label_studio_sdk-2.0.11.dist-info → label_studio_sdk-2.0.12.dist-info}/METADATA +1 -1
  29. {label_studio_sdk-2.0.11.dist-info → label_studio_sdk-2.0.12.dist-info}/RECORD +31 -19
  30. {label_studio_sdk-2.0.11.dist-info → label_studio_sdk-2.0.12.dist-info}/LICENSE +0 -0
  31. {label_studio_sdk-2.0.11.dist-info → label_studio_sdk-2.0.12.dist-info}/WHEEL +0 -0
@@ -162,13 +162,18 @@ from .types import (
162
162
  PauseRequest,
163
163
  Prediction,
164
164
  PredictionRequest,
165
+ Project,
165
166
  ProjectGroup,
166
167
  ProjectGroupRequest,
167
168
  ProjectGroupRoleEnum,
168
169
  ProjectImport,
169
170
  ProjectLabelConfig,
170
171
  ProjectLabelConfigRequest,
172
+ ProjectMember,
171
173
  ProjectMemberBulkAssignRolesRequest,
174
+ ProjectRole,
175
+ ProjectSampling,
176
+ ProjectSkipQueue,
172
177
  ProjectSubsetEnum,
173
178
  ProjectSubsetItem,
174
179
  ProjectSubsetTaskItem,
@@ -549,13 +554,18 @@ __all__ = [
549
554
  "PauseRequest",
550
555
  "Prediction",
551
556
  "PredictionRequest",
557
+ "Project",
552
558
  "ProjectGroup",
553
559
  "ProjectGroupRequest",
554
560
  "ProjectGroupRoleEnum",
555
561
  "ProjectImport",
556
562
  "ProjectLabelConfig",
557
563
  "ProjectLabelConfigRequest",
564
+ "ProjectMember",
558
565
  "ProjectMemberBulkAssignRolesRequest",
566
+ "ProjectRole",
567
+ "ProjectSampling",
568
+ "ProjectSkipQueue",
559
569
  "ProjectSubsetEnum",
560
570
  "ProjectSubsetItem",
561
571
  "ProjectSubsetTaskItem",
@@ -9,7 +9,7 @@ from .types import (
9
9
  ProjectsImportPredictionsResponse,
10
10
  ProjectsImportTasksResponse,
11
11
  )
12
- from . import assignments, exports, members, metrics, pauses, stats
12
+ from . import assignments, exports, members, metrics, pauses, roles, stats
13
13
  from .assignments import (
14
14
  AssignmentsAssignRequestType,
15
15
  AssignmentsBulkAssignRequestFilters,
@@ -29,6 +29,7 @@ from .assignments import (
29
29
  from .exports import ExportsConvertResponse
30
30
  from .stats import (
31
31
  StatsAgreementAnnotatorResponse,
32
+ StatsAgreementAnnotatorsResponse,
32
33
  StatsDataFiltersResponse,
33
34
  StatsDataFiltersResponseUserFilters,
34
35
  StatsDataFiltersResponseUserFiltersStatsItem,
@@ -52,6 +53,8 @@ from .stats import (
52
53
  StatsUserReviewScoreResponse,
53
54
  StatsUserReviewScoreResponsePerformanceScore,
54
55
  StatsUserReviewScoreResponseReviewScore,
56
+ StatsUsersPredictionAgreementResponse,
57
+ StatsUsersPredictionAgreementResponseAgreementValue,
55
58
  )
56
59
 
57
60
  __all__ = [
@@ -78,6 +81,7 @@ __all__ = [
78
81
  "ProjectsImportPredictionsResponse",
79
82
  "ProjectsImportTasksResponse",
80
83
  "StatsAgreementAnnotatorResponse",
84
+ "StatsAgreementAnnotatorsResponse",
81
85
  "StatsDataFiltersResponse",
82
86
  "StatsDataFiltersResponseUserFilters",
83
87
  "StatsDataFiltersResponseUserFiltersStatsItem",
@@ -101,10 +105,13 @@ __all__ = [
101
105
  "StatsUserReviewScoreResponse",
102
106
  "StatsUserReviewScoreResponsePerformanceScore",
103
107
  "StatsUserReviewScoreResponseReviewScore",
108
+ "StatsUsersPredictionAgreementResponse",
109
+ "StatsUsersPredictionAgreementResponseAgreementValue",
104
110
  "assignments",
105
111
  "exports",
106
112
  "members",
107
113
  "metrics",
108
114
  "pauses",
115
+ "roles",
109
116
  "stats",
110
117
  ]
@@ -2,6 +2,7 @@
2
2
 
3
3
  import typing
4
4
  from ..core.client_wrapper import SyncClientWrapper
5
+ from .roles.client import RolesClient
5
6
  from .exports.client import ExportsClient
6
7
  from .members.client import MembersClient
7
8
  from .metrics.client import MetricsClient
@@ -39,6 +40,7 @@ from ..types.prediction_request import PredictionRequest
39
40
  from .types.projects_import_predictions_response import ProjectsImportPredictionsResponse
40
41
  from ..types.project_label_config import ProjectLabelConfig
41
42
  from ..core.client_wrapper import AsyncClientWrapper
43
+ from .roles.client import AsyncRolesClient
42
44
  from .exports.client import AsyncExportsClient
43
45
  from .members.client import AsyncMembersClient
44
46
  from .metrics.client import AsyncMetricsClient
@@ -54,6 +56,7 @@ OMIT = typing.cast(typing.Any, ...)
54
56
  class ProjectsClient:
55
57
  def __init__(self, *, client_wrapper: SyncClientWrapper):
56
58
  self._client_wrapper = client_wrapper
59
+ self.roles = RolesClient(client_wrapper=self._client_wrapper)
57
60
  self.exports = ExportsClient(client_wrapper=self._client_wrapper)
58
61
  self.members = MembersClient(client_wrapper=self._client_wrapper)
59
62
  self.metrics = MetricsClient(client_wrapper=self._client_wrapper)
@@ -276,6 +279,7 @@ class ProjectsClient:
276
279
  If set, the annotator can view model predictions
277
280
 
278
281
  show_ground_truth_first : typing.Optional[bool]
282
+ Onboarding mode (true): show ground truth tasks first in the labeling stream
279
283
 
280
284
  show_instruction : typing.Optional[bool]
281
285
  Show instructions to the annotator before they start
@@ -702,6 +706,7 @@ class ProjectsClient:
702
706
  If set, the annotator can view model predictions
703
707
 
704
708
  show_ground_truth_first : typing.Optional[bool]
709
+ Onboarding mode (true): show ground truth tasks first in the labeling stream
705
710
 
706
711
  show_instruction : typing.Optional[bool]
707
712
  Show instructions to the annotator before they start
@@ -1235,6 +1240,7 @@ class ProjectsClient:
1235
1240
  class AsyncProjectsClient:
1236
1241
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
1237
1242
  self._client_wrapper = client_wrapper
1243
+ self.roles = AsyncRolesClient(client_wrapper=self._client_wrapper)
1238
1244
  self.exports = AsyncExportsClient(client_wrapper=self._client_wrapper)
1239
1245
  self.members = AsyncMembersClient(client_wrapper=self._client_wrapper)
1240
1246
  self.metrics = AsyncMetricsClient(client_wrapper=self._client_wrapper)
@@ -1465,6 +1471,7 @@ class AsyncProjectsClient:
1465
1471
  If set, the annotator can view model predictions
1466
1472
 
1467
1473
  show_ground_truth_first : typing.Optional[bool]
1474
+ Onboarding mode (true): show ground truth tasks first in the labeling stream
1468
1475
 
1469
1476
  show_instruction : typing.Optional[bool]
1470
1477
  Show instructions to the annotator before they start
@@ -1923,6 +1930,7 @@ class AsyncProjectsClient:
1923
1930
  If set, the annotator can view model predictions
1924
1931
 
1925
1932
  show_ground_truth_first : typing.Optional[bool]
1933
+ Onboarding mode (true): show ground truth tasks first in the labeling stream
1926
1934
 
1927
1935
  show_instruction : typing.Optional[bool]
1928
1936
  Show instructions to the annotator before they start
@@ -1,11 +1,11 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
+ import typing
3
4
  from ...core.client_wrapper import SyncClientWrapper
4
5
  from .bulk.client import BulkClient
5
6
  from .paginated.client import PaginatedClient
6
- import typing
7
7
  from ...core.request_options import RequestOptions
8
- from ...types.lse_user import LseUser
8
+ from ...types.project_member import ProjectMember
9
9
  from ...core.jsonable_encoder import jsonable_encoder
10
10
  from ...core.unchecked_base_model import construct_type
11
11
  from json.decoder import JSONDecodeError
@@ -14,6 +14,9 @@ from ...core.client_wrapper import AsyncClientWrapper
14
14
  from .bulk.client import AsyncBulkClient
15
15
  from .paginated.client import AsyncPaginatedClient
16
16
 
17
+ # this is used as the default value for optional parameters
18
+ OMIT = typing.cast(typing.Any, ...)
19
+
17
20
 
18
21
  class MembersClient:
19
22
  def __init__(self, *, client_wrapper: SyncClientWrapper):
@@ -21,9 +24,7 @@ class MembersClient:
21
24
  self.bulk = BulkClient(client_wrapper=self._client_wrapper)
22
25
  self.paginated = PaginatedClient(client_wrapper=self._client_wrapper)
23
26
 
24
- def get(
25
- self, id: int, *, user_ids: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
26
- ) -> typing.List[LseUser]:
27
+ def add(self, id: int, *, user: int, request_options: typing.Optional[RequestOptions] = None) -> ProjectMember:
27
28
  """
28
29
  <Card href="https://humansignal.com/goenterprise">
29
30
  <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
@@ -31,22 +32,21 @@ class MembersClient:
31
32
  This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
32
33
  </p>
33
34
  </Card>
34
- Retrieve the members for a specific project. Optionally filter by user IDs (comma-separated).
35
+ Add a member to a specific project.
35
36
 
36
37
  Parameters
37
38
  ----------
38
39
  id : int
39
40
 
40
- user_ids : typing.Optional[str]
41
- Comma-separated list of user IDs to include. Example: user_ids=1,2,3
41
+ user : int
42
42
 
43
43
  request_options : typing.Optional[RequestOptions]
44
44
  Request-specific configuration.
45
45
 
46
46
  Returns
47
47
  -------
48
- typing.List[LseUser]
49
- List of users with membership information
48
+ ProjectMember
49
+
50
50
 
51
51
  Examples
52
52
  --------
@@ -55,24 +55,29 @@ class MembersClient:
55
55
  client = LabelStudio(
56
56
  api_key="YOUR_API_KEY",
57
57
  )
58
- client.projects.members.get(
58
+ client.projects.members.add(
59
59
  id=1,
60
+ user=1,
60
61
  )
61
62
  """
62
63
  _response = self._client_wrapper.httpx_client.request(
63
64
  f"api/projects/{jsonable_encoder(id)}/members/",
64
- method="GET",
65
- params={
66
- "user_ids": user_ids,
65
+ method="POST",
66
+ json={
67
+ "user": user,
68
+ },
69
+ headers={
70
+ "content-type": "application/json",
67
71
  },
68
72
  request_options=request_options,
73
+ omit=OMIT,
69
74
  )
70
75
  try:
71
76
  if 200 <= _response.status_code < 300:
72
77
  return typing.cast(
73
- typing.List[LseUser],
78
+ ProjectMember,
74
79
  construct_type(
75
- type_=typing.List[LseUser], # type: ignore
80
+ type_=ProjectMember, # type: ignore
76
81
  object_=_response.json(),
77
82
  ),
78
83
  )
@@ -81,6 +86,51 @@ class MembersClient:
81
86
  raise ApiError(status_code=_response.status_code, body=_response.text)
82
87
  raise ApiError(status_code=_response.status_code, body=_response_json)
83
88
 
89
+ def remove(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
90
+ """
91
+ <Card href="https://humansignal.com/goenterprise">
92
+ <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
93
+ <p style="margin-top: 10px; font-size: 14px;">
94
+ This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
95
+ </p>
96
+ </Card>
97
+ Remove a member from a specific project.
98
+
99
+ Parameters
100
+ ----------
101
+ id : int
102
+
103
+ request_options : typing.Optional[RequestOptions]
104
+ Request-specific configuration.
105
+
106
+ Returns
107
+ -------
108
+ None
109
+
110
+ Examples
111
+ --------
112
+ from label_studio_sdk import LabelStudio
113
+
114
+ client = LabelStudio(
115
+ api_key="YOUR_API_KEY",
116
+ )
117
+ client.projects.members.remove(
118
+ id=1,
119
+ )
120
+ """
121
+ _response = self._client_wrapper.httpx_client.request(
122
+ f"api/projects/{jsonable_encoder(id)}/members/",
123
+ method="DELETE",
124
+ request_options=request_options,
125
+ )
126
+ try:
127
+ if 200 <= _response.status_code < 300:
128
+ return
129
+ _response_json = _response.json()
130
+ except JSONDecodeError:
131
+ raise ApiError(status_code=_response.status_code, body=_response.text)
132
+ raise ApiError(status_code=_response.status_code, body=_response_json)
133
+
84
134
 
85
135
  class AsyncMembersClient:
86
136
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -88,9 +138,9 @@ class AsyncMembersClient:
88
138
  self.bulk = AsyncBulkClient(client_wrapper=self._client_wrapper)
89
139
  self.paginated = AsyncPaginatedClient(client_wrapper=self._client_wrapper)
90
140
 
91
- async def get(
92
- self, id: int, *, user_ids: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
93
- ) -> typing.List[LseUser]:
141
+ async def add(
142
+ self, id: int, *, user: int, request_options: typing.Optional[RequestOptions] = None
143
+ ) -> ProjectMember:
94
144
  """
95
145
  <Card href="https://humansignal.com/goenterprise">
96
146
  <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
@@ -98,22 +148,21 @@ class AsyncMembersClient:
98
148
  This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
99
149
  </p>
100
150
  </Card>
101
- Retrieve the members for a specific project. Optionally filter by user IDs (comma-separated).
151
+ Add a member to a specific project.
102
152
 
103
153
  Parameters
104
154
  ----------
105
155
  id : int
106
156
 
107
- user_ids : typing.Optional[str]
108
- Comma-separated list of user IDs to include. Example: user_ids=1,2,3
157
+ user : int
109
158
 
110
159
  request_options : typing.Optional[RequestOptions]
111
160
  Request-specific configuration.
112
161
 
113
162
  Returns
114
163
  -------
115
- typing.List[LseUser]
116
- List of users with membership information
164
+ ProjectMember
165
+
117
166
 
118
167
  Examples
119
168
  --------
@@ -127,8 +176,9 @@ class AsyncMembersClient:
127
176
 
128
177
 
129
178
  async def main() -> None:
130
- await client.projects.members.get(
179
+ await client.projects.members.add(
131
180
  id=1,
181
+ user=1,
132
182
  )
133
183
 
134
184
 
@@ -136,18 +186,22 @@ class AsyncMembersClient:
136
186
  """
137
187
  _response = await self._client_wrapper.httpx_client.request(
138
188
  f"api/projects/{jsonable_encoder(id)}/members/",
139
- method="GET",
140
- params={
141
- "user_ids": user_ids,
189
+ method="POST",
190
+ json={
191
+ "user": user,
192
+ },
193
+ headers={
194
+ "content-type": "application/json",
142
195
  },
143
196
  request_options=request_options,
197
+ omit=OMIT,
144
198
  )
145
199
  try:
146
200
  if 200 <= _response.status_code < 300:
147
201
  return typing.cast(
148
- typing.List[LseUser],
202
+ ProjectMember,
149
203
  construct_type(
150
- type_=typing.List[LseUser], # type: ignore
204
+ type_=ProjectMember, # type: ignore
151
205
  object_=_response.json(),
152
206
  ),
153
207
  )
@@ -155,3 +209,56 @@ class AsyncMembersClient:
155
209
  except JSONDecodeError:
156
210
  raise ApiError(status_code=_response.status_code, body=_response.text)
157
211
  raise ApiError(status_code=_response.status_code, body=_response_json)
212
+
213
+ async def remove(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
214
+ """
215
+ <Card href="https://humansignal.com/goenterprise">
216
+ <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
217
+ <p style="margin-top: 10px; font-size: 14px;">
218
+ This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
219
+ </p>
220
+ </Card>
221
+ Remove a member from a specific project.
222
+
223
+ Parameters
224
+ ----------
225
+ id : int
226
+
227
+ request_options : typing.Optional[RequestOptions]
228
+ Request-specific configuration.
229
+
230
+ Returns
231
+ -------
232
+ None
233
+
234
+ Examples
235
+ --------
236
+ import asyncio
237
+
238
+ from label_studio_sdk import AsyncLabelStudio
239
+
240
+ client = AsyncLabelStudio(
241
+ api_key="YOUR_API_KEY",
242
+ )
243
+
244
+
245
+ async def main() -> None:
246
+ await client.projects.members.remove(
247
+ id=1,
248
+ )
249
+
250
+
251
+ asyncio.run(main())
252
+ """
253
+ _response = await self._client_wrapper.httpx_client.request(
254
+ f"api/projects/{jsonable_encoder(id)}/members/",
255
+ method="DELETE",
256
+ request_options=request_options,
257
+ )
258
+ try:
259
+ if 200 <= _response.status_code < 300:
260
+ return
261
+ _response_json = _response.json()
262
+ except JSONDecodeError:
263
+ raise ApiError(status_code=_response.status_code, body=_response.text)
264
+ raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -0,0 +1,2 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+