label-studio-sdk 1.0.0__py3-none-any.whl → 1.0.2__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.
Files changed (99) hide show
  1. label_studio_sdk/__init__.py +46 -4
  2. label_studio_sdk/_extensions/pager_ext.py +49 -0
  3. label_studio_sdk/_legacy/schema/label_config_schema.json +14 -14
  4. label_studio_sdk/actions/__init__.py +27 -0
  5. label_studio_sdk/actions/client.py +129 -8
  6. label_studio_sdk/actions/types/__init__.py +27 -0
  7. label_studio_sdk/actions/types/actions_create_request_filters.py +43 -0
  8. label_studio_sdk/actions/types/actions_create_request_filters_conjunction.py +5 -0
  9. label_studio_sdk/actions/types/actions_create_request_filters_items_item.py +50 -0
  10. label_studio_sdk/actions/types/actions_create_request_filters_items_item_filter.py +31 -0
  11. label_studio_sdk/actions/types/actions_create_request_filters_items_item_operator.py +23 -0
  12. label_studio_sdk/actions/types/actions_create_request_filters_items_item_value.py +5 -0
  13. label_studio_sdk/actions/types/actions_create_request_id.py +19 -0
  14. label_studio_sdk/actions/types/actions_create_request_ordering_item.py +31 -0
  15. label_studio_sdk/actions/types/actions_create_request_selected_items.py +10 -0
  16. label_studio_sdk/actions/types/actions_create_request_selected_items_excluded.py +39 -0
  17. label_studio_sdk/actions/types/actions_create_request_selected_items_included.py +39 -0
  18. label_studio_sdk/base_client.py +183 -0
  19. label_studio_sdk/client.py +17 -175
  20. label_studio_sdk/core/client_wrapper.py +1 -1
  21. label_studio_sdk/core/http_client.py +5 -1
  22. label_studio_sdk/errors/bad_request_error.py +3 -1
  23. label_studio_sdk/export_storage/azure/client.py +176 -10
  24. label_studio_sdk/export_storage/azure/types/azure_create_response.py +15 -0
  25. label_studio_sdk/export_storage/azure/types/azure_update_response.py +15 -0
  26. label_studio_sdk/export_storage/gcs/client.py +180 -14
  27. label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +16 -1
  28. label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +16 -1
  29. label_studio_sdk/export_storage/local/client.py +168 -22
  30. label_studio_sdk/export_storage/local/types/local_create_response.py +12 -2
  31. label_studio_sdk/export_storage/local/types/local_update_response.py +12 -2
  32. label_studio_sdk/export_storage/redis/client.py +234 -30
  33. label_studio_sdk/export_storage/redis/types/redis_create_response.py +20 -5
  34. label_studio_sdk/export_storage/redis/types/redis_update_response.py +20 -5
  35. label_studio_sdk/export_storage/s3/client.py +214 -26
  36. label_studio_sdk/export_storage/s3/types/s3create_response.py +15 -0
  37. label_studio_sdk/export_storage/s3/types/s3update_response.py +15 -0
  38. label_studio_sdk/import_storage/azure/client.py +266 -90
  39. label_studio_sdk/import_storage/azure/types/azure_create_response.py +28 -18
  40. label_studio_sdk/import_storage/azure/types/azure_update_response.py +28 -18
  41. label_studio_sdk/import_storage/gcs/client.py +270 -94
  42. label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +28 -18
  43. label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +28 -18
  44. label_studio_sdk/import_storage/local/client.py +168 -22
  45. label_studio_sdk/import_storage/local/types/local_create_response.py +12 -2
  46. label_studio_sdk/import_storage/local/types/local_update_response.py +12 -2
  47. label_studio_sdk/import_storage/redis/client.py +206 -50
  48. label_studio_sdk/import_storage/redis/types/redis_create_response.py +20 -10
  49. label_studio_sdk/import_storage/redis/types/redis_update_response.py +20 -10
  50. label_studio_sdk/import_storage/s3/client.py +336 -110
  51. label_studio_sdk/import_storage/s3/types/s3create_response.py +35 -25
  52. label_studio_sdk/import_storage/s3/types/s3update_response.py +35 -25
  53. label_studio_sdk/{_legacy/label_interface → label_interface}/base.py +10 -0
  54. label_studio_sdk/{_legacy/label_interface → label_interface}/control_tags.py +109 -71
  55. label_studio_sdk/{_legacy/label_interface → label_interface}/interface.py +97 -51
  56. label_studio_sdk/{_legacy/label_interface → label_interface}/object_tags.py +8 -13
  57. label_studio_sdk/label_interface/objects.py +60 -0
  58. label_studio_sdk/label_interface/region.py +75 -0
  59. label_studio_sdk/projects/client.py +6 -4
  60. label_studio_sdk/projects/client_ext.py +19 -0
  61. label_studio_sdk/tasks/client.py +35 -8
  62. label_studio_sdk/tasks/client_ext.py +18 -0
  63. label_studio_sdk/types/__init__.py +10 -0
  64. label_studio_sdk/types/annotation.py +5 -5
  65. label_studio_sdk/types/annotations_dm_field.py +120 -0
  66. label_studio_sdk/types/annotations_dm_field_last_action.py +19 -0
  67. label_studio_sdk/types/data_manager_task_serializer.py +123 -0
  68. label_studio_sdk/types/data_manager_task_serializer_drafts_item.py +31 -0
  69. label_studio_sdk/types/data_manager_task_serializer_predictions_item.py +37 -0
  70. label_studio_sdk/types/task.py +1 -1
  71. label_studio_sdk/views/__init__.py +12 -4
  72. label_studio_sdk/views/types/__init__.py +12 -4
  73. label_studio_sdk/views/types/views_create_request_data.py +2 -2
  74. label_studio_sdk/views/types/views_create_request_data_filters.py +5 -5
  75. label_studio_sdk/views/types/views_create_request_data_filters_conjunction.py +1 -1
  76. label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +11 -8
  77. label_studio_sdk/views/types/views_create_request_data_filters_items_item_filter.py +31 -0
  78. label_studio_sdk/views/types/views_create_request_data_filters_items_item_operator.py +23 -0
  79. label_studio_sdk/views/types/views_create_request_data_filters_items_item_value.py +5 -0
  80. label_studio_sdk/views/types/views_create_request_data_ordering_item.py +27 -34
  81. label_studio_sdk/views/types/views_update_request_data.py +2 -2
  82. label_studio_sdk/views/types/views_update_request_data_filters.py +5 -5
  83. label_studio_sdk/views/types/views_update_request_data_filters_conjunction.py +1 -1
  84. label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +11 -8
  85. label_studio_sdk/views/types/views_update_request_data_filters_items_item_filter.py +31 -0
  86. label_studio_sdk/views/types/views_update_request_data_filters_items_item_operator.py +23 -0
  87. label_studio_sdk/views/types/views_update_request_data_filters_items_item_value.py +5 -0
  88. label_studio_sdk/views/types/views_update_request_data_ordering_item.py +27 -34
  89. label_studio_sdk-1.0.2.dist-info/METADATA +195 -0
  90. {label_studio_sdk-1.0.0.dist-info → label_studio_sdk-1.0.2.dist-info}/RECORD +94 -69
  91. label_studio_sdk/_legacy/label_interface/region.py +0 -43
  92. label_studio_sdk/_legacy/objects.py +0 -35
  93. label_studio_sdk/views/types/views_create_request_data_ordering_item_direction.py +0 -5
  94. label_studio_sdk/views/types/views_update_request_data_ordering_item_direction.py +0 -5
  95. label_studio_sdk-1.0.0.dist-info/METADATA +0 -307
  96. /label_studio_sdk/{_legacy/label_interface → label_interface}/__init__.py +0 -0
  97. /label_studio_sdk/{_legacy/label_interface → label_interface}/data_examples.json +0 -0
  98. /label_studio_sdk/{_legacy/label_interface → label_interface}/label_tags.py +0 -0
  99. {label_studio_sdk-1.0.0.dist-info → label_studio_sdk-1.0.2.dist-info}/WHEEL +0 -0
