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.

Files changed (218) hide show
  1. label_studio_sdk/__init__.py +37 -8
  2. label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py +16 -4
  3. label_studio_sdk/_extensions/label_studio_tools/core/utils/json_schema.py +5 -0
  4. label_studio_sdk/_extensions/pager_ext.py +8 -0
  5. label_studio_sdk/actions/client.py +91 -40
  6. label_studio_sdk/actions/types/actions_create_request_filters.py +14 -24
  7. label_studio_sdk/actions/types/actions_create_request_filters_items_item.py +16 -26
  8. label_studio_sdk/actions/types/actions_create_request_filters_items_item_value.py +3 -1
  9. label_studio_sdk/actions/types/actions_create_request_selected_items.py +1 -2
  10. label_studio_sdk/actions/types/actions_create_request_selected_items_excluded.py +15 -25
  11. label_studio_sdk/actions/types/actions_create_request_selected_items_included.py +15 -25
  12. label_studio_sdk/annotations/__init__.py +2 -2
  13. label_studio_sdk/annotations/client.py +278 -104
  14. label_studio_sdk/annotations/types/__init__.py +2 -1
  15. label_studio_sdk/annotations/types/annotations_create_bulk_request_selected_items.py +34 -0
  16. label_studio_sdk/annotations/types/annotations_create_bulk_response_item.py +11 -21
  17. label_studio_sdk/base_client.py +54 -27
  18. label_studio_sdk/client.py +1 -0
  19. label_studio_sdk/comments/client.py +190 -44
  20. label_studio_sdk/converter/converter.py +56 -13
  21. label_studio_sdk/converter/imports/yolo.py +1 -1
  22. label_studio_sdk/converter/utils.py +3 -2
  23. label_studio_sdk/core/__init__.py +21 -4
  24. label_studio_sdk/core/client_wrapper.py +37 -19
  25. label_studio_sdk/core/file.py +37 -8
  26. label_studio_sdk/core/http_client.py +52 -28
  27. label_studio_sdk/core/jsonable_encoder.py +33 -31
  28. label_studio_sdk/core/pagination.py +5 -4
  29. label_studio_sdk/core/pydantic_utilities.py +272 -4
  30. label_studio_sdk/core/query_encoder.py +38 -13
  31. label_studio_sdk/core/request_options.py +3 -0
  32. label_studio_sdk/core/serialization.py +272 -0
  33. label_studio_sdk/errors/__init__.py +3 -1
  34. label_studio_sdk/errors/bad_request_error.py +2 -3
  35. label_studio_sdk/errors/not_found_error.py +9 -0
  36. label_studio_sdk/errors/unauthorized_error.py +9 -0
  37. label_studio_sdk/export_storage/azure/client.py +228 -58
  38. label_studio_sdk/export_storage/azure/types/azure_create_response.py +19 -29
  39. label_studio_sdk/export_storage/azure/types/azure_update_response.py +19 -29
  40. label_studio_sdk/export_storage/client.py +48 -18
  41. label_studio_sdk/export_storage/gcs/client.py +228 -58
  42. label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +19 -29
  43. label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +19 -29
  44. label_studio_sdk/export_storage/local/client.py +222 -56
  45. label_studio_sdk/export_storage/local/types/local_create_response.py +17 -27
  46. label_studio_sdk/export_storage/local/types/local_update_response.py +17 -27
  47. label_studio_sdk/export_storage/redis/client.py +228 -58
  48. label_studio_sdk/export_storage/redis/types/redis_create_response.py +20 -30
  49. label_studio_sdk/export_storage/redis/types/redis_update_response.py +20 -30
  50. label_studio_sdk/export_storage/s3/client.py +228 -58
  51. label_studio_sdk/export_storage/s3/types/s3create_response.py +27 -35
  52. label_studio_sdk/export_storage/s3/types/s3update_response.py +27 -35
  53. label_studio_sdk/export_storage/s3s/client.py +187 -43
  54. label_studio_sdk/export_storage/types/export_storage_list_types_response_item.py +11 -21
  55. label_studio_sdk/files/client.py +172 -56
  56. label_studio_sdk/import_storage/azure/client.py +223 -53
  57. label_studio_sdk/import_storage/azure/types/azure_create_response.py +22 -32
  58. label_studio_sdk/import_storage/azure/types/azure_update_response.py +22 -32
  59. label_studio_sdk/import_storage/client.py +48 -18
  60. label_studio_sdk/import_storage/gcs/client.py +223 -53
  61. label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +22 -32
  62. label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +22 -32
  63. label_studio_sdk/import_storage/local/client.py +223 -53
  64. label_studio_sdk/import_storage/local/types/local_create_response.py +17 -27
  65. label_studio_sdk/import_storage/local/types/local_update_response.py +17 -27
  66. label_studio_sdk/import_storage/redis/client.py +223 -53
  67. label_studio_sdk/import_storage/redis/types/redis_create_response.py +20 -30
  68. label_studio_sdk/import_storage/redis/types/redis_update_response.py +20 -30
  69. label_studio_sdk/import_storage/s3/client.py +223 -53
  70. label_studio_sdk/import_storage/s3/types/s3create_response.py +31 -39
  71. label_studio_sdk/import_storage/s3/types/s3update_response.py +31 -39
  72. label_studio_sdk/import_storage/s3s/client.py +222 -52
  73. label_studio_sdk/import_storage/types/import_storage_list_types_response_item.py +11 -21
  74. label_studio_sdk/jwt_settings/__init__.py +2 -0
  75. label_studio_sdk/jwt_settings/client.py +259 -0
  76. label_studio_sdk/label_interface/control_tags.py +16 -3
  77. label_studio_sdk/label_interface/interface.py +80 -1
  78. label_studio_sdk/label_interface/object_tags.py +2 -2
  79. label_studio_sdk/ml/client.py +280 -78
  80. label_studio_sdk/ml/types/ml_create_response.py +21 -31
  81. label_studio_sdk/ml/types/ml_update_response.py +21 -31
  82. label_studio_sdk/model_providers/client.py +173 -56
  83. label_studio_sdk/predictions/client.py +247 -101
  84. label_studio_sdk/projects/__init__.py +5 -1
  85. label_studio_sdk/projects/client.py +313 -115
  86. label_studio_sdk/projects/client_ext.py +16 -0
  87. label_studio_sdk/projects/exports/__init__.py +3 -0
  88. label_studio_sdk/projects/exports/client.py +447 -296
  89. label_studio_sdk/projects/exports/client_ext.py +200 -0
  90. label_studio_sdk/projects/exports/types/__init__.py +6 -0
  91. label_studio_sdk/projects/exports/types/exports_convert_response.py +24 -0
  92. label_studio_sdk/projects/exports/types/exports_list_formats_response_item.py +44 -0
  93. label_studio_sdk/projects/pauses/__init__.py +2 -0
  94. label_studio_sdk/projects/pauses/client.py +704 -0
  95. label_studio_sdk/projects/types/projects_create_response.py +29 -34
  96. label_studio_sdk/projects/types/projects_import_tasks_response.py +19 -29
  97. label_studio_sdk/projects/types/projects_list_response.py +11 -21
  98. label_studio_sdk/projects/types/projects_update_response.py +34 -34
  99. label_studio_sdk/prompts/client.py +309 -92
  100. label_studio_sdk/prompts/indicators/client.py +67 -23
  101. label_studio_sdk/prompts/runs/client.py +95 -40
  102. label_studio_sdk/prompts/types/prompts_batch_failed_predictions_request_failed_predictions_item.py +14 -24
  103. label_studio_sdk/prompts/types/prompts_batch_failed_predictions_response.py +11 -21
  104. label_studio_sdk/prompts/types/prompts_batch_predictions_request_results_item.py +26 -29
  105. label_studio_sdk/prompts/types/prompts_batch_predictions_response.py +11 -21
  106. label_studio_sdk/prompts/versions/client.py +277 -88
  107. label_studio_sdk/tasks/client.py +263 -90
  108. label_studio_sdk/tasks/types/tasks_list_response.py +15 -25
  109. label_studio_sdk/tokens/__init__.py +2 -0
  110. label_studio_sdk/tokens/client.py +470 -0
  111. label_studio_sdk/tokens/client_ext.py +94 -0
  112. label_studio_sdk/types/__init__.py +20 -6
  113. label_studio_sdk/types/access_token_response.py +22 -0
  114. label_studio_sdk/types/annotation.py +29 -38
  115. label_studio_sdk/types/annotation_filter_options.py +14 -24
  116. label_studio_sdk/types/annotations_dm_field.py +30 -39
  117. label_studio_sdk/types/api_token_response.py +32 -0
  118. label_studio_sdk/types/azure_blob_export_storage.py +28 -37
  119. label_studio_sdk/types/azure_blob_import_storage.py +28 -37
  120. label_studio_sdk/types/base_task.py +30 -39
  121. label_studio_sdk/types/base_task_updated_by.py +3 -1
  122. label_studio_sdk/types/base_user.py +14 -21
  123. label_studio_sdk/types/comment.py +12 -21
  124. label_studio_sdk/types/comment_created_by.py +1 -1
  125. label_studio_sdk/types/converted_format.py +12 -22
  126. label_studio_sdk/types/data_manager_task_serializer.py +31 -40
  127. label_studio_sdk/types/data_manager_task_serializer_annotators_item.py +1 -1
  128. label_studio_sdk/types/data_manager_task_serializer_drafts_item.py +13 -22
  129. label_studio_sdk/types/data_manager_task_serializer_predictions_item.py +15 -24
  130. label_studio_sdk/types/export.py +17 -26
  131. label_studio_sdk/types/export_format.py +25 -0
  132. label_studio_sdk/types/export_snapshot.py +45 -0
  133. label_studio_sdk/types/export_snapshot_status.py +5 -0
  134. label_studio_sdk/types/file_upload.py +11 -21
  135. label_studio_sdk/types/filter.py +16 -26
  136. label_studio_sdk/types/filter_group.py +12 -22
  137. label_studio_sdk/types/gcs_export_storage.py +28 -37
  138. label_studio_sdk/types/gcs_import_storage.py +28 -37
  139. label_studio_sdk/types/inference_run.py +14 -23
  140. label_studio_sdk/types/inference_run_cost_estimate.py +17 -27
  141. label_studio_sdk/types/inference_run_created_by.py +1 -1
  142. label_studio_sdk/types/inference_run_organization.py +1 -1
  143. label_studio_sdk/types/jwt_settings_response.py +32 -0
  144. label_studio_sdk/types/key_indicator_value.py +12 -22
  145. label_studio_sdk/types/key_indicators.py +0 -1
  146. label_studio_sdk/types/key_indicators_item.py +15 -25
  147. label_studio_sdk/types/key_indicators_item_additional_kpis_item.py +13 -23
  148. label_studio_sdk/types/key_indicators_item_extra_kpis_item.py +13 -23
  149. label_studio_sdk/types/local_files_export_storage.py +25 -34
  150. label_studio_sdk/types/local_files_import_storage.py +24 -33
  151. label_studio_sdk/types/ml_backend.py +23 -32
  152. label_studio_sdk/types/model_provider_connection.py +22 -31
  153. label_studio_sdk/types/model_provider_connection_created_by.py +1 -1
  154. label_studio_sdk/types/model_provider_connection_organization.py +1 -1
  155. label_studio_sdk/types/model_provider_connection_provider.py +3 -1
  156. label_studio_sdk/types/pause.py +34 -0
  157. label_studio_sdk/types/pause_paused_by.py +5 -0
  158. label_studio_sdk/types/prediction.py +21 -30
  159. label_studio_sdk/types/project.py +58 -55
  160. label_studio_sdk/types/project_import.py +21 -30
  161. label_studio_sdk/types/project_label_config.py +12 -22
  162. label_studio_sdk/types/prompt.py +24 -32
  163. label_studio_sdk/types/prompt_associated_projects_item.py +6 -0
  164. label_studio_sdk/types/prompt_associated_projects_item_id.py +20 -0
  165. label_studio_sdk/types/prompt_created_by.py +1 -1
  166. label_studio_sdk/types/prompt_organization.py +1 -1
  167. label_studio_sdk/types/prompt_version.py +13 -22
  168. label_studio_sdk/types/prompt_version_created_by.py +1 -1
  169. label_studio_sdk/types/prompt_version_organization.py +1 -1
  170. label_studio_sdk/types/prompt_version_provider.py +3 -1
  171. label_studio_sdk/types/redis_export_storage.py +29 -38
  172. label_studio_sdk/types/redis_import_storage.py +28 -37
  173. label_studio_sdk/types/refined_prompt_response.py +19 -29
  174. label_studio_sdk/types/s3export_storage.py +36 -43
  175. label_studio_sdk/types/s3import_storage.py +37 -44
  176. label_studio_sdk/types/s3s_export_storage.py +26 -33
  177. label_studio_sdk/types/s3s_import_storage.py +35 -42
  178. label_studio_sdk/types/serialization_option.py +12 -22
  179. label_studio_sdk/types/serialization_options.py +18 -28
  180. label_studio_sdk/types/task.py +44 -47
  181. label_studio_sdk/types/task_annotators_item.py +1 -1
  182. label_studio_sdk/types/task_comment_authors_item.py +1 -1
  183. label_studio_sdk/types/task_filter_options.py +15 -25
  184. label_studio_sdk/types/user_simple.py +11 -21
  185. label_studio_sdk/types/view.py +16 -26
  186. label_studio_sdk/types/webhook.py +19 -28
  187. label_studio_sdk/types/webhook_serializer_for_update.py +19 -28
  188. label_studio_sdk/types/workspace.py +22 -31
  189. label_studio_sdk/users/client.py +257 -63
  190. label_studio_sdk/users/types/users_get_token_response.py +12 -22
  191. label_studio_sdk/users/types/users_reset_token_response.py +12 -22
  192. label_studio_sdk/version.py +0 -1
  193. label_studio_sdk/versions/__init__.py +5 -0
  194. label_studio_sdk/versions/client.py +112 -0
  195. label_studio_sdk/versions/types/__init__.py +6 -0
  196. label_studio_sdk/versions/types/versions_get_response.py +73 -0
  197. label_studio_sdk/versions/types/versions_get_response_edition.py +5 -0
  198. label_studio_sdk/views/client.py +219 -52
  199. label_studio_sdk/views/types/views_create_request_data.py +13 -23
  200. label_studio_sdk/views/types/views_create_request_data_filters.py +14 -24
  201. label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +16 -26
  202. label_studio_sdk/views/types/views_create_request_data_filters_items_item_value.py +3 -1
  203. label_studio_sdk/views/types/views_update_request_data.py +13 -23
  204. label_studio_sdk/views/types/views_update_request_data_filters.py +14 -24
  205. label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +16 -26
  206. label_studio_sdk/views/types/views_update_request_data_filters_items_item_value.py +3 -1
  207. label_studio_sdk/webhooks/client.py +191 -61
  208. label_studio_sdk/workspaces/client.py +164 -41
  209. label_studio_sdk/workspaces/members/client.py +109 -31
  210. label_studio_sdk/workspaces/members/types/members_create_response.py +12 -22
  211. label_studio_sdk/workspaces/members/types/members_list_response_item.py +12 -22
  212. {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.11.dist-info}/METADATA +8 -5
  213. {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.11.dist-info}/RECORD +215 -188
  214. {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.11.dist-info}/WHEEL +1 -1
  215. label_studio_sdk/types/export_convert.py +0 -32
  216. label_studio_sdk/types/export_create.py +0 -54
  217. label_studio_sdk/types/export_create_status.py +0 -5
  218. {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.11.dist-info}/LICENSE +0 -0