@@ -1,38 +1,31 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- import datetime as dt
4
3
  import typing
5
4
 
6
- from ...core.datetime_utils import serialize_datetime
7
- from ...core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
8
- from .views_create_request_data_ordering_item_direction import ViewsCreateRequestDataOrderingItemDirection
9
-
10
-
11
- class ViewsCreateRequestDataOrderingItem(pydantic_v1.BaseModel):
12
- column: typing.Optional[str] = pydantic_v1.Field(default=None)
13
- """
14
- Field name
15
- """
16
-
17
- direction: typing.Optional[ViewsCreateRequestDataOrderingItemDirection] = pydantic_v1.Field(default=None)
18
- """
19
- Order direction
20
- """
21
-
22
- def json(self, **kwargs: typing.Any) -> str:
23
- kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
24
- return super().json(**kwargs_with_defaults)
25
-
26
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
27
- kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
28
- kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
29
-
30
- return deep_union_pydantic_dicts(
31
- super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
32
- )
33
-
34
- class Config:
35
- frozen = True
36
- smart_union = True
37
- extra = pydantic_v1.Extra.allow
38
- json_encoders = {dt.datetime: serialize_datetime}
5
+ ViewsCreateRequestDataOrderingItem = typing.Union[
6
+ typing.Literal[
7
+ "tasks:agreement",
8
+ "tasks:annotations_results",
9
+ "tasks:annotators",
10
+ "tasks:cancelled_annotations",
11
+ "tasks:comments",
12
+ "tasks:completed_at",
13
+ "tasks:created_at",
14
+ "tasks:file_upload",
15
+ "tasks:ground_truth",
16
+ "tasks:id",
17
+ "tasks:inner_id",
18
+ "tasks:predictions_model_versions",
19
+ "tasks:predictions_results",
20
+ "tasks:predictions_score",
21
+ "tasks:reviewed",
22
+ "tasks:reviewers",
23
+ "tasks:reviews_accepted",
24
+ "tasks:reviews_rejected",
25
+ "tasks:total_annotations",
26
+ "tasks:total_predictions",
27
+ "tasks:unresolved_comment_count",
28
+ "tasks:updated_at",
29
+ ],
30
+ typing.Any,
31
+ ]
@@ -16,12 +16,12 @@ class ViewsUpdateRequestData(pydantic_v1.BaseModel):
16
16
 