@@ -1,22 +1,26 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
3
  import typing
4
+ from ..core.client_wrapper import SyncClientWrapper
5
+ from .pauses.client import PausesClient
6
+ from .exports.client import ExportsClient
7
+ from ..core.request_options import RequestOptions
8
+ from ..core.pagination import SyncPager
9
+ from ..types.project import Project
10
+ from .types.projects_list_response import ProjectsListResponse
11
+ from ..core.pydantic_utilities import parse_obj_as
4
12
  from json.decoder import JSONDecodeError
5
-
6
13
  from ..core.api_error import ApiError
7
- from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
14
+ from .types.projects_create_response import ProjectsCreateResponse
8
15
  from ..core.jsonable_encoder import jsonable_encoder
9
- from ..core.pagination import AsyncPager, SyncPager
10
- from ..core.pydantic_utilities import pydantic_v1
11
- from ..core.request_options import RequestOptions
16
+ from .types.projects_update_response import ProjectsUpdateResponse
17
+ from .types.projects_import_tasks_response import ProjectsImportTasksResponse
12
18
  from ..errors.bad_request_error import BadRequestError
13
- from ..types.project import Project
14
19
  from ..types.project_label_config import ProjectLabelConfig
15
- from .exports.client import AsyncExportsClient, ExportsClient
16
- from .types.projects_create_response import ProjectsCreateResponse
17
- from .types.projects_import_tasks_response import ProjectsImportTasksResponse
18
- from .types.projects_list_response import ProjectsListResponse
19
- from .types.projects_update_response import ProjectsUpdateResponse
20
+ from ..core.client_wrapper import AsyncClientWrapper
21
+ from .pauses.client import AsyncPausesClient
22
+ from .exports.client import AsyncExportsClient
23
+ from ..core.pagination import AsyncPager
20
24
 
21
25
  # this is used as the default value for optional parameters
22
26
  OMIT = typing.cast(typing.Any, ...)
@@ -25,6 +29,7 @@ OMIT = typing.cast(typing.Any, ...)
25
29
  class ProjectsClient:
26
30
  def __init__(self, *, client_wrapper: SyncClientWrapper):
27
31
  self._client_wrapper = client_wrapper
32
+ self.pauses = PausesClient(client_wrapper=self._client_wrapper)
28
33
  self.exports = ExportsClient(client_wrapper=self._client_wrapper)
29
34
 
30
35
  def list(
@@ -35,16 +40,17 @@ class ProjectsClient:
35
40
  title: typing.Optional[str] = None,
36
41
  page: typing.Optional[int] = None,
37
42
  page_size: typing.Optional[int] = None,
43
+ workspaces: typing.Optional[int] = None,
38
44
  request_options: typing.Optional[RequestOptions] = None,
39
45
  ) -> SyncPager[Project]:
40
46
  """
47
+
41
48
  Return a list of the projects within your organization.
42
49
 
43
50
  To perform most tasks with the Label Studio API, you must specify the project ID, sometimes referred to as the `pk`. The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using this API call.
44
51
 
45
52
  To retrieve a list of your Label Studio projects, update the following command to match your own environment.
46
53
  Replace the domain name, port, and authorization token, then run the following from the command line:
47
-
48
54
  ```bash
49
55
  curl -X GET https://localhost:8080/api/projects/ -H 'Authorization: Token abc123'
50
56
  ```
@@ -66,6 +72,9 @@ class ProjectsClient:
66
72
  page_size : typing.Optional[int]
67
73
  Number of results to return per page.
68
74
 
75
+ workspaces : typing.Optional[int]
76
+ workspaces
77
+
69
78
  request_options : typing.Optional[RequestOptions]
70
79
  Request-specific configuration.
71
80
 
@@ -76,7 +85,7 @@ class ProjectsClient:
76
85
 
77
86
  Examples
78
87
  --------
79
- from label_studio_sdk.client import LabelStudio
88
+ from label_studio_sdk import LabelStudio
80
89
 
81
90
  client = LabelStudio(
82
91
  api_key="YOUR_API_KEY",
@@ -88,16 +97,29 @@ class ProjectsClient:
88
97
  for page in response.iter_pages():
89
98
  yield page
90
99
  """
91
- page = page or 1
100
+ page = page if page is not None else 1
92
101
  _response = self._client_wrapper.httpx_client.request(
93
102
  "api/projects/",
94
103
  method="GET",
95
- params={"ordering": ordering, "ids": ids, "title": title, "page": page, "page_size": page_size},
104
+ params={
105
+ "ordering": ordering,
106
+ "ids": ids,
107
+ "title": title,
108
+ "page": page,
109
+ "page_size": page_size,
110
+ "workspaces": workspaces,
111
+ },
96
112
  request_options=request_options,
97
113
  )
98
114
  try:
99
115
  if 200 <= _response.status_code < 300:
100
- _parsed_response = pydantic_v1.parse_obj_as(ProjectsListResponse, _response.json()) # type: ignore
116
+ _parsed_response = typing.cast(
117
+ ProjectsListResponse,
118
+ parse_obj_as(
119
+ type_=ProjectsListResponse, # type: ignore
120
+ object_=_response.json(),
121
+ ),
122
+ )
101
123
  _has_next = True
102
124
  _get_next = lambda: self.list(
103
125
  ordering=ordering,
@@ -105,6 +127,7 @@ class ProjectsClient:
105
127
  title=title,
106
128
  page=page + 1,
107
129
  page_size=page_size,
130
+ workspaces=workspaces,
108
131
  request_options=request_options,
109
132
  )
110
133
  _items = _parsed_response.results
@@ -129,17 +152,17 @@ class ProjectsClient:
129
152
  show_collab_predictions: typing.Optional[bool] = OMIT,
130
153
  maximum_annotations: typing.Optional[int] = OMIT,
131
154
  color: typing.Optional[str] = OMIT,