17
17
  filters: typing.Optional[ViewsUpdateRequestDataFilters] = pydantic_v1.Field(default=None)
18
18
  """
19
- Filters for the view
19
+ Filters to apply on tasks. You can use [the helper class `Filters` from this page](https://labelstud.io/sdk/data_manager.html) to create Data Manager Filters.<br>Example: `{"conjunction": "or", "items": [{"filter": "filter:tasks:completed_at", "operator": "greater", "type": "Datetime", "value": "2021-01-01T00:00:00.000Z"}]}`
20
20
  """
21
21
 
22
22
  ordering: typing.Optional[typing.List[ViewsUpdateRequestDataOrderingItem]] = pydantic_v1.Field(default=None)
23
23
  """
24
- Ordering for the view
24
+ List of fields to order by. Fields are similar to filters but without the `filter:` prefix. To reverse the order, add a minus sign before the field name, e.g. `-tasks:created_at`.
25
25
  """
26
26
 
27
27
  def json(self, **kwargs: typing.Any) -> str:
@@ -11,17 +11,17 @@ from .views_update_request_data_filters_items_item import ViewsUpdateRequestData
11
11
 
12
12
  class ViewsUpdateRequestDataFilters(pydantic_v1.BaseModel):
13
13
  """
14
- Filters for the view
14
+ Filters to apply on tasks. You can use [the helper class `Filters` from this page](https://labelstud.io/sdk/data_manager.html) to create Data Manager Filters.<br>Example: `{"conjunction": "or", "items": [{"filter": "filter:tasks:completed_at", "operator": "greater", "type": "Datetime", "value": "2021-01-01T00:00:00.000Z"}]}`
15
15
  """
16
16
 
17
- conjunction: typing.Optional[ViewsUpdateRequestDataFiltersConjunction] = pydantic_v1.Field(default=None)
17
+ conjunction: ViewsUpdateRequestDataFiltersConjunction = pydantic_v1.Field()
18
18
  """
19
- Type of conjunction
19
+ Logical conjunction for the filters. This conjunction (either "or" or "and") will be applied to all items in the filters list. It is not possible to combine "or" and "and" within one list of filters. All filters will be either combined with "or" or with "and", but not a mix of both.
20
20
  """
21
21
 
22
- items: typing.Optional[typing.List[ViewsUpdateRequestDataFiltersItemsItem]] = pydantic_v1.Field(default=None)
22
+ items: typing.List[ViewsUpdateRequestDataFiltersItemsItem] = pydantic_v1.Field()
23
23
  """
24
- Filter items
24
+ List of filter items
25
25
  """
26
26
 
27
27
  def json(self, **kwargs: typing.Any) -> str:
@@ -2,4 +2,4 @@
2
2
 
3
3
  import typing
4
4
 
5
- ViewsUpdateRequestDataFiltersConjunction = typing.Union[typing.Literal["and", "or"], typing.Any]
5
+ ViewsUpdateRequestDataFiltersConjunction = typing.Union[typing.Literal["or", "and"], typing.Any]
@@ -5,27 +5,30 @@ import typing
5
5
 
6
6
  from ...core.datetime_utils import serialize_datetime
7
7
  from ...core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
8
+ from .views_update_request_data_filters_items_item_filter import ViewsUpdateRequestDataFiltersItemsItemFilter
9
+ from .views_update_request_data_filters_items_item_operator import ViewsUpdateRequestDataFiltersItemsItemOperator
10
+ from .views_update_request_data_filters_items_item_value import ViewsUpdateRequestDataFiltersItemsItemValue
8
11
 
9
12
 
10
13
  class ViewsUpdateRequestDataFiltersItemsItem(pydantic_v1.BaseModel):
11
- filter: typing.Optional[str] = pydantic_v1.Field(default=None)
14
+ filter: ViewsUpdateRequestDataFiltersItemsItemFilter = pydantic_v1.Field()
12
15
  """
13
- Field name
16
+ Filter identifier, it should start with `filter:tasks:` prefix, e.g. `filter:tasks:agreement`. For `task.data` fields it may look like `filter:tasks:data.field_name`. If you need more info about columns, check the [Get data manager columns](#tag/Data-Manager/operation/api_dm_columns_list) API endpoint. Possible values:<br><li>`filter:tasks:agreement`<br> (Number) Agreement for annotation results for a specific task (Enterprise only)</li><br><li>`filter:tasks:annotations_results`<br> (String) Annotation results for the tasks</li><br><li>`filter:tasks:annotators`<br> (List) Annotators that completed the task (Community). Can include assigned annotators (Enterprise only). Important note: the filter `type` should be List, but the filter `value` is integer</li><br><li>`filter:tasks:cancelled_annotations`<br> (Number) Number of cancelled or skipped annotations for the task</li><br><li>`filter:tasks:comments`<br> (Number) Number of comments in a task</li><br><li>`filter:tasks:completed_at`<br> (Datetime) Time when a task was fully annotated</li><br><li>`filter:tasks:created_at`<br> (Datetime) Time the task was created at</li><br><li>`filter:tasks:file_upload`<br> (String) Name of the file uploaded to create the tasks</li><br><li>`filter:tasks:ground_truth`<br> (Boolean) Ground truth status of the tasks</li><br><li>`filter:tasks:id`<br> (Number) Task ID</li><br><li>`filter:tasks:inner_id`<br> (Number) Task Inner ID, it starts from 1 for all projects</li><br><li>`filter:tasks:predictions_model_versions`<br> (String) Model version used for the predictions</li><br><li>`filter:tasks:predictions_results`<br> (String) Prediction results for the tasks</li><br><li>`filter:tasks:predictions_score`<br> (Number) Prediction score for the task</li><br><li>`filter:tasks:reviewed`<br> (Boolean) Whether the tasks have been reviewed (Enterprise only)</li><br><li>`filter:tasks:reviewers`<br> (String) Reviewers that reviewed the task, or assigned reviewers (Enterprise only). Important note: the filter `type` should be List, but the filter `value` is integer</li><br><li>`filter:tasks:reviews_accepted`<br> (Number) Number of annotations accepted for a task in review (Enterprise only)</li><br><li>`filter:tasks:reviews_rejected`<br> (Number) Number of annotations rejected for a task in review (Enterprise only)</li><br><li>`filter:tasks:total_annotations`<br> (Number) Total number of annotations on a task</li><br><li>`filter:tasks:total_predictions`<br> (Number) Total number of predictions for the task</li><br><li>`filter:tasks:unresolved_comment_count`<br> (Number) Number of unresolved comments in a task</li><br><li>`filter:tasks:updated_at`<br> (Datetime) Time the task was updated at (e.g. new annotation was created, review added, etc)</li>
14
17
  """
15
18
 