132
- control_weights: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
155
+ control_weights: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
133
156
  workspace: typing.Optional[int] = OMIT,
134
157
  model_version: typing.Optional[str] = OMIT,
135
158
  request_options: typing.Optional[RequestOptions] = None,
136
159
  ) -> ProjectsCreateResponse:
137
160
  """
138
- Create a project and set up the labeling interface. For more information about setting up projects, see the following:
139
161
 
140
- - [Create and configure projects](https://labelstud.io/guide/setup_project)
141
- - [Configure labeling interface](https://labelstud.io/guide/setup)
142
- - [Project settings](https://labelstud.io/guide/project_settings)
162
+ Create a project and set up the labeling interface. For more information about setting up projects, see the following:
163
+ * [Create and configure projects](https://labelstud.io/guide/setup_project)
164
+ * [Configure labeling interface](https://labelstud.io/guide/setup)
165
+ * [Project settings](https://labelstud.io/guide/project_settings)
143
166
 
144
167
  ```bash
145
168
  curl -H Content-Type:application/json -H 'Authorization: Token abc123' -X POST 'https://localhost:8080/api/projects' --data '{"label_config": "<View>[...]</View>"}'
@@ -183,7 +206,7 @@ class ProjectsClient:
183
206
  color : typing.Optional[str]
184
207
  Project color in HEX format
185
208
 
186
- control_weights : typing.Optional[typing.Dict[str, typing.Any]]
209
+ control_weights : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
187
210
  Dict of weights for each control tag in metric calculation. Each control tag (e.g. label or choice) will have its own key in control weight dict with weight for each label and overall weight. For example, if a bounding box annotation with a control tag named my_bbox should be included with 0.33 weight in agreement calculation, and the first label Car should be twice as important as Airplane, then you need to specify: {'my_bbox': {'type': 'RectangleLabels', 'labels': {'Car': 1.0, 'Airplane': 0.5}, 'overall': 0.33}
188
211
 
189
212
  workspace : typing.Optional[int]
@@ -202,7 +225,7 @@ class ProjectsClient:
202
225
 
203
226
  Examples
204
227
  --------
205
- from label_studio_sdk.client import LabelStudio
228
+ from label_studio_sdk import LabelStudio
206
229
 
207
230
  client = LabelStudio(
208
231
  api_key="YOUR_API_KEY",
@@ -229,12 +252,21 @@ class ProjectsClient:
229
252
  "workspace": workspace,
230
253
  "model_version": model_version,
231
254
  },
255
+ headers={
256
+ "content-type": "application/json",
257
+ },
232
258
  request_options=request_options,
233
259
  omit=OMIT,
234
260
  )
235
261
  try:
236
262
  if 200 <= _response.status_code < 300:
237
- return pydantic_v1.parse_obj_as(ProjectsCreateResponse, _response.json()) # type: ignore
263
+ return typing.cast(
264
+ ProjectsCreateResponse,
265
+ parse_obj_as(
266
+ type_=ProjectsCreateResponse, # type: ignore
267
+ object_=_response.json(),
268
+ ),
269
+ )
238
270
  _response_json = _response.json()
239
271
  except JSONDecodeError:
240
272
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -259,7 +291,7 @@ class ProjectsClient:
259
291
 
260
292
  Examples
261
293
  --------
262
- from label_studio_sdk.client import LabelStudio
294
+ from label_studio_sdk import LabelStudio
263
295
 
264
296
  client = LabelStudio(
265
297
  api_key="YOUR_API_KEY",
@@ -269,11 +301,19 @@ class ProjectsClient:
269
301
  )
270
302
  """
271
303
  _response = self._client_wrapper.httpx_client.request(
272
- f"api/projects/{jsonable_encoder(id)}/", method="GET", request_options=request_options
304
+ f"api/projects/{jsonable_encoder(id)}/",
305
+ method="GET",
306
+ request_options=request_options,
273
307
  )
274
308
  try:
275
309
  if 200 <= _response.status_code < 300:
276
- return pydantic_v1.parse_obj_as(Project, _response.json()) # type: ignore
310
+ return typing.cast(
311
+ Project,
312
+ parse_obj_as(
313
+ type_=Project, # type: ignore
314
+ object_=_response.json(),
315
+ ),
316
+ )
277
317
  _response_json = _response.json()
278
318
  except JSONDecodeError:
279
319
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -281,6 +321,7 @@ class ProjectsClient:
281
321
 
282
322
  def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
283
323
  """
324
+
284
325
  Delete a project by specified project ID. Deleting a project permanently removes all tasks, annotations, and project data from Label Studio.
285
326
 
286
327
  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](list).
@@ -299,7 +340,7 @@ class ProjectsClient:
299
340
 
300
341
  Examples
301
342
  --------
302
- from label_studio_sdk.client import LabelStudio
343
+ from label_studio_sdk import LabelStudio
303
344
 
304
345
  client = LabelStudio(
305
346
  api_key="YOUR_API_KEY",
@@ -309,7 +350,9 @@ class ProjectsClient:
309
350
  )
310
351
  """
311
352
  _response = self._client_wrapper.httpx_client.request(
312
- f"api/projects/{jsonable_encoder(id)}/", method="DELETE", request_options=request_options
353
+ f"api/projects/{jsonable_encoder(id)}/",
354
+ method="DELETE",
355
+ request_options=request_options,
313
356
  )
314
357
  try:
315
358
  if 200 <= _response.status_code < 300:
@@ -335,17 +378,17 @@ class ProjectsClient:
335
378
  show_collab_predictions: typing.Optional[bool] = OMIT,
336
379
  maximum_annotations: typing.Optional[int] = OMIT,
337
380
  color: typing.Optional[str] = OMIT,
338
- control_weights: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
381
+ control_weights: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
339
382
  workspace: typing.Optional[int] = OMIT,
340
383
  model_version: typing.Optional[str] = OMIT,
341
384
  request_options: typing.Optional[RequestOptions] = None,
342
385
  ) -> ProjectsUpdateResponse:
343
386
  """
344
- Update the project settings for a specific project. For more information, see the following:
345
387
 
346
- - [Create and configure projects](https://labelstud.io/guide/setup_project)
347
- - [Configure labeling interface](https://labelstud.io/guide/setup)
348
- - [Project settings](https://labelstud.io/guide/project_settings)
388
+ Update the project settings for a specific project. For more information, see the following:
389
+ * [Create and configure projects](https://labelstud.io/guide/setup_project)
390
+ * [Configure labeling interface](https://labelstud.io/guide/setup)
391
+ * [Project settings](https://labelstud.io/guide/project_settings)
349
392
 
350
393
  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](list).
351
394
 
@@ -396,7 +439,7 @@ class ProjectsClient:
396
439
  color : typing.Optional[str]
397
440
  Project color in HEX format
398
441
 
399
- control_weights : typing.Optional[typing.Dict[str, typing.Any]]
442
+ control_weights : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
400
443
  Dict of weights for each control tag in metric calculation. Each control tag (e.g. label or choice) will have its own key in control weight dict with weight for each label and overall weight. For example, if a bounding box annotation with a control tag named my_bbox should be included with 0.33 weight in agreement calculation, and the first label Car should be twice as important as Airplane, then you need to specify: {'my_bbox': {'type': 'RectangleLabels', 'labels': {'Car': 1.0, 'Airplane': 0.5}, 'overall': 0.33}
401
444
 
402
445
  workspace : typing.Optional[int]
@@ -415,7 +458,7 @@ class ProjectsClient:
415
458
 
416
459
  Examples
417
460
  --------
418
- from label_studio_sdk.client import LabelStudio
461
+ from label_studio_sdk import LabelStudio
419
462
 
420
463
  client = LabelStudio(
421
464
  api_key="YOUR_API_KEY",
@@ -444,12 +487,21 @@ class ProjectsClient:
444
487
  "workspace": workspace,
445
488
  "model_version": model_version,
446
489
  },
490
+ headers={
491
+ "content-type": "application/json",
492
+ },
447
493
  request_options=request_options,
448
494
  omit=OMIT,
449
495
  )
450
496
  try:
451
497
  if 200 <= _response.status_code < 300:
452
- return pydantic_v1.parse_obj_as(ProjectsUpdateResponse, _response.json()) # type: ignore
498
+ return typing.cast(
499
+ ProjectsUpdateResponse,
500
+ parse_obj_as(
501
+ type_=ProjectsUpdateResponse, # type: ignore
502
+ object_=_response.json(),
503
+ ),
504
+ )
453
505
  _response_json = _response.json()
454
506
  except JSONDecodeError:
455
507
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -459,26 +511,26 @@ class ProjectsClient:
459
511
  self,
460
512
  id: int,
461
513
  *,
462
- request: typing.Sequence[typing.Dict[str, typing.Any]],
514
+ request: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
463
515
  commit_to_project: typing.Optional[bool] = None,
464
516
  return_task_ids: typing.Optional[bool] = None,
465
517
  preannotated_from_fields: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
466
518
  request_options: typing.Optional[RequestOptions] = None,
467
519
  ) -> ProjectsImportTasksResponse:
468
520
  """
521
+
469
522
  Use this API endpoint to import labeling tasks in bulk. Note that each POST request is limited at 250K tasks and 200 MB.
470
- 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).
523
+ 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).
471
524
 
472
525
  <Note>
473
- Imported data is verified against a project *label_config* and must include all variables that were used in the *label_config*.
526
+ Imported data is verified against a project *label_config* and must include all variables that were used in the *label_config*.
474
527
 
475
- For example, if the label configuration has a _$text_ variable, then each item in a data object must include a `text` field.
528
+ For example, if the label configuration has a *$text* variable, then each item in a data object must include a `text` field.
476
529
  </Note>
477
530
 
478
531
  There are three possible ways to import tasks with this endpoint:
479
532
 
480
533
  #### 1\. **POST with data**
481
-
482
534
  Send JSON tasks as POST data. Only JSON is supported for POSTing files directly.
483
535
 
484
536
  Update this example to specify your authorization token and Label Studio instance host, then run the following from
@@ -490,7 +542,6 @@ class ProjectsClient:
490
542
  ```
491
543
 
492
544
  #### 2\. **POST with files**
493
-
494
545
  Send tasks as files. You can attach multiple files with different names.
495
546
 
496
547
  - **JSON**: text files in JavaScript object notation format
@@ -507,7 +558,6 @@ class ProjectsClient:
507
558
  ```
508
559
 
509
560
  #### 3\. **POST with URL**
510
-
511
561
  You can also provide a URL to a file with labeling tasks. Supported file formats are the same as in option 2.
512
562
 
513
563
  ```bash
@@ -523,7 +573,7 @@ class ProjectsClient:
523
573
  id : int
524
574
  A unique integer value identifying this project.
525
575
 
526
- request : typing.Sequence[typing.Dict[str, typing.Any]]
576
+ request : typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]
527
577
 
528
578
  commit_to_project : typing.Optional[bool]
529
579
  Set to "true" to immediately commit tasks to the project.
@@ -544,7 +594,7 @@ class ProjectsClient:
544
594
 
545
595
  Examples
546
596
  --------
547
- from label_studio_sdk.client import LabelStudio
597
+ from label_studio_sdk import LabelStudio
548
598
 
549
599
  client = LabelStudio(
550
600
  api_key="YOUR_API_KEY",
@@ -568,9 +618,23 @@ class ProjectsClient:
568
618
  )
569
619
  try:
570
620
  if 200 <= _response.status_code < 300:
571
- return pydantic_v1.parse_obj_as(ProjectsImportTasksResponse, _response.json()) # type: ignore
621
+ return typing.cast(
622
+ ProjectsImportTasksResponse,
623
+ parse_obj_as(
624
+ type_=ProjectsImportTasksResponse, # type: ignore
625
+ object_=_response.json(),
626
+ ),
627
+ )
572
628
  if _response.status_code == 400:
573
- raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
629
+ raise BadRequestError(
630
+ typing.cast(
631
+ typing.Optional[typing.Any],
632
+ parse_obj_as(
633
+ type_=typing.Optional[typing.Any], # type: ignore
634
+ object_=_response.json(),
635
+ ),
636
+ )
637
+ )
574
638
  _response_json = _response.json()
575
639
  except JSONDecodeError:
576
640
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -580,6 +644,7 @@ class ProjectsClient:
580
644
  self, id: int, *, label_config: str, request_options: typing.Optional[RequestOptions] = None
581
645
  ) -> ProjectLabelConfig:
582
646
  """
647
+
583
648
  Determine whether the label configuration for a specific project is valid. For more information about setting up labeling configs, see [Configure labeling interface](https://labelstud.io/guide/setup) and our [Tags reference](https://labelstud.io/tags/).
584
649
 
585
650
  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](list).
@@ -602,7 +667,7 @@ class ProjectsClient:
602
667
 
603
668
  Examples
604
669
  --------
605
- from label_studio_sdk.client import LabelStudio
670
+ from label_studio_sdk import LabelStudio
606
671
 
607
672
  client = LabelStudio(
608
673
  api_key="YOUR_API_KEY",
@@ -615,13 +680,21 @@ class ProjectsClient:
615
680
  _response = self._client_wrapper.httpx_client.request(
616
681
  f"api/projects/{jsonable_encoder(id)}/validate/",
617
682
  method="POST",
618
- json={"label_config": label_config},
683
+ json={
684
+ "label_config": label_config,
685
+ },
619
686
  request_options=request_options,
620
687
  omit=OMIT,
621
688
  )
622
689
  try:
623
690
  if 200 <= _response.status_code < 300:
624
- return pydantic_v1.parse_obj_as(ProjectLabelConfig, _response.json()) # type: ignore
691
+ return typing.cast(
692
+ ProjectLabelConfig,
693
+ parse_obj_as(
694
+ type_=ProjectLabelConfig, # type: ignore
695
+ object_=_response.json(),
696
+ ),
697
+ )
625
698
  _response_json = _response.json()
626
699
  except JSONDecodeError:
627
700
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -631,6 +704,7 @@ class ProjectsClient:
631
704
  class AsyncProjectsClient:
632
705
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
633
706
  self._client_wrapper = client_wrapper
707
+ self.pauses = AsyncPausesClient(client_wrapper=self._client_wrapper)
634
708
  self.exports = AsyncExportsClient(client_wrapper=self._client_wrapper)
635
709
 
636
710
  async def list(
@@ -641,16 +715,17 @@ class AsyncProjectsClient:
641
715
  title: typing.Optional[str] = None,
642
716
  page: typing.Optional[int] = None,
643
717
  page_size: typing.Optional[int] = None,
718
+ workspaces: typing.Optional[int] = None,
644
719
  request_options: typing.Optional[RequestOptions] = None,
645
720
  ) -> AsyncPager[Project]:
646
721
  """
722
+
647
723
  Return a list of the projects within your organization.
648
724
 
649
725
  To perform most tasks with the Label Studio API, you must specify the project ID, sometimes referred to as the `pk`. The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using this API call.
650
726
 
651
727
  To retrieve a list of your Label Studio projects, update the following command to match your own environment.
652
728
  Replace the domain name, port, and authorization token, then run the following from the command line:
653
-
654
729
  ```bash