16
- type: typing.Optional[str] = pydantic_v1.Field(default=None)
19
+ operator: ViewsUpdateRequestDataFiltersItemsItemOperator = pydantic_v1.Field()
17
20
  """
18
- Field type
21
+ Filter operator. Possible values:<br><li>`contains`<br> Contains</li><br><li>`ends_with`<br> Ends with</li><br><li>`equal`<br> Equal to</li><br><li>`exists`<br> Exists</li><br><li>`greater`<br> Greater than</li><br><li>`greater_or_equal`<br> Greater than or equal to</li><br><li>`in`<br> Is between min and max values, so the filter `value` should be e.g. `{"min": 1, "max": 7}`</li><br><li>`less`<br> Less than</li><br><li>`less_or_equal`<br> Less than or equal to</li><br><li>`not_contains`<br> Does not contain</li><br><li>`not_equal`<br> Not equal to</li><br><li>`not_exists`<br> Does not exist</li><br><li>`not_in`<br> Is not between min and max values, so the filter `value` should be e.g. `{"min": 1, "max": 7}`</li><br><li>`starts_with`<br> Starts with</li>
19
22
  """
20
23
 
21
- operator: typing.Optional[str] = pydantic_v1.Field(default=None)
24
+ type: str = pydantic_v1.Field()
22
25
  """
23
- Filter operator
26
+ Type of the filter value. Possible values:<br><li>`Boolean`<br> Boolean</li><br><li>`Datetime`<br> Datetime string in `strftime('%Y-%m-%dT%H:%M:%S.%fZ')` format</li><br><li>`List`<br> List of items</li><br><li>`Number`<br> Float or Integer</li><br><li>`String`<br> String</li><br><li>`Unknown`<br> Unknown is explicitly converted to string format</li>
24
27
  """
25
28
 
26
- value: typing.Optional[str] = pydantic_v1.Field(default=None)
29
+ value: ViewsUpdateRequestDataFiltersItemsItemValue = pydantic_v1.Field()
27
30
  """
28
- Filter value
31
+ Value to filter by
29
32
  """
30
33
 
31
34
  def json(self, **kwargs: typing.Any) -> str:
@@ -0,0 +1,31 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ ViewsUpdateRequestDataFiltersItemsItemFilter = typing.Union[
6
+ typing.Literal[
7
+ "filter:tasks:agreement",
8
+ "filter:tasks:annotations_results",
9
+ "filter:tasks:annotators",
10
+ "filter:tasks:cancelled_annotations",
11
+ "filter:tasks:comments",
12
+ "filter:tasks:completed_at",
13
+ "filter:tasks:created_at",
14
+ "filter:tasks:file_upload",
15
+ "filter:tasks:ground_truth",
16
+ "filter:tasks:id",
17
+ "filter:tasks:inner_id",
18
+ "filter:tasks:predictions_model_versions",
19
+ "filter:tasks:predictions_results",
20
+ "filter:tasks:predictions_score",
21
+ "filter:tasks:reviewed",
22
+ "filter:tasks:reviewers",
23
+ "filter:tasks:reviews_accepted",
24
+ "filter:tasks:reviews_rejected",
25
+ "filter:tasks:total_annotations",
26
+ "filter:tasks:total_predictions",
27
+ "filter:tasks:unresolved_comment_count",
28
+ "filter:tasks:updated_at",
29
+ ],
30
+ typing.Any,
31
+ ]
@@ -0,0 +1,23 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ ViewsUpdateRequestDataFiltersItemsItemOperator = typing.Union[
6
+ typing.Literal[
7
+ "contains",
8
+ "ends_with",
9
+ "equal",
10
+ "exists",
11
+ "greater",
12
+ "greater_or_equal",
13
+ "in",
14
+ "less",
15
+ "less_or_equal",
16
+ "not_contains",
17
+ "not_equal",
18
+ "not_exists",
19
+ "not_in",
20
+ "starts_with",
21
+ ],
22
+ typing.Any,
23
+ ]
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ ViewsUpdateRequestDataFiltersItemsItemValue = typing.Union[str, int, float, bool, typing.Dict[str, typing.Any]]
@@ -1,38 +1,31 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- import datetime as dt
4
3
  import typing
5
4
 
6
- from ...core.datetime_utils import serialize_datetime
7
- from ...core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
8
- from .views_update_request_data_ordering_item_direction import ViewsUpdateRequestDataOrderingItemDirection
9
-
10
-
11
- class ViewsUpdateRequestDataOrderingItem(pydantic_v1.BaseModel):
12
- column: typing.Optional[str] = pydantic_v1.Field(default=None)
13
- """
14
- Field name
15
- """
16
-
17
- direction: typing.Optional[ViewsUpdateRequestDataOrderingItemDirection] = pydantic_v1.Field(default=None)
18
- """
19
- Order direction
20
- """
21
-
22
- def json(self, **kwargs: typing.Any) -> str:
23
- kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
24
- return super().json(**kwargs_with_defaults)
25
-
26
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
27
- kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
28
- kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
29
-
30
- return deep_union_pydantic_dicts(
31
- super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
32
- )
33
-
34
- class Config:
35
- frozen = True
36
- smart_union = True
37
- extra = pydantic_v1.Extra.allow
38
- json_encoders = {dt.datetime: serialize_datetime}
5
+ ViewsUpdateRequestDataOrderingItem = typing.Union[
6
+ typing.Literal[
7
+ "tasks:agreement",
8
+ "tasks:annotations_results",
9
+ "tasks:annotators",
10
+ "tasks:cancelled_annotations",
11
+ "tasks:comments",
12
+ "tasks:completed_at",
13
+ "tasks:created_at",
14
+ "tasks:file_upload",
15
+ "tasks:ground_truth",
16
+ "tasks:id",
17
+ "tasks:inner_id",
18
+ "tasks:predictions_model_versions",
19
+ "tasks:predictions_results",
20
+ "tasks:predictions_score",
21
+ "tasks:reviewed",
22
+ "tasks:reviewers",
23
+ "tasks:reviews_accepted",
24
+ "tasks:reviews_rejected",
25
+ "tasks:total_annotations",
26
+ "tasks:total_predictions",
27
+ "tasks:unresolved_comment_count",
28
+ "tasks:updated_at",
29
+ ],
30
+ typing.Any,
31
+ ]
@@ -0,0 +1,195 @@
1
+ Metadata-Version: 2.1
2
+ Name: label-studio-sdk
3
+ Version: 1.0.2
4
+ Summary:
5
+ Requires-Python: >=3.8,<4.0
6
+ Classifier: Intended Audience :: Developers
7
+ Classifier: Operating System :: MacOS
8
+ Classifier: Operating System :: Microsoft :: Windows
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Operating System :: POSIX
11
+ Classifier: Operating System :: POSIX :: Linux
12
+ Classifier: Programming Language :: Python
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.8
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Classifier: Typing :: Typed
21
+ Requires-Dist: Pillow (>=10.0.1)
22
+ Requires-Dist: appdirs (>=1.4.3)
23
+ Requires-Dist: httpx (>=0.21.2)
24
+ Requires-Dist: ijson (>=3.2.3)
25
+ Requires-Dist: jsonschema (==3.2.0)
26
+ Requires-Dist: lxml (>=4.2.5)
27
+ Requires-Dist: nltk (==3.6.7)
28
+ Requires-Dist: pandas (>=0.24.0)
29
+ Requires-Dist: pydantic (>=1.9.2)
30
+ Requires-Dist: requests (>=2.22.0)
31
+ Requires-Dist: requests-mock (==1.12.1)
32
+ Requires-Dist: typing_extensions (>=4.0.0)
33
+ Requires-Dist: ujson (>=5.8.0)
34
+ Requires-Dist: xmljson (==0.2.1)
35
+ Description-Content-Type: text/markdown
36
+
37
+ # Label Studio Python Library
38
+
39
+ <!-- Note about deprecated version <1 -->
40
+ ---
41
+ > :warning: **Note**<br/>
42
+ >
43
+ > The version of `label-studio-sdk<1` is deprecated and no longer supported. We recommend updating to the latest version.
44
+ > If you still want to use the old version, you can install it with `pip install "label-studio-sdk<1"`.
45
+ > OR You can find the branch with the old version by cloning the repository and checking out the branch as follows:
46
+ >
47
+ > ```sh
48
+ > git clone https://github.com/HumanSignal/label-studio-sdk.git
49
+ > cd label-studio-sdk
50
+ > git checkout previous-version
51
+ > ```
52
+ >
53
+ > OR you can change your import statements as follows:
54
+ > ```python
55
+ > from label_studio_sdk import Client
56
+ > from label_studio_sdk.data_manager import Filters, Column, Operator, Type
57
+ > from label_studio_sdk._legacy import Project
58
+ > ```
59
+ ---
60
+
61
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://github.com/fern-api/fern)
62
+ [![pypi](https://img.shields.io/pypi/v/label-studio-sdk.svg)](https://pypi.python.org/pypi/label-studio-sdk)
63
+
64
+ The Label Studio Python Library provides convenient access to the Label Studio API from applications written in Python.
65
+ <!-- End Title -->
66
+
67
+ <!-- Outline -->
68
+
69
+
70
+ # Documentation
71
+ Explore the Label Studio API documentation [here](https://api.labelstud.io/).
72
+
73
+
74
+ # Installation
75
+
76
+ ```sh
77
+ pip install --upgrade label-studio-sdk
78
+ # or
79
+ poetry add label-studio-sdk
80
+ ```
81
+
82
+ # Usage
83
+
84
+ ```python
85
+ from label_studio_sdk.client import LabelStudio
86
+
87
+ ls = LabelStudio(
88
+ base_url='YOUR_LABEL_STUDIO_URL',
89
+ api_key="YOUR_API_KEY",
90
+ )
91
+ ```
92
+
93
+ # Examples
94
+
95
+ Check more examples [here](https://api.labelstud.io/).
96
+
97
+ ## Create a new project
98
+
99
+ ```python
100
+ project = ls.projects.create(
101
+ name="Project name",
102
+ description="Project description",
103
+ label_config="""
104
+ <View>
105
+ <Image name="image" value="$image" />
106
+ <RectangleLabels name="label" toName="image">
107
+ <Label value="cat" />
108
+ <Label value="dog" />
109
+ </RectangleLabels>
110
+ </View>
111
+ """
112
+ )
113
+ ```
114
+
115
+ ## Create a new task
116
+
117
+ ```python
118
+ task = ls.tasks.create(
119
+ project=project.id,
120
+ data={"image": "https://example.com/image.jpg"}
121
+ )
122
+ ```
123
+ Now you can open the project `PROJECT_ID` in the Label Studio UI and create annotations for the task.
124
+
125
+ ## Export annotations
126
+
127
+ ```python
128
+ annotations = [
129
+ task.annotations
130
+ for task in ls.tasks.list(project=project.id, fields='all')
131
+ if task.annotations
132
+ ]
133
+ ```
134
+
135
+
136
+ ## Async client
137
+
138
+ ```python
139
+ from label_studio_sdk.client import AsyncLabelStudio
140
+
141
+ client = AsyncLabelStudio(
142
+ api_key="YOUR_API_KEY",
143
+ )
144
+ ```
145
+
146
+ ## Advanced
147
+
148
+ ### Timeouts
149
+ By default, requests time out after 60 seconds. You can configure this with a
150
+ timeout option at the client or request level.
151
+
152
+ ```python
153
+ from label_studio_sdk.client import LabelStudio
154
+
155
+ ls = LabelStudio(
156
+ # All timeouts set to 20 seconds
157
+ timeout=20.0
158
+ )
159
+
160
+ ls.projects.create(..., {
161
+ # Override timeout for a specific method
162
+ timeout=20.0
163
+ })
164
+ ```
165
+
166
+ ### Custom HTTP client
167
+ You can override the httpx client to customize it for your use-case. Some common use-cases
168
+ include support for proxies and transports.
169
+
170
+ ```python
171
+ import httpx
172
+
173
+ from label_studio_sdk.client import LabelStudio
174
+
175
+ ls = LabelStudio(
176
+ http_client=httpx.Client(
177
+ proxies="http://my.test.proxy.example.com",
178
+ transport=httpx.HTTPTransport(local_address="0.0.0.0"),
179
+ ),
180
+ )
181
+ ```
182
+
183
+ <!-- Begin Contributing, generated by Fern -->
184
+ # Contributing
185
+
186
+ While we value open-source contributions to this SDK, this library is generated programmatically.
187
+ Additions made directly to this library would have to be moved over to our generation code,
188
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
189
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
190
+ an issue first to discuss with us!
191
+
192
+ On the other hand, contributions to the README are always very welcome!
193
+ <!-- End Contributing -->
194
+
195
+