655
730
  curl -X GET https://localhost:8080/api/projects/ -H 'Authorization: Token abc123'
656
731
  ```
@@ -672,6 +747,9 @@ class AsyncProjectsClient:
672
747
  page_size : typing.Optional[int]
673
748
  Number of results to return per page.
674
749
 
750
+ workspaces : typing.Optional[int]
751
+ workspaces
752
+
675
753
  request_options : typing.Optional[RequestOptions]
676
754
  Request-specific configuration.
677
755
 
@@ -682,28 +760,49 @@ class AsyncProjectsClient:
682
760
 
683
761
  Examples
684
762
  --------
685
- from label_studio_sdk.client import AsyncLabelStudio
763
+ import asyncio
764
+
765
+ from label_studio_sdk import AsyncLabelStudio
686
766
 
687
767
  client = AsyncLabelStudio(
688
768
  api_key="YOUR_API_KEY",
689
769
  )
690
- response = await client.projects.list()
691
- async for item in response:
692
- yield item
693
- # alternatively, you can paginate page-by-page
694
- async for page in response.iter_pages():
695
- yield page
770
+
771
+
772
+ async def main() -> None:
773
+ response = await client.projects.list()
774
+ async for item in response:
775
+ yield item
776
+ # alternatively, you can paginate page-by-page
777
+ async for page in response.iter_pages():
778
+ yield page
779
+
780
+
781
+ asyncio.run(main())
696
782
  """
697
- page = page or 1
783
+ page = page if page is not None else 1
698
784
  _response = await self._client_wrapper.httpx_client.request(
699
785
  "api/projects/",
700
786
  method="GET",
701
- params={"ordering": ordering, "ids": ids, "title": title, "page": page, "page_size": page_size},
787
+ params={
788
+ "ordering": ordering,
789
+ "ids": ids,
790
+ "title": title,
791
+ "page": page,
792
+ "page_size": page_size,
793
+ "workspaces": workspaces,
794
+ },
702
795
  request_options=request_options,
703
796
  )
704
797
  try:
705
798
  if 200 <= _response.status_code < 300:
706
- _parsed_response = pydantic_v1.parse_obj_as(ProjectsListResponse, _response.json()) # type: ignore
799
+ _parsed_response = typing.cast(
800
+ ProjectsListResponse,
801
+ parse_obj_as(
802
+ type_=ProjectsListResponse, # type: ignore
803
+ object_=_response.json(),
804
+ ),
805
+ )
707
806
  _has_next = True
708
807
  _get_next = lambda: self.list(
709
808
  ordering=ordering,
@@ -711,6 +810,7 @@ class AsyncProjectsClient:
711
810
  title=title,
712
811
  page=page + 1,
713
812
  page_size=page_size,
813
+ workspaces=workspaces,
714
814
  request_options=request_options,
715
815
  )
716
816
  _items = _parsed_response.results
@@ -735,17 +835,17 @@ class AsyncProjectsClient:
735
835
  show_collab_predictions: typing.Optional[bool] = OMIT,
736
836
  maximum_annotations: typing.Optional[int] = OMIT,
737
837
  color: typing.Optional[str] = OMIT,
738
- control_weights: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
838
+ control_weights: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
739
839
  workspace: typing.Optional[int] = OMIT,
740
840
  model_version: typing.Optional[str] = OMIT,
741
841
  request_options: typing.Optional[RequestOptions] = None,
742
842
  ) -> ProjectsCreateResponse:
743
843
  """
744
- Create a project and set up the labeling interface. For more information about setting up projects, see the following:
745
844
 
746
- - [Create and configure projects](https://labelstud.io/guide/setup_project)
747
- - [Configure labeling interface](https://labelstud.io/guide/setup)
748
- - [Project settings](https://labelstud.io/guide/project_settings)
845
+ Create a project and set up the labeling interface. For more information about setting up projects, see the following:
846
+ * [Create and configure projects](https://labelstud.io/guide/setup_project)
847
+ * [Configure labeling interface](https://labelstud.io/guide/setup)
848
+ * [Project settings](https://labelstud.io/guide/project_settings)
749
849
 
750
850
  ```bash
751
851
  curl -H Content-Type:application/json -H 'Authorization: Token abc123' -X POST 'https://localhost:8080/api/projects' --data '{"label_config": "<View>[...]</View>"}'
@@ -789,7 +889,7 @@ class AsyncProjectsClient:
789
889
  color : typing.Optional[str]
790
890
  Project color in HEX format
791
891
 
792
- control_weights : typing.Optional[typing.Dict[str, typing.Any]]
892
+ control_weights : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
793
893
  Dict of weights for each control tag in metric calculation. Each control tag (e.g. label or choice) will have its own key in control weight dict with weight for each label and overall weight. For example, if a bounding box annotation with a control tag named my_bbox should be included with 0.33 weight in agreement calculation, and the first label Car should be twice as important as Airplane, then you need to specify: {'my_bbox': {'type': 'RectangleLabels', 'labels': {'Car': 1.0, 'Airplane': 0.5}, 'overall': 0.33}
794
894
 
795
895
  workspace : typing.Optional[int]
@@ -808,12 +908,20 @@ class AsyncProjectsClient:
808
908
 
809
909
  Examples
810
910
  --------
811
- from label_studio_sdk.client import AsyncLabelStudio
911
+ import asyncio
912
+
913
+ from label_studio_sdk import AsyncLabelStudio
812
914
 
813
915
  client = AsyncLabelStudio(
814
916
  api_key="YOUR_API_KEY",
815
917
  )
816
- await client.projects.create()
918
+
919
+
920
+ async def main() -> None:
921
+ await client.projects.create()
922
+
923
+
924
+ asyncio.run(main())
817
925
  """
818
926
  _response = await self._client_wrapper.httpx_client.request(
819
927
  "api/projects/",
@@ -835,12 +943,21 @@ class AsyncProjectsClient:
835
943
  "workspace": workspace,
836
944
  "model_version": model_version,
837
945
  },
946
+ headers={
947
+ "content-type": "application/json",
948
+ },
838
949
  request_options=request_options,
839
950
  omit=OMIT,
840
951
  )
841
952
  try:
842
953
  if 200 <= _response.status_code < 300:
843
- return pydantic_v1.parse_obj_as(ProjectsCreateResponse, _response.json()) # type: ignore
954
+ return typing.cast(
955
+ ProjectsCreateResponse,
956
+ parse_obj_as(
957
+ type_=ProjectsCreateResponse, # type: ignore
958
+ object_=_response.json(),
959
+ ),
960
+ )
844
961
  _response_json = _response.json()
845
962
  except JSONDecodeError:
846
963
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -865,21 +982,37 @@ class AsyncProjectsClient:
865
982
 
866
983
  Examples
867
984
  --------
868
- from label_studio_sdk.client import AsyncLabelStudio
985
+ import asyncio
986
+
987
+ from label_studio_sdk import AsyncLabelStudio
869
988
 
870
989
  client = AsyncLabelStudio(
871
990
  api_key="YOUR_API_KEY",
872
991
  )
873
- await client.projects.get(
874
- id=1,
875
- )
992
+
993
+
994
+ async def main() -> None:
995
+ await client.projects.get(
996
+ id=1,
997
+ )
998
+
999
+
1000
+ asyncio.run(main())
876
1001
  """
877
1002
  _response = await self._client_wrapper.httpx_client.request(
878
- f"api/projects/{jsonable_encoder(id)}/", method="GET", request_options=request_options
1003
+ f"api/projects/{jsonable_encoder(id)}/",
1004
+ method="GET",
1005
+ request_options=request_options,
879
1006
  )
880
1007
  try:
881
1008
  if 200 <= _response.status_code < 300:
882
- return pydantic_v1.parse_obj_as(Project, _response.json()) # type: ignore
1009
+ return typing.cast(
1010
+ Project,
1011
+ parse_obj_as(
1012
+ type_=Project, # type: ignore
1013
+ object_=_response.json(),
1014
+ ),
1015
+ )
883
1016
  _response_json = _response.json()
884
1017
  except JSONDecodeError:
885
1018
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -887,6 +1020,7 @@ class AsyncProjectsClient:
887
1020
 
888
1021
  async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
889
1022
  """
1023
+
890
1024
  Delete a project by specified project ID. Deleting a project permanently removes all tasks, annotations, and project data from Label Studio.
891
1025
 
892
1026
  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](list).
@@ -905,17 +1039,27 @@ class AsyncProjectsClient:
905
1039
 
906
1040
  Examples
907
1041
  --------
908
- from label_studio_sdk.client import AsyncLabelStudio
1042
+ import asyncio
1043
+
1044
+ from label_studio_sdk import AsyncLabelStudio
909
1045
 
910
1046
  client = AsyncLabelStudio(
911
1047
  api_key="YOUR_API_KEY",
912
1048
  )
913
- await client.projects.delete(
914
- id=1,
915
- )
1049
+
1050
+
1051
+ async def main() -> None:
1052
+ await client.projects.delete(
1053
+ id=1,
1054
+ )
1055
+
1056
+
1057
+ asyncio.run(main())
916
1058
  """
917
1059
  _response = await self._client_wrapper.httpx_client.request(
918
- f"api/projects/{jsonable_encoder(id)}/", method="DELETE", request_options=request_options
1060
+ f"api/projects/{jsonable_encoder(id)}/",
1061
+ method="DELETE",
1062
+ request_options=request_options,
919
1063
  )
920
1064
  try:
921
1065
  if 200 <= _response.status_code < 300:
@@ -941,17 +1085,17 @@ class AsyncProjectsClient:
941
1085
  show_collab_predictions: typing.Optional[bool] = OMIT,
942
1086
  maximum_annotations: typing.Optional[int] = OMIT,
943
1087
  color: typing.Optional[str] = OMIT,
944
- control_weights: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
1088
+ control_weights: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
945
1089
  workspace: typing.Optional[int] = OMIT,
946
1090
  model_version: typing.Optional[str] = OMIT,
947
1091
  request_options: typing.Optional[RequestOptions] = None,
948
1092
  ) -> ProjectsUpdateResponse:
949
1093
  """
950
- Update the project settings for a specific project. For more information, see the following:
951
1094
 
952
- - [Create and configure projects](https://labelstud.io/guide/setup_project)
953
- - [Configure labeling interface](https://labelstud.io/guide/setup)
954
- - [Project settings](https://labelstud.io/guide/project_settings)
1095
+ Update the project settings for a specific project. For more information, see the following:
1096
+ * [Create and configure projects](https://labelstud.io/guide/setup_project)
1097
+ * [Configure labeling interface](https://labelstud.io/guide/setup)
1098
+ * [Project settings](https://labelstud.io/guide/project_settings)
955
1099
 
956
1100
  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](list).
957
1101
 
@@ -1002,7 +1146,7 @@ class AsyncProjectsClient:
1002
1146
  color : typing.Optional[str]
1003
1147
  Project color in HEX format
1004
1148
 
1005
- control_weights : typing.Optional[typing.Dict[str, typing.Any]]
1149
+ control_weights : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
1006
1150
  Dict of weights for each control tag in metric calculation. Each control tag (e.g. label or choice) will have its own key in control weight dict with weight for each label and overall weight. For example, if a bounding box annotation with a control tag named my_bbox should be included with 0.33 weight in agreement calculation, and the first label Car should be twice as important as Airplane, then you need to specify: {'my_bbox': {'type': 'RectangleLabels', 'labels': {'Car': 1.0, 'Airplane': 0.5}, 'overall': 0.33}
1007
1151
 
1008
1152
  workspace : typing.Optional[int]
@@ -1021,14 +1165,22 @@ class AsyncProjectsClient:
1021
1165
 
1022
1166
  Examples
1023
1167
  --------
1024
- from label_studio_sdk.client import AsyncLabelStudio
1168
+ import asyncio
1169
+
1170
+ from label_studio_sdk import AsyncLabelStudio
1025
1171
 
1026
1172
  client = AsyncLabelStudio(
1027
1173
  api_key="YOUR_API_KEY",
1028
1174
  )
1029
- await client.projects.update(
1030
- id=1,
1031
- )
1175
+
1176
+
1177
+ async def main() -> None:
1178
+ await client.projects.update(
1179
+ id=1,
1180
+ )
1181
+
1182
+
1183
+ asyncio.run(main())
1032
1184
  """
1033
1185
  _response = await self._client_wrapper.httpx_client.request(
1034
1186
  f"api/projects/{jsonable_encoder(id)}/",
@@ -1050,12 +1202,21 @@ class AsyncProjectsClient:
1050
1202
  "workspace": workspace,
1051
1203
  "model_version": model_version,
1052
1204
  },
1205
+ headers={
1206
+ "content-type": "application/json",
1207
+ },
1053
1208
  request_options=request_options,
1054
1209
  omit=OMIT,
1055
1210
  )
1056
1211
  try:
1057
1212
  if 200 <= _response.status_code < 300:
1058
- return pydantic_v1.parse_obj_as(ProjectsUpdateResponse, _response.json()) # type: ignore
1213
+ return typing.cast(
1214
+ ProjectsUpdateResponse,
1215
+ parse_obj_as(
1216
+ type_=ProjectsUpdateResponse, # type: ignore
1217
+ object_=_response.json(),
1218
+ ),
1219
+ )
1059
1220
  _response_json = _response.json()
1060
1221
  except JSONDecodeError:
1061
1222
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -1065,26 +1226,26 @@ class AsyncProjectsClient:
1065
1226
  self,
1066
1227
  id: int,
1067
1228
  *,
1068
- request: typing.Sequence[typing.Dict[str, typing.Any]],
1229
+ request: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
1069
1230
  commit_to_project: typing.Optional[bool] = None,
1070
1231
  return_task_ids: typing.Optional[bool] = None,
1071
1232
  preannotated_from_fields: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
1072
1233
  request_options: typing.Optional[RequestOptions] = None,
1073
1234
  ) -> ProjectsImportTasksResponse:
1074
1235
  """
1236
+
1075
1237
  Use this API endpoint to import labeling tasks in bulk. Note that each POST request is limited at 250K tasks and 200 MB.
1076
- 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).
1238
+ 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).
1077
1239
 
1078
1240
  <Note>
1079
- Imported data is verified against a project *label_config* and must include all variables that were used in the *label_config*.
1241
+ Imported data is verified against a project *label_config* and must include all variables that were used in the *label_config*.
1080
1242
 
1081
- For example, if the label configuration has a _$text_ variable, then each item in a data object must include a `text` field.
1243
+ For example, if the label configuration has a *$text* variable, then each item in a data object must include a `text` field.
1082
1244
  </Note>
1083
1245
 
1084
1246
  There are three possible ways to import tasks with this endpoint:
1085
1247
 
1086
1248
  #### 1\. **POST with data**
1087
-
1088
1249
  Send JSON tasks as POST data. Only JSON is supported for POSTing files directly.
1089
1250
 
1090
1251
  Update this example to specify your authorization token and Label Studio instance host, then run the following from
@@ -1096,7 +1257,6 @@ class AsyncProjectsClient:
1096
1257
  ```
1097
1258
 
1098
1259
  #### 2\. **POST with files**
1099
-
1100
1260
  Send tasks as files. You can attach multiple files with different names.
1101
1261
 
1102
1262
  - **JSON**: text files in JavaScript object notation format
@@ -1113,7 +1273,6 @@ class AsyncProjectsClient:
1113
1273
  ```
1114
1274
 
1115
1275
  #### 3\. **POST with URL**
1116
-
1117
1276
  You can also provide a URL to a file with labeling tasks. Supported file formats are the same as in option 2.
1118
1277
 
1119
1278
  ```bash
@@ -1129,7 +1288,7 @@ class AsyncProjectsClient:
1129
1288
  id : int
1130
1289
  A unique integer value identifying this project.
1131
1290
 
1132
- request : typing.Sequence[typing.Dict[str, typing.Any]]
1291
+ request : typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]
1133
1292
 
1134
1293
  commit_to_project : typing.Optional[bool]
1135
1294
  Set to "true" to immediately commit tasks to the project.
@@ -1150,15 +1309,23 @@ class AsyncProjectsClient:
1150
1309
 
1151
1310
  Examples
1152
1311
  --------
1153
- from label_studio_sdk.client import AsyncLabelStudio
1312
+ import asyncio
1313
+
1314
+ from label_studio_sdk import AsyncLabelStudio
1154
1315
 
1155
1316
  client = AsyncLabelStudio(
1156
1317
  api_key="YOUR_API_KEY",
1157
1318
  )
1158
- await client.projects.import_tasks(
1159
- id=1,
1160
- request=[{"key": "value"}],
1161
- )
1319
+
1320
+
1321
+ async def main() -> None:
1322
+ await client.projects.import_tasks(
1323
+ id=1,
1324
+ request=[{"key": "value"}],
1325
+ )
1326
+
1327
+
1328
+ asyncio.run(main())
1162
1329
  """
1163
1330
  _response = await self._client_wrapper.httpx_client.request(
1164
1331
  f"api/projects/{jsonable_encoder(id)}/import",
@@ -1174,9 +1341,23 @@ class AsyncProjectsClient:
1174
1341
  )
1175
1342
  try:
1176
1343
  if 200 <= _response.status_code < 300:
1177
- return pydantic_v1.parse_obj_as(ProjectsImportTasksResponse, _response.json()) # type: ignore
1344
+ return typing.cast(
1345
+ ProjectsImportTasksResponse,
1346
+ parse_obj_as(
1347
+ type_=ProjectsImportTasksResponse, # type: ignore
1348
+ object_=_response.json(),
1349
+ ),
1350
+ )
1178
1351
  if _response.status_code == 400:
1179
- raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1352
+ raise BadRequestError(
1353
+ typing.cast(
1354
+ typing.Optional[typing.Any],
1355
+ parse_obj_as(
1356
+ type_=typing.Optional[typing.Any], # type: ignore
1357
+ object_=_response.json(),
1358
+ ),
1359
+ )
1360
+ )
1180
1361
  _response_json = _response.json()
1181
1362
  except JSONDecodeError:
1182
1363
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -1186,6 +1367,7 @@ class AsyncProjectsClient:
1186
1367
  self, id: int, *, label_config: str, request_options: typing.Optional[RequestOptions] = None
1187
1368
  ) -> ProjectLabelConfig:
1188
1369
  """
1370
+
1189
1371
  Determine whether the label configuration for a specific project is valid. For more information about setting up labeling configs, see [Configure labeling interface](https://labelstud.io/guide/setup) and our [Tags reference](https://labelstud.io/tags/).
1190
1372
 
1191
1373
  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](list).
@@ -1208,26 +1390,42 @@ class AsyncProjectsClient:
1208
1390
 
1209
1391
  Examples
1210
1392
  --------
1211
- from label_studio_sdk.client import AsyncLabelStudio
1393
+ import asyncio
1394
+
1395
+ from label_studio_sdk import AsyncLabelStudio
1212
1396
 
1213
1397
  client = AsyncLabelStudio(
1214
1398
  api_key="YOUR_API_KEY",
1215
1399
  )
1216
- await client.projects.validate_config(
1217
- id=1,
1218
- label_config="label_config",
1219
- )
1400
+
1401
+
1402
+ async def main() -> None:
1403
+ await client.projects.validate_config(
1404
+ id=1,
1405
+ label_config="label_config",
1406
+ )
1407
+
1408
+
1409
+ asyncio.run(main())
1220
1410
  """
1221
1411
  _response = await self._client_wrapper.httpx_client.request(
1222
1412
  f"api/projects/{jsonable_encoder(id)}/validate/",
1223
1413
  method="POST",
1224
- json={"label_config": label_config},
1414
+ json={
1415
+ "label_config": label_config,
1416
+ },
1225
1417
  request_options=request_options,
1226
1418
  omit=OMIT,
1227
1419
  )
1228
1420
  try:
1229
1421
  if 200 <= _response.status_code < 300:
1230
- return pydantic_v1.parse_obj_as(ProjectLabelConfig, _response.json()) # type: ignore
1422
+ return typing.cast(
1423
+ ProjectLabelConfig,
1424
+ parse_obj_as(
1425
+ type_=ProjectLabelConfig, # type: ignore
1426
+ object_=_response.json(),
1427
+ ),
1428
+ )
1231
1429
  _response_json = _response.json()
1232
1430
  except JSONDecodeError:
1233
1431
  raise ApiError(status_code=_response.status_code, body=_response.text)