label-studio-sdk 1.0.20__py3-none-any.whl → 2.0.0__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.
- label_studio_sdk/__init__.py +325 -180
- label_studio_sdk/actions/__init__.py +4 -0
- label_studio_sdk/actions/client.py +46 -10
- label_studio_sdk/actions/types/__init__.py +4 -0
- label_studio_sdk/actions/types/actions_create_request_filters.py +2 -2
- label_studio_sdk/actions/types/actions_create_request_filters_items_item.py +2 -2
- label_studio_sdk/actions/types/actions_create_request_id.py +7 -7
- label_studio_sdk/actions/types/actions_create_request_selected_items_excluded.py +2 -2
- label_studio_sdk/actions/types/actions_create_request_selected_items_included.py +2 -2
- label_studio_sdk/actions/types/actions_list_response_item.py +25 -0
- label_studio_sdk/actions/types/actions_list_response_item_dialog.py +22 -0
- label_studio_sdk/annotations/__init__.py +2 -2
- label_studio_sdk/annotations/client.py +379 -243
- label_studio_sdk/annotations/types/__init__.py +4 -2
- label_studio_sdk/annotations/types/annotation_bulk_serializer_with_selected_items_request_last_action.py +7 -0
- label_studio_sdk/annotations/types/annotations_create_bulk_response_item.py +8 -5
- label_studio_sdk/base_client.py +28 -24
- label_studio_sdk/comments/client.py +378 -140
- label_studio_sdk/converter/README.md +207 -0
- label_studio_sdk/converter/imports/coco.py +132 -23
- label_studio_sdk/core/__init__.py +4 -0
- label_studio_sdk/core/unchecked_base_model.py +305 -0
- label_studio_sdk/environment.py +1 -1
- label_studio_sdk/errors/__init__.py +10 -1
- label_studio_sdk/errors/forbidden_error.py +9 -0
- label_studio_sdk/errors/method_not_allowed_error.py +9 -0
- label_studio_sdk/export_storage/__init__.py +1 -24
- label_studio_sdk/export_storage/azure/__init__.py +0 -3
- label_studio_sdk/export_storage/azure/client.py +231 -273
- label_studio_sdk/export_storage/client.py +5 -5
- label_studio_sdk/export_storage/gcs/__init__.py +0 -3
- label_studio_sdk/export_storage/gcs/client.py +231 -273
- label_studio_sdk/export_storage/local/__init__.py +0 -3
- label_studio_sdk/export_storage/local/client.py +211 -253
- label_studio_sdk/export_storage/redis/__init__.py +0 -3
- label_studio_sdk/export_storage/redis/client.py +239 -281
- label_studio_sdk/export_storage/s3/__init__.py +0 -3
- label_studio_sdk/export_storage/s3/client.py +254 -296
- label_studio_sdk/export_storage/s3s/client.py +694 -210
- label_studio_sdk/export_storage/types/export_storage_list_types_response_item.py +2 -2
- label_studio_sdk/files/client.py +52 -71
- label_studio_sdk/import_storage/__init__.py +1 -24
- label_studio_sdk/import_storage/azure/__init__.py +0 -3
- label_studio_sdk/import_storage/azure/client.py +249 -299
- label_studio_sdk/import_storage/client.py +5 -5
- label_studio_sdk/import_storage/gcs/__init__.py +0 -3
- label_studio_sdk/import_storage/gcs/client.py +249 -299
- label_studio_sdk/import_storage/local/__init__.py +0 -3
- label_studio_sdk/import_storage/local/client.py +211 -257
- label_studio_sdk/import_storage/redis/__init__.py +0 -3
- label_studio_sdk/import_storage/redis/client.py +239 -285
- label_studio_sdk/import_storage/s3/__init__.py +0 -3
- label_studio_sdk/import_storage/s3/client.py +274 -324
- label_studio_sdk/import_storage/s3s/client.py +728 -434
- label_studio_sdk/import_storage/types/import_storage_list_types_response_item.py +2 -2
- label_studio_sdk/jwt_settings/client.py +56 -58
- label_studio_sdk/label_interface/control_tags.py +48 -8
- label_studio_sdk/label_interface/interface.py +261 -56
- label_studio_sdk/ml/__init__.py +2 -16
- label_studio_sdk/ml/client.py +196 -179
- label_studio_sdk/ml/types/__init__.py +2 -12
- label_studio_sdk/ml/types/ml_list_model_versions_response.py +20 -0
- label_studio_sdk/model_providers/__init__.py +3 -0
- label_studio_sdk/model_providers/client.py +280 -228
- label_studio_sdk/model_providers/types/__init__.py +5 -0
- label_studio_sdk/{prompts/types/prompts_batch_predictions_response.py → model_providers/types/model_providers_list_model_provider_choices_response.py} +3 -3
- label_studio_sdk/organizations/__init__.py +5 -0
- label_studio_sdk/organizations/client.py +331 -0
- label_studio_sdk/organizations/members/__init__.py +2 -0
- label_studio_sdk/organizations/members/client.py +290 -0
- label_studio_sdk/predictions/client.py +29 -77
- label_studio_sdk/projects/__init__.py +18 -9
- label_studio_sdk/projects/client.py +905 -414
- label_studio_sdk/projects/exports/__init__.py +2 -2
- label_studio_sdk/projects/exports/client.py +336 -396
- label_studio_sdk/projects/exports/client_ext.py +30 -30
- label_studio_sdk/projects/exports/types/__init__.py +1 -2
- label_studio_sdk/projects/exports/types/exports_convert_response.py +5 -9
- label_studio_sdk/projects/pauses/client.py +114 -105
- label_studio_sdk/projects/stats/__init__.py +5 -0
- label_studio_sdk/projects/stats/client.py +175 -0
- label_studio_sdk/projects/stats/types/__init__.py +8 -0
- label_studio_sdk/projects/stats/types/stats_iaa_response.py +44 -0
- label_studio_sdk/projects/stats/types/stats_iaa_response_common_tasks.py +7 -0
- label_studio_sdk/projects/stats/types/stats_iaa_response_iaa.py +5 -0
- label_studio_sdk/{types/base_task_file_upload.py → projects/stats/types/stats_iaa_response_std.py} +1 -1
- label_studio_sdk/projects/types/__init__.py +10 -6
- label_studio_sdk/projects/types/lse_project_create_request_sampling.py +7 -0
- label_studio_sdk/projects/types/lse_project_create_request_skip_queue.py +7 -0
- label_studio_sdk/projects/types/patched_lse_project_update_request_sampling.py +7 -0
- label_studio_sdk/projects/types/patched_lse_project_update_request_skip_queue.py +7 -0
- label_studio_sdk/{prompts/types/prompts_batch_failed_predictions_response.py → projects/types/projects_duplicate_response.py} +8 -5
- label_studio_sdk/projects/types/projects_import_tasks_response.py +2 -2
- label_studio_sdk/projects/types/projects_list_request_filter.py +1 -1
- label_studio_sdk/prompts/__init__.py +4 -10
- label_studio_sdk/prompts/client.py +511 -442
- label_studio_sdk/prompts/indicators/__init__.py +3 -0
- label_studio_sdk/prompts/indicators/client.py +47 -49
- label_studio_sdk/prompts/indicators/types/__init__.py +5 -0
- label_studio_sdk/{types/key_indicator_value.py → prompts/indicators/types/indicators_list_response_item.py} +3 -3
- label_studio_sdk/prompts/runs/client.py +113 -135
- label_studio_sdk/prompts/types/__init__.py +2 -12
- label_studio_sdk/prompts/types/prompts_compatible_projects_request_project_type.py +7 -0
- label_studio_sdk/prompts/versions/client.py +372 -312
- label_studio_sdk/tasks/__init__.py +2 -2
- label_studio_sdk/tasks/client.py +514 -213
- label_studio_sdk/tasks/types/__init__.py +1 -2
- label_studio_sdk/tokens/client.py +160 -152
- label_studio_sdk/tokens/client_ext.py +3 -3
- label_studio_sdk/types/__init__.py +258 -142
- label_studio_sdk/{webhooks/types/webhooks_update_request_actions_item.py → types/actions_enum.py} +4 -1
- label_studio_sdk/types/all_roles_project_list.py +197 -0
- label_studio_sdk/types/all_roles_project_list_sampling.py +7 -0
- label_studio_sdk/types/all_roles_project_list_skip_queue.py +7 -0
- label_studio_sdk/types/annotated_enum.py +5 -0
- label_studio_sdk/types/annotation.py +24 -10
- label_studio_sdk/types/annotation_last_action.py +3 -15
- label_studio_sdk/types/{annotations_dm_field.py → annotation_request.py} +21 -30
- label_studio_sdk/types/annotation_request_last_action.py +7 -0
- label_studio_sdk/types/assignment_settings.py +31 -0
- label_studio_sdk/types/assignment_settings_label_stream_task_distribution.py +7 -0
- label_studio_sdk/types/assignment_settings_request.py +32 -0
- label_studio_sdk/types/assignment_settings_request_label_stream_task_distribution.py +7 -0
- label_studio_sdk/types/{key_indicators_item_additional_kpis_item.py → associated_project.py} +9 -6
- label_studio_sdk/types/auth_method_enum.py +5 -0
- label_studio_sdk/types/azure_blob_export_storage.py +8 -12
- label_studio_sdk/types/azure_blob_import_storage.py +8 -12
- label_studio_sdk/types/{prompt_associated_projects_item_id.py → batch_failed_predictions.py} +4 -4
- label_studio_sdk/types/{access_token_response.py → batch_predictions.py} +6 -8
- label_studio_sdk/types/blank_enum.py +5 -0
- label_studio_sdk/types/{key_indicators_item_extra_kpis_item.py → blueprint_list.py} +12 -6
- label_studio_sdk/types/budget_reset_period_enum.py +5 -0
- label_studio_sdk/types/child_filter.py +44 -0
- label_studio_sdk/types/comment.py +39 -14
- label_studio_sdk/types/comment_request.py +32 -0
- label_studio_sdk/types/comment_serializer_with_expanded_user.py +53 -0
- label_studio_sdk/types/converted_format.py +5 -5
- label_studio_sdk/types/{api_token_response.py → converted_format_request.py} +8 -15
- label_studio_sdk/types/custom_scripts_editable_by_enum.py +5 -0
- label_studio_sdk/types/default_role_enum.py +5 -0
- label_studio_sdk/types/edition_enum.py +5 -0
- label_studio_sdk/types/export.py +7 -7
- label_studio_sdk/types/file_upload.py +5 -5
- label_studio_sdk/types/filter.py +9 -6
- label_studio_sdk/types/filter_group.py +3 -3
- label_studio_sdk/types/finished_enum.py +5 -0
- label_studio_sdk/types/gcs_export_storage.py +8 -12
- label_studio_sdk/types/gcs_import_storage.py +8 -12
- label_studio_sdk/types/{rotate_token_response.py → hotkeys.py} +5 -8
- label_studio_sdk/types/{base_task.py → import_api_request.py} +11 -34
- label_studio_sdk/types/inference_run_cost_estimate.py +2 -2
- label_studio_sdk/types/label_stream_task_distribution_enum.py +5 -0
- label_studio_sdk/types/{annotations_dm_field_last_action.py → last_action_enum.py} +1 -1
- label_studio_sdk/types/local_files_export_storage.py +8 -12
- label_studio_sdk/types/local_files_import_storage.py +8 -12
- label_studio_sdk/types/{annotation_filter_options.py → lse_annotation_filter_options.py} +12 -2
- label_studio_sdk/types/lse_annotation_filter_options_request.py +42 -0
- label_studio_sdk/types/lse_annotation_filter_options_request_reviewed.py +7 -0
- label_studio_sdk/types/lse_annotation_filter_options_reviewed.py +7 -0
- label_studio_sdk/types/{export_snapshot.py → lse_export_create.py} +11 -11
- label_studio_sdk/types/lse_fields.py +49 -0
- label_studio_sdk/types/lse_fields_onboarding_state.py +8 -0
- label_studio_sdk/types/lse_fields_trial_role.py +8 -0
- label_studio_sdk/types/lse_key_indicator_value.py +35 -0
- label_studio_sdk/types/lse_organization.py +57 -0
- label_studio_sdk/types/lse_organization_custom_scripts_editable_by.py +7 -0
- label_studio_sdk/types/lse_project_create.py +196 -0
- label_studio_sdk/types/lse_project_create_sampling.py +7 -0
- label_studio_sdk/types/lse_project_create_skip_queue.py +7 -0
- label_studio_sdk/types/lse_project_update.py +215 -0
- label_studio_sdk/types/lse_project_update_sampling.py +7 -0
- label_studio_sdk/types/lse_project_update_skip_queue.py +7 -0
- label_studio_sdk/types/lse_s3export_storage.py +134 -0
- label_studio_sdk/{import_storage/s3/types/s3create_response.py → types/lse_s3export_storage_request.py} +47 -21
- label_studio_sdk/{import_storage/s3/types/s3update_response.py → types/lse_s3import_storage.py} +60 -21
- label_studio_sdk/types/{s3s_import_storage.py → lse_s3import_storage_request.py} +32 -21
- label_studio_sdk/types/lse_task.py +117 -0
- label_studio_sdk/types/{data_manager_task_serializer_drafts_item.py → lse_task_drafts_item.py} +2 -2
- label_studio_sdk/types/lse_task_filter_options.py +63 -0
- label_studio_sdk/types/lse_task_filter_options_annotated.py +7 -0
- label_studio_sdk/types/lse_task_filter_options_finished.py +7 -0
- label_studio_sdk/types/lse_task_filter_options_request.py +63 -0
- label_studio_sdk/types/lse_task_filter_options_request_annotated.py +7 -0
- label_studio_sdk/types/lse_task_filter_options_request_finished.py +7 -0
- label_studio_sdk/types/lse_task_filter_options_request_reviewed.py +7 -0
- label_studio_sdk/types/lse_task_filter_options_request_skipped.py +7 -0
- label_studio_sdk/types/lse_task_filter_options_reviewed.py +7 -0
- label_studio_sdk/types/lse_task_filter_options_skipped.py +7 -0
- label_studio_sdk/types/{data_manager_task_serializer_predictions_item.py → lse_task_predictions_item.py} +4 -5
- label_studio_sdk/types/lse_task_serializer_for_annotators.py +54 -0
- label_studio_sdk/types/lse_task_serializer_for_annotators_drafts_item.py +22 -0
- label_studio_sdk/types/lse_task_serializer_for_annotators_predictions_item.py +28 -0
- label_studio_sdk/types/lse_task_serializer_for_reviewers.py +117 -0
- label_studio_sdk/types/lse_task_serializer_for_reviewers_drafts_item.py +22 -0
- label_studio_sdk/types/lse_task_serializer_for_reviewers_predictions_item.py +28 -0
- label_studio_sdk/types/lse_user.py +49 -0
- label_studio_sdk/types/{base_user.py → lse_user_api.py} +17 -6
- label_studio_sdk/types/lseapi_token_create.py +21 -0
- label_studio_sdk/types/lseapi_token_list.py +21 -0
- label_studio_sdk/types/lsejwt_settings.py +32 -0
- label_studio_sdk/types/maybe_expanded_comment.py +7 -0
- label_studio_sdk/types/ml_backend.py +16 -17
- label_studio_sdk/types/mode_enum.py +5 -0
- label_studio_sdk/types/model_interface.py +44 -0
- label_studio_sdk/types/model_interface_request.py +40 -0
- label_studio_sdk/types/model_interface_serializer_get.py +45 -0
- label_studio_sdk/types/model_provider_connection.py +48 -17
- label_studio_sdk/types/model_provider_connection_budget_reset_period.py +3 -1
- label_studio_sdk/types/model_provider_connection_request.py +71 -0
- label_studio_sdk/types/model_run.py +40 -0
- label_studio_sdk/types/{inference_run_status.py → model_run_status_enum.py} +1 -1
- label_studio_sdk/types/null_enum.py +3 -0
- label_studio_sdk/types/onboarding_state_enum.py +7 -0
- label_studio_sdk/types/organization_billing.py +20 -0
- label_studio_sdk/types/organization_id.py +28 -0
- label_studio_sdk/types/organization_invite.py +20 -0
- label_studio_sdk/types/organization_member.py +37 -0
- label_studio_sdk/types/organization_membership.py +24 -0
- label_studio_sdk/{projects/types/projects_list_response.py → types/paginated_all_roles_project_list_list.py} +5 -5
- label_studio_sdk/types/{jwt_settings_response.py → paginated_role_based_task_list.py} +11 -9
- label_studio_sdk/types/pause.py +55 -14
- label_studio_sdk/types/pause_request.py +41 -0
- label_studio_sdk/types/prediction.py +7 -11
- label_studio_sdk/types/prediction_request.py +56 -0
- label_studio_sdk/types/project.py +32 -39
- label_studio_sdk/types/project_import.py +12 -13
- label_studio_sdk/types/project_label_config.py +2 -2
- label_studio_sdk/types/project_label_config_request.py +22 -0
- label_studio_sdk/types/project_sampling.py +3 -3
- label_studio_sdk/types/project_skip_queue.py +3 -1
- label_studio_sdk/types/project_subset_enum.py +5 -0
- label_studio_sdk/types/{prompt_version_provider.py → provider_enum.py} +1 -1
- label_studio_sdk/types/reason_enum.py +7 -0
- label_studio_sdk/types/redis_export_storage.py +8 -12
- label_studio_sdk/types/redis_import_storage.py +8 -12
- label_studio_sdk/types/refined_prompt_response.py +5 -6
- label_studio_sdk/types/requeue_rejected_tasks_mode_enum.py +5 -0
- label_studio_sdk/types/review_criteria_enum.py +5 -0
- label_studio_sdk/types/review_settings.py +80 -0
- label_studio_sdk/types/review_settings_request.py +80 -0
- label_studio_sdk/types/review_settings_request_requeue_rejected_tasks_mode.py +8 -0
- label_studio_sdk/types/review_settings_request_review_criteria.py +7 -0
- label_studio_sdk/types/review_settings_requeue_rejected_tasks_mode.py +8 -0
- label_studio_sdk/types/review_settings_review_criteria.py +7 -0
- label_studio_sdk/types/reviewed_enum.py +5 -0
- label_studio_sdk/types/role_based_task.py +8 -0
- label_studio_sdk/types/s3export_storage.py +8 -12
- label_studio_sdk/types/s3import_storage.py +8 -12
- label_studio_sdk/types/sampling_enum.py +7 -0
- label_studio_sdk/types/scope_enum.py +5 -0
- label_studio_sdk/types/selected_items_request.py +23 -0
- label_studio_sdk/types/serialization_option.py +2 -6
- label_studio_sdk/types/serialization_option_request.py +22 -0
- label_studio_sdk/types/serialization_options.py +17 -5
- label_studio_sdk/types/serialization_options_request.py +47 -0
- label_studio_sdk/types/skill_name_enum.py +5 -0
- label_studio_sdk/types/skip_queue_enum.py +5 -0
- label_studio_sdk/types/skipped_enum.py +5 -0
- label_studio_sdk/types/state_enum.py +5 -0
- label_studio_sdk/types/status7bf_enum.py +5 -0
- label_studio_sdk/types/{azure_blob_import_storage_status.py → status_c5a_enum.py} +2 -2
- label_studio_sdk/types/third_party_model_version.py +65 -0
- label_studio_sdk/types/third_party_model_version_request.py +54 -0
- label_studio_sdk/types/token_refresh_response.py +19 -0
- label_studio_sdk/types/token_rotate_response.py +19 -0
- label_studio_sdk/types/trial_role_enum.py +16 -0
- label_studio_sdk/types/user_simple.py +8 -5
- label_studio_sdk/types/user_simple_request.py +28 -0
- label_studio_sdk/types/version_response.py +49 -0
- label_studio_sdk/types/view.py +8 -15
- label_studio_sdk/types/webhook.py +9 -13
- label_studio_sdk/types/webhook_serializer_for_update.py +15 -13
- label_studio_sdk/types/workspace.py +14 -34
- label_studio_sdk/types/workspace_member_create.py +27 -0
- label_studio_sdk/types/workspace_member_list.py +24 -0
- label_studio_sdk/users/client.py +604 -87
- label_studio_sdk/users/types/users_get_token_response.py +4 -11
- label_studio_sdk/users/types/users_reset_token_response.py +4 -11
- label_studio_sdk/versions/__init__.py +0 -3
- label_studio_sdk/versions/client.py +14 -14
- label_studio_sdk/views/client.py +227 -141
- label_studio_sdk/views/types/views_create_request_data.py +2 -2
- label_studio_sdk/views/types/views_create_request_data_filters.py +2 -2
- label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +2 -2
- label_studio_sdk/views/types/views_update_request_data.py +2 -2
- label_studio_sdk/views/types/views_update_request_data_filters.py +2 -2
- label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +2 -2
- label_studio_sdk/webhooks/__init__.py +36 -2
- label_studio_sdk/webhooks/client.py +173 -367
- label_studio_sdk/webhooks/types/__init__.py +34 -2
- label_studio_sdk/webhooks/types/webhooks_info_response.py +80 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_annotation_created.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_annotation_updated.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_annotations_created.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_annotations_deleted.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_label_link_created.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_label_link_deleted.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_label_link_updated.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_project_created.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_project_deleted.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_project_updated.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_review_created.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_review_updated.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_reviews_deleted.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_tasks_created.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_tasks_deleted.py +24 -0
- label_studio_sdk/workspaces/__init__.py +1 -2
- label_studio_sdk/workspaces/client.py +97 -117
- label_studio_sdk/workspaces/members/__init__.py +0 -3
- label_studio_sdk/workspaces/members/client.py +65 -81
- {label_studio_sdk-1.0.20.dist-info → label_studio_sdk-2.0.0.dist-info}/METADATA +1 -1
- label_studio_sdk-2.0.0.dist-info/RECORD +424 -0
- {label_studio_sdk-1.0.20.dist-info → label_studio_sdk-2.0.0.dist-info}/WHEEL +1 -1
- label_studio_sdk/annotations/types/annotations_create_bulk_request_selected_items.py +0 -34
- label_studio_sdk/export_storage/azure/types/__init__.py +0 -6
- label_studio_sdk/export_storage/azure/types/azure_create_response.py +0 -57
- label_studio_sdk/export_storage/azure/types/azure_update_response.py +0 -57
- label_studio_sdk/export_storage/gcs/types/__init__.py +0 -6
- label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +0 -57
- label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +0 -57
- label_studio_sdk/export_storage/local/types/__init__.py +0 -6
- label_studio_sdk/export_storage/local/types/local_create_response.py +0 -47
- label_studio_sdk/export_storage/local/types/local_update_response.py +0 -47
- label_studio_sdk/export_storage/redis/types/__init__.py +0 -6
- label_studio_sdk/export_storage/redis/types/redis_create_response.py +0 -62
- label_studio_sdk/export_storage/redis/types/redis_update_response.py +0 -62
- label_studio_sdk/export_storage/s3/types/__init__.py +0 -6
- label_studio_sdk/export_storage/s3/types/s3create_response.py +0 -81
- label_studio_sdk/export_storage/s3/types/s3update_response.py +0 -81
- label_studio_sdk/import_storage/azure/types/__init__.py +0 -6
- label_studio_sdk/import_storage/azure/types/azure_create_response.py +0 -72
- label_studio_sdk/import_storage/azure/types/azure_update_response.py +0 -72
- label_studio_sdk/import_storage/gcs/types/__init__.py +0 -6
- label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +0 -72
- label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +0 -72
- label_studio_sdk/import_storage/local/types/__init__.py +0 -6
- label_studio_sdk/import_storage/local/types/local_create_response.py +0 -47
- label_studio_sdk/import_storage/local/types/local_update_response.py +0 -47
- label_studio_sdk/import_storage/redis/types/__init__.py +0 -6
- label_studio_sdk/import_storage/redis/types/redis_create_response.py +0 -62
- label_studio_sdk/import_storage/redis/types/redis_update_response.py +0 -62
- label_studio_sdk/import_storage/s3/types/__init__.py +0 -6
- label_studio_sdk/ml/types/ml_create_response.py +0 -68
- label_studio_sdk/ml/types/ml_create_response_auth_method.py +0 -5
- label_studio_sdk/ml/types/ml_update_response.py +0 -68
- label_studio_sdk/ml/types/ml_update_response_auth_method.py +0 -5
- label_studio_sdk/projects/exports/types/exports_list_formats_response_item.py +0 -44
- label_studio_sdk/projects/types/projects_create_response.py +0 -91
- label_studio_sdk/projects/types/projects_update_response.py +0 -96
- label_studio_sdk/prompts/types/prompts_batch_failed_predictions_request_failed_predictions_item.py +0 -32
- label_studio_sdk/prompts/types/prompts_batch_predictions_request_results_item.py +0 -59
- label_studio_sdk/tasks/types/tasks_list_response.py +0 -38
- label_studio_sdk/types/annotation_completed_by.py +0 -6
- label_studio_sdk/types/azure_blob_export_storage_status.py +0 -7
- label_studio_sdk/types/base_task_updated_by.py +0 -7
- label_studio_sdk/types/comment_created_by.py +0 -5
- label_studio_sdk/types/converted_format_status.py +0 -5
- label_studio_sdk/types/data_manager_task_serializer.py +0 -118
- label_studio_sdk/types/data_manager_task_serializer_annotators_item.py +0 -5
- label_studio_sdk/types/data_manager_task_serializer_comment_authors_item.py +0 -5
- label_studio_sdk/types/data_manager_task_serializer_predictions_item_model_run.py +0 -5
- label_studio_sdk/types/export_format.py +0 -25
- label_studio_sdk/types/export_snapshot_status.py +0 -5
- label_studio_sdk/types/export_status.py +0 -5
- label_studio_sdk/types/gcs_export_storage_status.py +0 -7
- label_studio_sdk/types/gcs_import_storage_status.py +0 -7
- label_studio_sdk/types/inference_run.py +0 -34
- label_studio_sdk/types/inference_run_created_by.py +0 -5
- label_studio_sdk/types/inference_run_organization.py +0 -5
- label_studio_sdk/types/inference_run_project_subset.py +0 -5
- label_studio_sdk/types/key_indicators.py +0 -6
- label_studio_sdk/types/key_indicators_item.py +0 -41
- label_studio_sdk/types/local_files_export_storage_status.py +0 -7
- label_studio_sdk/types/local_files_import_storage_status.py +0 -7
- label_studio_sdk/types/ml_backend_auth_method.py +0 -5
- label_studio_sdk/types/ml_backend_state.py +0 -5
- label_studio_sdk/types/model_provider_connection_created_by.py +0 -5
- label_studio_sdk/types/model_provider_connection_organization.py +0 -5
- label_studio_sdk/types/model_provider_connection_provider.py +0 -7
- label_studio_sdk/types/model_provider_connection_scope.py +0 -5
- label_studio_sdk/types/pause_paused_by.py +0 -5
- label_studio_sdk/types/project_import_status.py +0 -5
- label_studio_sdk/types/prompt.py +0 -71
- label_studio_sdk/types/prompt_associated_projects_item.py +0 -6
- label_studio_sdk/types/prompt_created_by.py +0 -5
- label_studio_sdk/types/prompt_organization.py +0 -5
- label_studio_sdk/types/prompt_version.py +0 -32
- label_studio_sdk/types/prompt_version_created_by.py +0 -5
- label_studio_sdk/types/prompt_version_organization.py +0 -5
- label_studio_sdk/types/redis_export_storage_status.py +0 -7
- label_studio_sdk/types/redis_import_storage_status.py +0 -7
- label_studio_sdk/types/refined_prompt_response_refinement_status.py +0 -7
- label_studio_sdk/types/s3export_storage_status.py +0 -7
- label_studio_sdk/types/s3import_storage_status.py +0 -7
- label_studio_sdk/types/s3s_export_storage.py +0 -73
- label_studio_sdk/types/s3s_import_storage_status.py +0 -7
- label_studio_sdk/types/task.py +0 -156
- label_studio_sdk/types/task_annotators_item.py +0 -5
- label_studio_sdk/types/task_comment_authors_item.py +0 -5
- label_studio_sdk/types/task_filter_options.py +0 -39
- label_studio_sdk/types/webhook_actions_item.py +0 -21
- label_studio_sdk/types/webhook_serializer_for_update_actions_item.py +0 -21
- label_studio_sdk/versions/types/__init__.py +0 -6
- label_studio_sdk/versions/types/versions_get_response.py +0 -73
- label_studio_sdk/versions/types/versions_get_response_edition.py +0 -5
- label_studio_sdk/workspaces/members/types/__init__.py +0 -6
- label_studio_sdk/workspaces/members/types/members_create_response.py +0 -22
- label_studio_sdk/workspaces/members/types/members_list_response_item.py +0 -22
- label_studio_sdk-1.0.20.dist-info/RECORD +0 -374
- {label_studio_sdk-1.0.20.dist-info → label_studio_sdk-2.0.0.dist-info}/LICENSE +0 -0
|
@@ -6,19 +6,17 @@ from ...core.request_options import RequestOptions
|
|
|
6
6
|
from ...core.jsonable_encoder import jsonable_encoder
|
|
7
7
|
from json.decoder import JSONDecodeError
|
|
8
8
|
from ...core.api_error import ApiError
|
|
9
|
-
from .
|
|
10
|
-
from ...core.pydantic_utilities import parse_obj_as
|
|
9
|
+
from ...core.unchecked_base_model import construct_type
|
|
11
10
|
from ...types.export import Export
|
|
12
|
-
from ...types.
|
|
11
|
+
from ...types.user_simple_request import UserSimpleRequest
|
|
13
12
|
import datetime as dt
|
|
14
|
-
from ...types.
|
|
15
|
-
from ...types.
|
|
16
|
-
from ...types.
|
|
17
|
-
from ...types.
|
|
18
|
-
from ...types.
|
|
19
|
-
from ...types.
|
|
13
|
+
from ...types.status7bf_enum import Status7BfEnum
|
|
14
|
+
from ...types.converted_format_request import ConvertedFormatRequest
|
|
15
|
+
from ...types.lse_task_filter_options_request import LseTaskFilterOptionsRequest
|
|
16
|
+
from ...types.lse_annotation_filter_options_request import LseAnnotationFilterOptionsRequest
|
|
17
|
+
from ...types.serialization_options_request import SerializationOptionsRequest
|
|
18
|
+
from ...types.lse_export_create import LseExportCreate
|
|
20
19
|
from ...core.serialization import convert_and_respect_annotation_metadata
|
|
21
|
-
from ...types.export_format import ExportFormat
|
|
22
20
|
from .types.exports_convert_response import ExportsConvertResponse
|
|
23
21
|
from ...core.client_wrapper import AsyncClientWrapper
|
|
24
22
|
|
|
@@ -34,50 +32,47 @@ class ExportsClient:
|
|
|
34
32
|
self,
|
|
35
33
|
id: int,
|
|
36
34
|
*,
|
|
37
|
-
export_type: typing.Optional[str] = None,
|
|
38
35
|
download_all_tasks: typing.Optional[bool] = None,
|
|
39
36
|
download_resources: typing.Optional[bool] = None,
|
|
40
|
-
|
|
37
|
+
export_type: typing.Optional[str] = None,
|
|
38
|
+
ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
41
39
|
request_options: typing.Optional[RequestOptions] = None,
|
|
42
40
|
) -> typing.Iterator[bytes]:
|
|
43
41
|
"""
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
43
|
+
<i>Note: if you have a large project it's recommended to use
|
|
44
|
+
export snapshots, this easy export endpoint might have timeouts.</i><br/><br>
|
|
45
|
+
Export annotated tasks as a file in a specific format.
|
|
46
|
+
For example, to export JSON annotations for a project to a file called `annotations.json`,
|
|
47
|
+
run the following from the command line:
|
|
48
|
+
```bash
|
|
49
|
+
curl -X GET http://localhost:8000/api/projects/{id}/export?exportType=JSON -H 'Authorization: Token abc123' --output 'annotations.json'
|
|
50
|
+
```
|
|
51
|
+
To export all tasks, including skipped tasks and others without annotations, run the following from the command line:
|
|
52
|
+
```bash
|
|
53
|
+
curl -X GET http://localhost:8000/api/projects/{id}/export?exportType=JSON&download_all_tasks=true -H 'Authorization: Token abc123' --output 'annotations.json'
|
|
54
|
+
```
|
|
55
|
+
To export specific tasks with IDs of 123 and 345, run the following from the command line:
|
|
56
|
+
```bash
|
|
57
|
+
curl -X GET 'http://localhost:8000/api/projects/{id}/export?ids[]=123&ids[]=345' -H 'Authorization: Token abc123' --output 'annotations.json'
|
|
58
|
+
```
|
|
59
|
+
|
|
62
60
|
|
|
63
61
|
Parameters
|
|
64
62
|
----------
|
|
65
63
|
id : int
|
|
66
64
|
A unique integer value identifying this project.
|
|
67
65
|
|
|
68
|
-
export_type : typing.Optional[str]
|
|
69
|
-
Selected export format (JSON by default)
|
|
70
|
-
|
|
71
66
|
download_all_tasks : typing.Optional[bool]
|
|
72
|
-
|
|
73
67
|
If true, download all tasks regardless of status. If false, download only annotated tasks.
|
|
74
68
|
|
|
75
69
|
download_resources : typing.Optional[bool]
|
|
76
|
-
|
|
77
70
|
If true, download all resource files such as images, audio, and others relevant to the tasks.
|
|
78
71
|
|
|
79
|
-
|
|
72
|
+
export_type : typing.Optional[str]
|
|
73
|
+
Selected export format (JSON by default)
|
|
80
74
|
|
|
75
|
+
ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
81
76
|
Specify a list of task IDs to retrieve only the details for those tasks.
|
|
82
77
|
|
|
83
78
|
request_options : typing.Optional[RequestOptions]
|
|
@@ -86,15 +81,15 @@ class ExportsClient:
|
|
|
86
81
|
Yields
|
|
87
82
|
------
|
|
88
83
|
typing.Iterator[bytes]
|
|
89
|
-
Exported data
|
|
84
|
+
Exported data
|
|
90
85
|
"""
|
|
91
86
|
with self._client_wrapper.httpx_client.stream(
|
|
92
87
|
f"api/projects/{jsonable_encoder(id)}/export",
|
|
93
88
|
method="GET",
|
|
94
89
|
params={
|
|
95
|
-
"export_type": export_type,
|
|
96
90
|
"download_all_tasks": download_all_tasks,
|
|
97
91
|
"download_resources": download_resources,
|
|
92
|
+
"export_type": export_type,
|
|
98
93
|
"ids": ids,
|
|
99
94
|
},
|
|
100
95
|
request_options=request_options,
|
|
@@ -111,14 +106,9 @@ class ExportsClient:
|
|
|
111
106
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
112
107
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
113
108
|
|
|
114
|
-
def list_formats(
|
|
115
|
-
self, id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
116
|
-
) -> typing.List[ExportsListFormatsResponseItem]:
|
|
109
|
+
def list_formats(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[str]:
|
|
117
110
|
"""
|
|
118
|
-
|
|
119
|
-
Before exporting annotations, you can check with formats are supported by the specified project. For more information about export formats, see [Export formats supported by Label Studio](https://labelstud.io/guide/export#Export-formats-supported-by-Label-Studio).
|
|
120
|
-
|
|
121
|
-
You must provide a project ID. 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).
|
|
111
|
+
Retrieve the available export formats for the current project by ID.
|
|
122
112
|
|
|
123
113
|
Parameters
|
|
124
114
|
----------
|
|
@@ -130,7 +120,7 @@ class ExportsClient:
|
|
|
130
120
|
|
|
131
121
|
Returns
|
|
132
122
|
-------
|
|
133
|
-
typing.List[
|
|
123
|
+
typing.List[str]
|
|
134
124
|
Export formats
|
|
135
125
|
|
|
136
126
|
Examples
|
|
@@ -152,9 +142,9 @@ class ExportsClient:
|
|
|
152
142
|
try:
|
|
153
143
|
if 200 <= _response.status_code < 300:
|
|
154
144
|
return typing.cast(
|
|
155
|
-
typing.List[
|
|
156
|
-
|
|
157
|
-
type_=typing.List[
|
|
145
|
+
typing.List[str],
|
|
146
|
+
construct_type(
|
|
147
|
+
type_=typing.List[str], # type: ignore
|
|
158
148
|
object_=_response.json(),
|
|
159
149
|
),
|
|
160
150
|
)
|
|
@@ -163,18 +153,20 @@ class ExportsClient:
|
|
|
163
153
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
164
154
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
165
155
|
|
|
166
|
-
def list(
|
|
156
|
+
def list(
|
|
157
|
+
self, id: int, *, ordering: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
|
|
158
|
+
) -> typing.List[Export]:
|
|
167
159
|
"""
|
|
168
|
-
|
|
169
|
-
Returns a list of export file (snapshots) for a specific project by ID. 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).
|
|
170
|
-
|
|
171
|
-
Included in the response is information about each snapshot, such as who created it and what format it is in.
|
|
160
|
+
Returns a list of exported files for a specific project by ID.
|
|
172
161
|
|
|
173
162
|
Parameters
|
|
174
163
|
----------
|
|
175
|
-
|
|
164
|
+
id : int
|
|
176
165
|
A unique integer value identifying this project.
|
|
177
166
|
|
|
167
|
+
ordering : typing.Optional[str]
|
|
168
|
+
Which field to use when ordering the results.
|
|
169
|
+
|
|
178
170
|
request_options : typing.Optional[RequestOptions]
|
|
179
171
|
Request-specific configuration.
|
|
180
172
|
|
|
@@ -191,19 +183,22 @@ class ExportsClient:
|
|
|
191
183
|
api_key="YOUR_API_KEY",
|
|
192
184
|
)
|
|
193
185
|
client.projects.exports.list(
|
|
194
|
-
|
|
186
|
+
id=1,
|
|
195
187
|
)
|
|
196
188
|
"""
|
|
197
189
|
_response = self._client_wrapper.httpx_client.request(
|
|
198
|
-
f"api/projects/{jsonable_encoder(
|
|
190
|
+
f"api/projects/{jsonable_encoder(id)}/exports/",
|
|
199
191
|
method="GET",
|
|
192
|
+
params={
|
|
193
|
+
"ordering": ordering,
|
|
194
|
+
},
|
|
200
195
|
request_options=request_options,
|
|
201
196
|
)
|
|
202
197
|
try:
|
|
203
198
|
if 200 <= _response.status_code < 300:
|
|
204
199
|
return typing.cast(
|
|
205
200
|
typing.List[Export],
|
|
206
|
-
|
|
201
|
+
construct_type(
|
|
207
202
|
type_=typing.List[Export], # type: ignore
|
|
208
203
|
object_=_response.json(),
|
|
209
204
|
),
|
|
@@ -215,67 +210,55 @@ class ExportsClient:
|
|
|
215
210
|
|
|
216
211
|
def create(
|
|
217
212
|
self,
|
|
218
|
-
|
|
213
|
+
id: int,
|
|
219
214
|
*,
|
|
220
215
|
title: typing.Optional[str] = OMIT,
|
|
221
|
-
|
|
222
|
-
created_by: typing.Optional[UserSimple] = OMIT,
|
|
223
|
-
created_at: typing.Optional[dt.datetime] = OMIT,
|
|
216
|
+
created_by: typing.Optional[UserSimpleRequest] = OMIT,
|
|
224
217
|
finished_at: typing.Optional[dt.datetime] = OMIT,
|
|
225
|
-
status: typing.Optional[
|
|
218
|
+
status: typing.Optional[Status7BfEnum] = OMIT,
|
|
226
219
|
md5: typing.Optional[str] = OMIT,
|
|
227
|
-
counters: typing.Optional[typing.
|
|
228
|
-
converted_formats: typing.Optional[typing.Sequence[
|
|
229
|
-
task_filter_options: typing.Optional[
|
|
230
|
-
annotation_filter_options: typing.Optional[
|
|
231
|
-
serialization_options: typing.Optional[
|
|
220
|
+
counters: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
221
|
+
converted_formats: typing.Optional[typing.Sequence[ConvertedFormatRequest]] = OMIT,
|
|
222
|
+
task_filter_options: typing.Optional[LseTaskFilterOptionsRequest] = OMIT,
|
|
223
|
+
annotation_filter_options: typing.Optional[LseAnnotationFilterOptionsRequest] = OMIT,
|
|
224
|
+
serialization_options: typing.Optional[SerializationOptionsRequest] = OMIT,
|
|
232
225
|
request_options: typing.Optional[RequestOptions] = None,
|
|
233
|
-
) ->
|
|
226
|
+
) -> LseExportCreate:
|
|
234
227
|
"""
|
|
235
|
-
|
|
236
|
-
Create a new export request to start a background task and generate an export file (snapshot) for a specific project by ID. 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).
|
|
237
|
-
|
|
238
|
-
A snapshot is a static export of your project's data and annotations at a specific point in time. It captures the current state of your tasks, annotations, and other relevant data, allowing you to download and review them later. Snapshots are particularly useful for large projects as they help avoid timeouts during export operations by processing the data asynchronously.
|
|
239
|
-
|
|
240
|
-
For more information, see the [Label Studio documentation on exporting annotations](https://labelstud.io/guide/export.html).
|
|
228
|
+
Create a new export request to start a background task and generate an export file for a specific project by ID.
|
|
241
229
|
|
|
242
230
|
Parameters
|
|
243
231
|
----------
|
|
244
|
-
|
|
232
|
+
id : int
|
|
245
233
|
A unique integer value identifying this project.
|
|
246
234
|
|
|
247
235
|
title : typing.Optional[str]
|
|
248
236
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
created_by : typing.Optional[UserSimple]
|
|
252
|
-
|
|
253
|
-
created_at : typing.Optional[dt.datetime]
|
|
254
|
-
Creation time
|
|
237
|
+
created_by : typing.Optional[UserSimpleRequest]
|
|
255
238
|
|
|
256
239
|
finished_at : typing.Optional[dt.datetime]
|
|
257
240
|
Complete or fail time
|
|
258
241
|
|
|
259
|
-
status : typing.Optional[
|
|
242
|
+
status : typing.Optional[Status7BfEnum]
|
|
260
243
|
|
|
261
244
|
md5 : typing.Optional[str]
|
|
262
245
|
|
|
263
|
-
counters : typing.Optional[typing.
|
|
246
|
+
counters : typing.Optional[typing.Optional[typing.Any]]
|
|
264
247
|
|
|
265
|
-
converted_formats : typing.Optional[typing.Sequence[
|
|
248
|
+
converted_formats : typing.Optional[typing.Sequence[ConvertedFormatRequest]]
|
|
266
249
|
|
|
267
|
-
task_filter_options : typing.Optional[
|
|
250
|
+
task_filter_options : typing.Optional[LseTaskFilterOptionsRequest]
|
|
268
251
|
|
|
269
|
-
annotation_filter_options : typing.Optional[
|
|
252
|
+
annotation_filter_options : typing.Optional[LseAnnotationFilterOptionsRequest]
|
|
270
253
|
|
|
271
|
-
serialization_options : typing.Optional[
|
|
254
|
+
serialization_options : typing.Optional[SerializationOptionsRequest]
|
|
272
255
|
|
|
273
256
|
request_options : typing.Optional[RequestOptions]
|
|
274
257
|
Request-specific configuration.
|
|
275
258
|
|
|
276
259
|
Returns
|
|
277
260
|
-------
|
|
278
|
-
|
|
261
|
+
LseExportCreate
|
|
279
262
|
|
|
280
263
|
|
|
281
264
|
Examples
|
|
@@ -286,45 +269,46 @@ class ExportsClient:
|
|
|
286
269
|
api_key="YOUR_API_KEY",
|
|
287
270
|
)
|
|
288
271
|
client.projects.exports.create(
|
|
289
|
-
|
|
272
|
+
id=1,
|
|
290
273
|
)
|
|
291
274
|
"""
|
|
292
275
|
_response = self._client_wrapper.httpx_client.request(
|
|
293
|
-
f"api/projects/{jsonable_encoder(
|
|
276
|
+
f"api/projects/{jsonable_encoder(id)}/exports/",
|
|
294
277
|
method="POST",
|
|
295
278
|
json={
|
|
296
279
|
"title": title,
|
|
297
|
-
"id": id,
|
|
298
280
|
"created_by": convert_and_respect_annotation_metadata(
|
|
299
|
-
object_=created_by, annotation=
|
|
281
|
+
object_=created_by, annotation=UserSimpleRequest, direction="write"
|
|
300
282
|
),
|
|
301
|
-
"created_at": created_at,
|
|
302
283
|
"finished_at": finished_at,
|
|
303
284
|
"status": status,
|
|
304
285
|
"md5": md5,
|
|
305
286
|
"counters": counters,
|
|
306
287
|
"converted_formats": convert_and_respect_annotation_metadata(
|
|
307
|
-
object_=converted_formats, annotation=typing.Sequence[
|
|
288
|
+
object_=converted_formats, annotation=typing.Sequence[ConvertedFormatRequest], direction="write"
|
|
308
289
|
),
|
|
309
290
|
"task_filter_options": convert_and_respect_annotation_metadata(
|
|
310
|
-
object_=task_filter_options, annotation=
|
|
291
|
+
object_=task_filter_options, annotation=LseTaskFilterOptionsRequest, direction="write"
|
|
311
292
|
),
|
|
312
293
|
"annotation_filter_options": convert_and_respect_annotation_metadata(
|
|
313
|
-
object_=annotation_filter_options, annotation=
|
|
294
|
+
object_=annotation_filter_options, annotation=LseAnnotationFilterOptionsRequest, direction="write"
|
|
314
295
|
),
|
|
315
296
|
"serialization_options": convert_and_respect_annotation_metadata(
|
|
316
|
-
object_=serialization_options, annotation=
|
|
297
|
+
object_=serialization_options, annotation=SerializationOptionsRequest, direction="write"
|
|
317
298
|
),
|
|
318
299
|
},
|
|
300
|
+
headers={
|
|
301
|
+
"content-type": "application/json",
|
|
302
|
+
},
|
|
319
303
|
request_options=request_options,
|
|
320
304
|
omit=OMIT,
|
|
321
305
|
)
|
|
322
306
|
try:
|
|
323
307
|
if 200 <= _response.status_code < 300:
|
|
324
308
|
return typing.cast(
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
type_=
|
|
309
|
+
LseExportCreate,
|
|
310
|
+
construct_type(
|
|
311
|
+
type_=LseExportCreate, # type: ignore
|
|
328
312
|
object_=_response.json(),
|
|
329
313
|
),
|
|
330
314
|
)
|
|
@@ -333,80 +317,18 @@ class ExportsClient:
|
|
|
333
317
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
334
318
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
335
319
|
|
|
336
|
-
def
|
|
337
|
-
self,
|
|
338
|
-
project_id: int,
|
|
339
|
-
export_pk: str,
|
|
340
|
-
*,
|
|
341
|
-
export_type: typing.Optional[ExportFormat] = None,
|
|
342
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
343
|
-
) -> typing.Iterator[bytes]:
|
|
320
|
+
def get(self, export_pk: int, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> Export:
|
|
344
321
|
"""
|
|
345
|
-
|
|
346
|
-
Download an export snapshot as a file in a specified format. To see what formats are supported, you can use [Get export formats](list-formats) or see [Export formats supported by Label Studio](https://labelstud.io/guide/export#Export-formats-supported-by-Label-Studio).
|
|
347
|
-
|
|
348
|
-
You will need to provide the project ID and export ID (`export_pk`). The export ID is returned when you create the export or you can use [List all export snapshots](list).
|
|
349
|
-
|
|
350
|
-
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).
|
|
322
|
+
Retrieve information about an export file by export ID for a specific project.
|
|
351
323
|
|
|
352
324
|
Parameters
|
|
353
325
|
----------
|
|
354
|
-
|
|
355
|
-
A unique integer value identifying this project.
|
|
356
|
-
|
|
357
|
-
export_pk : str
|
|
326
|
+
export_pk : int
|
|
358
327
|
Primary key identifying the export file.
|
|
359
328
|
|
|
360
|
-
|
|
361
|
-
Selected export format. JSON is available by default. For other formats, you need to convert the export first.
|
|
362
|
-
|
|
363
|
-
request_options : typing.Optional[RequestOptions]
|
|
364
|
-
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
365
|
-
|
|
366
|
-
Yields
|
|
367
|
-
------
|
|
368
|
-
typing.Iterator[bytes]
|
|
369
|
-
Exported data in binary format
|
|
370
|
-
"""
|
|
371
|
-
with self._client_wrapper.httpx_client.stream(
|
|
372
|
-
f"api/projects/{jsonable_encoder(project_id)}/exports/{jsonable_encoder(export_pk)}/download",
|
|
373
|
-
method="GET",
|
|
374
|
-
params={
|
|
375
|
-
"exportType": export_type,
|
|
376
|
-
},
|
|
377
|
-
request_options=request_options,
|
|
378
|
-
) as _response:
|
|
379
|
-
try:
|
|
380
|
-
if 200 <= _response.status_code < 300:
|
|
381
|
-
_chunk_size = request_options.get("chunk_size", None) if request_options is not None else None
|
|
382
|
-
for _chunk in _response.iter_bytes(chunk_size=_chunk_size):
|
|
383
|
-
yield _chunk
|
|
384
|
-
return
|
|
385
|
-
_response.read()
|
|
386
|
-
_response_json = _response.json()
|
|
387
|
-
except JSONDecodeError:
|
|
388
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
389
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
390
|
-
|
|
391
|
-
def get(
|
|
392
|
-
self, project_id: int, export_pk: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
393
|
-
) -> Export:
|
|
394
|
-
"""
|
|
395
|
-
|
|
396
|
-
Retrieve information about a specific export file (snapshot).
|
|
397
|
-
|
|
398
|
-
You will need the export ID. You can find this in the response when you [create the snapshot via the API](create) or using [List all export snapshots](list).
|
|
399
|
-
|
|
400
|
-
You will also need the project ID. This 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).
|
|
401
|
-
|
|
402
|
-
Parameters
|
|
403
|
-
----------
|
|
404
|
-
project_id : int
|
|
329
|
+
id : int
|
|
405
330
|
A unique integer value identifying this project.
|
|
406
331
|
|
|
407
|
-
export_pk : str
|
|
408
|
-
Primary key identifying the export file.
|
|
409
|
-
|
|
410
332
|
request_options : typing.Optional[RequestOptions]
|
|
411
333
|
Request-specific configuration.
|
|
412
334
|
|
|
@@ -423,12 +345,12 @@ class ExportsClient:
|
|
|
423
345
|
api_key="YOUR_API_KEY",
|
|
424
346
|
)
|
|
425
347
|
client.projects.exports.get(
|
|
426
|
-
|
|
427
|
-
|
|
348
|
+
export_pk=1,
|
|
349
|
+
id=1,
|
|
428
350
|
)
|
|
429
351
|
"""
|
|
430
352
|
_response = self._client_wrapper.httpx_client.request(
|
|
431
|
-
f"api/projects/{jsonable_encoder(
|
|
353
|
+
f"api/projects/{jsonable_encoder(id)}/exports/{jsonable_encoder(export_pk)}",
|
|
432
354
|
method="GET",
|
|
433
355
|
request_options=request_options,
|
|
434
356
|
)
|
|
@@ -436,7 +358,7 @@ class ExportsClient:
|
|
|
436
358
|
if 200 <= _response.status_code < 300:
|
|
437
359
|
return typing.cast(
|
|
438
360
|
Export,
|
|
439
|
-
|
|
361
|
+
construct_type(
|
|
440
362
|
type_=Export, # type: ignore
|
|
441
363
|
object_=_response.json(),
|
|
442
364
|
),
|
|
@@ -446,23 +368,18 @@ class ExportsClient:
|
|
|
446
368
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
447
369
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
448
370
|
|
|
449
|
-
def delete(
|
|
450
|
-
self, project_id: int, export_pk: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
451
|
-
) -> None:
|
|
371
|
+
def delete(self, export_pk: int, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
452
372
|
"""
|
|
453
|
-
|
|
454
373
|
Delete an export file by specified export ID.
|
|
455
374
|
|
|
456
|
-
You will need the export ID. You can find this in the response when you [create the snapshot via the API](create) or using [List all export snapshots](list).
|
|
457
|
-
|
|
458
375
|
Parameters
|
|
459
376
|
----------
|
|
460
|
-
|
|
461
|
-
A unique integer value identifying this project.
|
|
462
|
-
|
|
463
|
-
export_pk : str
|
|
377
|
+
export_pk : int
|
|
464
378
|
Primary key identifying the export file.
|
|
465
379
|
|
|
380
|
+
id : int
|
|
381
|
+
A unique integer value identifying this project.
|
|
382
|
+
|
|
466
383
|
request_options : typing.Optional[RequestOptions]
|
|
467
384
|
Request-specific configuration.
|
|
468
385
|
|
|
@@ -478,12 +395,12 @@ class ExportsClient:
|
|
|
478
395
|
api_key="YOUR_API_KEY",
|
|
479
396
|
)
|
|
480
397
|
client.projects.exports.delete(
|
|
481
|
-
|
|
482
|
-
|
|
398
|
+
export_pk=1,
|
|
399
|
+
id=1,
|
|
483
400
|
)
|
|
484
401
|
"""
|
|
485
402
|
_response = self._client_wrapper.httpx_client.request(
|
|
486
|
-
f"api/projects/{jsonable_encoder(
|
|
403
|
+
f"api/projects/{jsonable_encoder(id)}/exports/{jsonable_encoder(export_pk)}",
|
|
487
404
|
method="DELETE",
|
|
488
405
|
request_options=request_options,
|
|
489
406
|
)
|
|
@@ -497,35 +414,29 @@ class ExportsClient:
|
|
|
497
414
|
|
|
498
415
|
def convert(
|
|
499
416
|
self,
|
|
500
|
-
|
|
501
|
-
|
|
417
|
+
export_pk: int,
|
|
418
|
+
id: int,
|
|
502
419
|
*,
|
|
503
|
-
export_type:
|
|
420
|
+
export_type: str,
|
|
504
421
|
download_resources: typing.Optional[bool] = OMIT,
|
|
505
422
|
request_options: typing.Optional[RequestOptions] = None,
|
|
506
423
|
) -> ExportsConvertResponse:
|
|
507
424
|
"""
|
|
508
|
-
|
|
509
|
-
You can use this to convert an export snapshot into the selected format.
|
|
510
|
-
|
|
511
|
-
To see what formats are supported, you can use [Get export formats](list-formats) or see [Export formats supported by Label Studio](https://labelstud.io/guide/export#Export-formats-supported-by-Label-Studio).
|
|
512
|
-
|
|
513
|
-
You will need to provide the project ID and export ID (`export_pk`). The export ID is returned when you create the export or you can use [List all export snapshots](list).
|
|
514
|
-
|
|
515
|
-
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).
|
|
425
|
+
Convert export snapshot to selected format
|
|
516
426
|
|
|
517
427
|
Parameters
|
|
518
428
|
----------
|
|
519
|
-
|
|
520
|
-
A unique integer value identifying this project.
|
|
521
|
-
|
|
522
|
-
export_pk : str
|
|
429
|
+
export_pk : int
|
|
523
430
|
Primary key identifying the export file.
|
|
524
431
|
|
|
525
|
-
|
|
432
|
+
id : int
|
|
433
|
+
A unique integer value identifying this project.
|
|
434
|
+
|
|
435
|
+
export_type : str
|
|
436
|
+
Export file format.
|
|
526
437
|
|
|
527
438
|
download_resources : typing.Optional[bool]
|
|
528
|
-
|
|
439
|
+
Download resources in converter.
|
|
529
440
|
|
|
530
441
|
request_options : typing.Optional[RequestOptions]
|
|
531
442
|
Request-specific configuration.
|
|
@@ -543,12 +454,13 @@ class ExportsClient:
|
|
|
543
454
|
api_key="YOUR_API_KEY",
|
|
544
455
|
)
|
|
545
456
|
client.projects.exports.convert(
|
|
546
|
-
|
|
547
|
-
|
|
457
|
+
export_pk=1,
|
|
458
|
+
id=1,
|
|
459
|
+
export_type="export_type",
|
|
548
460
|
)
|
|
549
461
|
"""
|
|
550
462
|
_response = self._client_wrapper.httpx_client.request(
|
|
551
|
-
f"api/projects/{jsonable_encoder(
|
|
463
|
+
f"api/projects/{jsonable_encoder(id)}/exports/{jsonable_encoder(export_pk)}/convert",
|
|
552
464
|
method="POST",
|
|
553
465
|
json={
|
|
554
466
|
"export_type": export_type,
|
|
@@ -564,7 +476,7 @@ class ExportsClient:
|
|
|
564
476
|
if 200 <= _response.status_code < 300:
|
|
565
477
|
return typing.cast(
|
|
566
478
|
ExportsConvertResponse,
|
|
567
|
-
|
|
479
|
+
construct_type(
|
|
568
480
|
type_=ExportsConvertResponse, # type: ignore
|
|
569
481
|
object_=_response.json(),
|
|
570
482
|
),
|
|
@@ -574,6 +486,63 @@ class ExportsClient:
|
|
|
574
486
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
575
487
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
576
488
|
|
|
489
|
+
def download(
|
|
490
|
+
self,
|
|
491
|
+
export_pk: int,
|
|
492
|
+
id: int,
|
|
493
|
+
*,
|
|
494
|
+
export_type: typing.Optional[str] = None,
|
|
495
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
496
|
+
) -> typing.Iterator[bytes]:
|
|
497
|
+
"""
|
|
498
|
+
|
|
499
|
+
Download an export file in the specified format for a specific project. Specify the project ID with the `id`
|
|
500
|
+
parameter in the path and the ID of the export file you want to download using the `export_pk` parameter
|
|
501
|
+
in the path.
|
|
502
|
+
|
|
503
|
+
Get the `export_pk` from the response of the request to [Create new export](/api#operation/api_projects_exports_create)
|
|
504
|
+
or after [listing export files](/api#operation/api_projects_exports_list).
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
Parameters
|
|
508
|
+
----------
|
|
509
|
+
export_pk : int
|
|
510
|
+
Primary key identifying the export file.
|
|
511
|
+
|
|
512
|
+
id : int
|
|
513
|
+
A unique integer value identifying this project.
|
|
514
|
+
|
|
515
|
+
export_type : typing.Optional[str]
|
|
516
|
+
Selected export format
|
|
517
|
+
|
|
518
|
+
request_options : typing.Optional[RequestOptions]
|
|
519
|
+
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
520
|
+
|
|
521
|
+
Yields
|
|
522
|
+
------
|
|
523
|
+
typing.Iterator[bytes]
|
|
524
|
+
Export file
|
|
525
|
+
"""
|
|
526
|
+
with self._client_wrapper.httpx_client.stream(
|
|
527
|
+
f"api/projects/{jsonable_encoder(id)}/exports/{jsonable_encoder(export_pk)}/download",
|
|
528
|
+
method="GET",
|
|
529
|
+
params={
|
|
530
|
+
"exportType": export_type,
|
|
531
|
+
},
|
|
532
|
+
request_options=request_options,
|
|
533
|
+
) as _response:
|
|
534
|
+
try:
|
|
535
|
+
if 200 <= _response.status_code < 300:
|
|
536
|
+
_chunk_size = request_options.get("chunk_size", None) if request_options is not None else None
|
|
537
|
+
for _chunk in _response.iter_bytes(chunk_size=_chunk_size):
|
|
538
|
+
yield _chunk
|
|
539
|
+
return
|
|
540
|
+
_response.read()
|
|
541
|
+
_response_json = _response.json()
|
|
542
|
+
except JSONDecodeError:
|
|
543
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
544
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
545
|
+
|
|
577
546
|
|
|
578
547
|
class AsyncExportsClient:
|
|
579
548
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -583,50 +552,47 @@ class AsyncExportsClient:
|
|
|
583
552
|
self,
|
|
584
553
|
id: int,
|
|
585
554
|
*,
|
|
586
|
-
export_type: typing.Optional[str] = None,
|
|
587
555
|
download_all_tasks: typing.Optional[bool] = None,
|
|
588
556
|
download_resources: typing.Optional[bool] = None,
|
|
589
|
-
|
|
557
|
+
export_type: typing.Optional[str] = None,
|
|
558
|
+
ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
590
559
|
request_options: typing.Optional[RequestOptions] = None,
|
|
591
560
|
) -> typing.AsyncIterator[bytes]:
|
|
592
561
|
"""
|
|
593
562
|
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
563
|
+
<i>Note: if you have a large project it's recommended to use
|
|
564
|
+
export snapshots, this easy export endpoint might have timeouts.</i><br/><br>
|
|
565
|
+
Export annotated tasks as a file in a specific format.
|
|
566
|
+
For example, to export JSON annotations for a project to a file called `annotations.json`,
|
|
567
|
+
run the following from the command line:
|
|
568
|
+
```bash
|
|
569
|
+
curl -X GET http://localhost:8000/api/projects/{id}/export?exportType=JSON -H 'Authorization: Token abc123' --output 'annotations.json'
|
|
570
|
+
```
|
|
571
|
+
To export all tasks, including skipped tasks and others without annotations, run the following from the command line:
|
|
572
|
+
```bash
|
|
573
|
+
curl -X GET http://localhost:8000/api/projects/{id}/export?exportType=JSON&download_all_tasks=true -H 'Authorization: Token abc123' --output 'annotations.json'
|
|
574
|
+
```
|
|
575
|
+
To export specific tasks with IDs of 123 and 345, run the following from the command line:
|
|
576
|
+
```bash
|
|
577
|
+
curl -X GET 'http://localhost:8000/api/projects/{id}/export?ids[]=123&ids[]=345' -H 'Authorization: Token abc123' --output 'annotations.json'
|
|
578
|
+
```
|
|
579
|
+
|
|
611
580
|
|
|
612
581
|
Parameters
|
|
613
582
|
----------
|
|
614
583
|
id : int
|
|
615
584
|
A unique integer value identifying this project.
|
|
616
585
|
|
|
617
|
-
export_type : typing.Optional[str]
|
|
618
|
-
Selected export format (JSON by default)
|
|
619
|
-
|
|
620
586
|
download_all_tasks : typing.Optional[bool]
|
|
621
|
-
|
|
622
587
|
If true, download all tasks regardless of status. If false, download only annotated tasks.
|
|
623
588
|
|
|
624
589
|
download_resources : typing.Optional[bool]
|
|
625
|
-
|
|
626
590
|
If true, download all resource files such as images, audio, and others relevant to the tasks.
|
|
627
591
|
|
|
628
|
-
|
|
592
|
+
export_type : typing.Optional[str]
|
|
593
|
+
Selected export format (JSON by default)
|
|
629
594
|
|
|
595
|
+
ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
630
596
|
Specify a list of task IDs to retrieve only the details for those tasks.
|
|
631
597
|
|
|
632
598
|
request_options : typing.Optional[RequestOptions]
|
|
@@ -635,15 +601,15 @@ class AsyncExportsClient:
|
|
|
635
601
|
Yields
|
|
636
602
|
------
|
|
637
603
|
typing.AsyncIterator[bytes]
|
|
638
|
-
Exported data
|
|
604
|
+
Exported data
|
|
639
605
|
"""
|
|
640
606
|
async with self._client_wrapper.httpx_client.stream(
|
|
641
607
|
f"api/projects/{jsonable_encoder(id)}/export",
|
|
642
608
|
method="GET",
|
|
643
609
|
params={
|
|
644
|
-
"export_type": export_type,
|
|
645
610
|
"download_all_tasks": download_all_tasks,
|
|
646
611
|
"download_resources": download_resources,
|
|
612
|
+
"export_type": export_type,
|
|
647
613
|
"ids": ids,
|
|
648
614
|
},
|
|
649
615
|
request_options=request_options,
|
|
@@ -662,12 +628,9 @@ class AsyncExportsClient:
|
|
|
662
628
|
|
|
663
629
|
async def list_formats(
|
|
664
630
|
self, id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
665
|
-
) -> typing.List[
|
|
631
|
+
) -> typing.List[str]:
|
|
666
632
|
"""
|
|
667
|
-
|
|
668
|
-
Before exporting annotations, you can check with formats are supported by the specified project. For more information about export formats, see [Export formats supported by Label Studio](https://labelstud.io/guide/export#Export-formats-supported-by-Label-Studio).
|
|
669
|
-
|
|
670
|
-
You must provide a project ID. 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).
|
|
633
|
+
Retrieve the available export formats for the current project by ID.
|
|
671
634
|
|
|
672
635
|
Parameters
|
|
673
636
|
----------
|
|
@@ -679,7 +642,7 @@ class AsyncExportsClient:
|
|
|
679
642
|
|
|
680
643
|
Returns
|
|
681
644
|
-------
|
|
682
|
-
typing.List[
|
|
645
|
+
typing.List[str]
|
|
683
646
|
Export formats
|
|
684
647
|
|
|
685
648
|
Examples
|
|
@@ -709,9 +672,9 @@ class AsyncExportsClient:
|
|
|
709
672
|
try:
|
|
710
673
|
if 200 <= _response.status_code < 300:
|
|
711
674
|
return typing.cast(
|
|
712
|
-
typing.List[
|
|
713
|
-
|
|
714
|
-
type_=typing.List[
|
|
675
|
+
typing.List[str],
|
|
676
|
+
construct_type(
|
|
677
|
+
type_=typing.List[str], # type: ignore
|
|
715
678
|
object_=_response.json(),
|
|
716
679
|
),
|
|
717
680
|
)
|
|
@@ -721,19 +684,19 @@ class AsyncExportsClient:
|
|
|
721
684
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
722
685
|
|
|
723
686
|
async def list(
|
|
724
|
-
self,
|
|
687
|
+
self, id: int, *, ordering: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
|
|
725
688
|
) -> typing.List[Export]:
|
|
726
689
|
"""
|
|
727
|
-
|
|
728
|
-
Returns a list of export file (snapshots) for a specific project by ID. 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).
|
|
729
|
-
|
|
730
|
-
Included in the response is information about each snapshot, such as who created it and what format it is in.
|
|
690
|
+
Returns a list of exported files for a specific project by ID.
|
|
731
691
|
|
|
732
692
|
Parameters
|
|
733
693
|
----------
|
|
734
|
-
|
|
694
|
+
id : int
|
|
735
695
|
A unique integer value identifying this project.
|
|
736
696
|
|
|
697
|
+
ordering : typing.Optional[str]
|
|
698
|
+
Which field to use when ordering the results.
|
|
699
|
+
|
|
737
700
|
request_options : typing.Optional[RequestOptions]
|
|
738
701
|
Request-specific configuration.
|
|
739
702
|
|
|
@@ -755,22 +718,25 @@ class AsyncExportsClient:
|
|
|
755
718
|
|
|
756
719
|
async def main() -> None:
|
|
757
720
|
await client.projects.exports.list(
|
|
758
|
-
|
|
721
|
+
id=1,
|
|
759
722
|
)
|
|
760
723
|
|
|
761
724
|
|
|
762
725
|
asyncio.run(main())
|
|
763
726
|
"""
|
|
764
727
|
_response = await self._client_wrapper.httpx_client.request(
|
|
765
|
-
f"api/projects/{jsonable_encoder(
|
|
728
|
+
f"api/projects/{jsonable_encoder(id)}/exports/",
|
|
766
729
|
method="GET",
|
|
730
|
+
params={
|
|
731
|
+
"ordering": ordering,
|
|
732
|
+
},
|
|
767
733
|
request_options=request_options,
|
|
768
734
|
)
|
|
769
735
|
try:
|
|
770
736
|
if 200 <= _response.status_code < 300:
|
|
771
737
|
return typing.cast(
|
|
772
738
|
typing.List[Export],
|
|
773
|
-
|
|
739
|
+
construct_type(
|
|
774
740
|
type_=typing.List[Export], # type: ignore
|
|
775
741
|
object_=_response.json(),
|
|
776
742
|
),
|
|
@@ -782,67 +748,55 @@ class AsyncExportsClient:
|
|
|
782
748
|
|
|
783
749
|
async def create(
|
|
784
750
|
self,
|
|
785
|
-
|
|
751
|
+
id: int,
|
|
786
752
|
*,
|
|
787
753
|
title: typing.Optional[str] = OMIT,
|
|
788
|
-
|
|
789
|
-
created_by: typing.Optional[UserSimple] = OMIT,
|
|
790
|
-
created_at: typing.Optional[dt.datetime] = OMIT,
|
|
754
|
+
created_by: typing.Optional[UserSimpleRequest] = OMIT,
|
|
791
755
|
finished_at: typing.Optional[dt.datetime] = OMIT,
|
|
792
|
-
status: typing.Optional[
|
|
756
|
+
status: typing.Optional[Status7BfEnum] = OMIT,
|
|
793
757
|
md5: typing.Optional[str] = OMIT,
|
|
794
|
-
counters: typing.Optional[typing.
|
|
795
|
-
converted_formats: typing.Optional[typing.Sequence[
|
|
796
|
-
task_filter_options: typing.Optional[
|
|
797
|
-
annotation_filter_options: typing.Optional[
|
|
798
|
-
serialization_options: typing.Optional[
|
|
758
|
+
counters: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
759
|
+
converted_formats: typing.Optional[typing.Sequence[ConvertedFormatRequest]] = OMIT,
|
|
760
|
+
task_filter_options: typing.Optional[LseTaskFilterOptionsRequest] = OMIT,
|
|
761
|
+
annotation_filter_options: typing.Optional[LseAnnotationFilterOptionsRequest] = OMIT,
|
|
762
|
+
serialization_options: typing.Optional[SerializationOptionsRequest] = OMIT,
|
|
799
763
|
request_options: typing.Optional[RequestOptions] = None,
|
|
800
|
-
) ->
|
|
764
|
+
) -> LseExportCreate:
|
|
801
765
|
"""
|
|
802
|
-
|
|
803
|
-
Create a new export request to start a background task and generate an export file (snapshot) for a specific project by ID. 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).
|
|
804
|
-
|
|
805
|
-
A snapshot is a static export of your project's data and annotations at a specific point in time. It captures the current state of your tasks, annotations, and other relevant data, allowing you to download and review them later. Snapshots are particularly useful for large projects as they help avoid timeouts during export operations by processing the data asynchronously.
|
|
806
|
-
|
|
807
|
-
For more information, see the [Label Studio documentation on exporting annotations](https://labelstud.io/guide/export.html).
|
|
766
|
+
Create a new export request to start a background task and generate an export file for a specific project by ID.
|
|
808
767
|
|
|
809
768
|
Parameters
|
|
810
769
|
----------
|
|
811
|
-
|
|
770
|
+
id : int
|
|
812
771
|
A unique integer value identifying this project.
|
|
813
772
|
|
|
814
773
|
title : typing.Optional[str]
|
|
815
774
|
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
created_by : typing.Optional[UserSimple]
|
|
819
|
-
|
|
820
|
-
created_at : typing.Optional[dt.datetime]
|
|
821
|
-
Creation time
|
|
775
|
+
created_by : typing.Optional[UserSimpleRequest]
|
|
822
776
|
|
|
823
777
|
finished_at : typing.Optional[dt.datetime]
|
|
824
778
|
Complete or fail time
|
|
825
779
|
|
|
826
|
-
status : typing.Optional[
|
|
780
|
+
status : typing.Optional[Status7BfEnum]
|
|
827
781
|
|
|
828
782
|
md5 : typing.Optional[str]
|
|
829
783
|
|
|
830
|
-
counters : typing.Optional[typing.
|
|
784
|
+
counters : typing.Optional[typing.Optional[typing.Any]]
|
|
831
785
|
|
|
832
|
-
converted_formats : typing.Optional[typing.Sequence[
|
|
786
|
+
converted_formats : typing.Optional[typing.Sequence[ConvertedFormatRequest]]
|
|
833
787
|
|
|
834
|
-
task_filter_options : typing.Optional[
|
|
788
|
+
task_filter_options : typing.Optional[LseTaskFilterOptionsRequest]
|
|
835
789
|
|
|
836
|
-
annotation_filter_options : typing.Optional[
|
|
790
|
+
annotation_filter_options : typing.Optional[LseAnnotationFilterOptionsRequest]
|
|
837
791
|
|
|
838
|
-
serialization_options : typing.Optional[
|
|
792
|
+
serialization_options : typing.Optional[SerializationOptionsRequest]
|
|
839
793
|
|
|
840
794
|
request_options : typing.Optional[RequestOptions]
|
|
841
795
|
Request-specific configuration.
|
|
842
796
|
|
|
843
797
|
Returns
|
|
844
798
|
-------
|
|
845
|
-
|
|
799
|
+
LseExportCreate
|
|
846
800
|
|
|
847
801
|
|
|
848
802
|
Examples
|
|
@@ -858,48 +812,49 @@ class AsyncExportsClient:
|
|
|
858
812
|
|
|
859
813
|
async def main() -> None:
|
|
860
814
|
await client.projects.exports.create(
|
|
861
|
-
|
|
815
|
+
id=1,
|
|
862
816
|
)
|
|
863
817
|
|
|
864
818
|
|
|
865
819
|
asyncio.run(main())
|
|
866
820
|
"""
|
|
867
821
|
_response = await self._client_wrapper.httpx_client.request(
|
|
868
|
-
f"api/projects/{jsonable_encoder(
|
|
822
|
+
f"api/projects/{jsonable_encoder(id)}/exports/",
|
|
869
823
|
method="POST",
|
|
870
824
|
json={
|
|
871
825
|
"title": title,
|
|
872
|
-
"id": id,
|
|
873
826
|
"created_by": convert_and_respect_annotation_metadata(
|
|
874
|
-
object_=created_by, annotation=
|
|
827
|
+
object_=created_by, annotation=UserSimpleRequest, direction="write"
|
|
875
828
|
),
|
|
876
|
-
"created_at": created_at,
|
|
877
829
|
"finished_at": finished_at,
|
|
878
830
|
"status": status,
|
|
879
831
|
"md5": md5,
|
|
880
832
|
"counters": counters,
|
|
881
833
|
"converted_formats": convert_and_respect_annotation_metadata(
|
|
882
|
-
object_=converted_formats, annotation=typing.Sequence[
|
|
834
|
+
object_=converted_formats, annotation=typing.Sequence[ConvertedFormatRequest], direction="write"
|
|
883
835
|
),
|
|
884
836
|
"task_filter_options": convert_and_respect_annotation_metadata(
|
|
885
|
-
object_=task_filter_options, annotation=
|
|
837
|
+
object_=task_filter_options, annotation=LseTaskFilterOptionsRequest, direction="write"
|
|
886
838
|
),
|
|
887
839
|
"annotation_filter_options": convert_and_respect_annotation_metadata(
|
|
888
|
-
object_=annotation_filter_options, annotation=
|
|
840
|
+
object_=annotation_filter_options, annotation=LseAnnotationFilterOptionsRequest, direction="write"
|
|
889
841
|
),
|
|
890
842
|
"serialization_options": convert_and_respect_annotation_metadata(
|
|
891
|
-
object_=serialization_options, annotation=
|
|
843
|
+
object_=serialization_options, annotation=SerializationOptionsRequest, direction="write"
|
|
892
844
|
),
|
|
893
845
|
},
|
|
846
|
+
headers={
|
|
847
|
+
"content-type": "application/json",
|
|
848
|
+
},
|
|
894
849
|
request_options=request_options,
|
|
895
850
|
omit=OMIT,
|
|
896
851
|
)
|
|
897
852
|
try:
|
|
898
853
|
if 200 <= _response.status_code < 300:
|
|
899
854
|
return typing.cast(
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
type_=
|
|
855
|
+
LseExportCreate,
|
|
856
|
+
construct_type(
|
|
857
|
+
type_=LseExportCreate, # type: ignore
|
|
903
858
|
object_=_response.json(),
|
|
904
859
|
),
|
|
905
860
|
)
|
|
@@ -908,80 +863,18 @@ class AsyncExportsClient:
|
|
|
908
863
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
909
864
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
910
865
|
|
|
911
|
-
async def
|
|
912
|
-
self,
|
|
913
|
-
project_id: int,
|
|
914
|
-
export_pk: str,
|
|
915
|
-
*,
|
|
916
|
-
export_type: typing.Optional[ExportFormat] = None,
|
|
917
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
918
|
-
) -> typing.AsyncIterator[bytes]:
|
|
866
|
+
async def get(self, export_pk: int, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> Export:
|
|
919
867
|
"""
|
|
920
|
-
|
|
921
|
-
Download an export snapshot as a file in a specified format. To see what formats are supported, you can use [Get export formats](list-formats) or see [Export formats supported by Label Studio](https://labelstud.io/guide/export#Export-formats-supported-by-Label-Studio).
|
|
922
|
-
|
|
923
|
-
You will need to provide the project ID and export ID (`export_pk`). The export ID is returned when you create the export or you can use [List all export snapshots](list).
|
|
924
|
-
|
|
925
|
-
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).
|
|
868
|
+
Retrieve information about an export file by export ID for a specific project.
|
|
926
869
|
|
|
927
870
|
Parameters
|
|
928
871
|
----------
|
|
929
|
-
|
|
930
|
-
A unique integer value identifying this project.
|
|
931
|
-
|
|
932
|
-
export_pk : str
|
|
872
|
+
export_pk : int
|
|
933
873
|
Primary key identifying the export file.
|
|
934
874
|
|
|
935
|
-
|
|
936
|
-
Selected export format. JSON is available by default. For other formats, you need to convert the export first.
|
|
937
|
-
|
|
938
|
-
request_options : typing.Optional[RequestOptions]
|
|
939
|
-
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
940
|
-
|
|
941
|
-
Yields
|
|
942
|
-
------
|
|
943
|
-
typing.AsyncIterator[bytes]
|
|
944
|
-
Exported data in binary format
|
|
945
|
-
"""
|
|
946
|
-
async with self._client_wrapper.httpx_client.stream(
|
|
947
|
-
f"api/projects/{jsonable_encoder(project_id)}/exports/{jsonable_encoder(export_pk)}/download",
|
|
948
|
-
method="GET",
|
|
949
|
-
params={
|
|
950
|
-
"exportType": export_type,
|
|
951
|
-
},
|
|
952
|
-
request_options=request_options,
|
|
953
|
-
) as _response:
|
|
954
|
-
try:
|
|
955
|
-
if 200 <= _response.status_code < 300:
|
|
956
|
-
_chunk_size = request_options.get("chunk_size", None) if request_options is not None else None
|
|
957
|
-
async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size):
|
|
958
|
-
yield _chunk
|
|
959
|
-
return
|
|
960
|
-
await _response.aread()
|
|
961
|
-
_response_json = _response.json()
|
|
962
|
-
except JSONDecodeError:
|
|
963
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
964
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
965
|
-
|
|
966
|
-
async def get(
|
|
967
|
-
self, project_id: int, export_pk: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
968
|
-
) -> Export:
|
|
969
|
-
"""
|
|
970
|
-
|
|
971
|
-
Retrieve information about a specific export file (snapshot).
|
|
972
|
-
|
|
973
|
-
You will need the export ID. You can find this in the response when you [create the snapshot via the API](create) or using [List all export snapshots](list).
|
|
974
|
-
|
|
975
|
-
You will also need the project ID. This 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).
|
|
976
|
-
|
|
977
|
-
Parameters
|
|
978
|
-
----------
|
|
979
|
-
project_id : int
|
|
875
|
+
id : int
|
|
980
876
|
A unique integer value identifying this project.
|
|
981
877
|
|
|
982
|
-
export_pk : str
|
|
983
|
-
Primary key identifying the export file.
|
|
984
|
-
|
|
985
878
|
request_options : typing.Optional[RequestOptions]
|
|
986
879
|
Request-specific configuration.
|
|
987
880
|
|
|
@@ -1003,15 +896,15 @@ class AsyncExportsClient:
|
|
|
1003
896
|
|
|
1004
897
|
async def main() -> None:
|
|
1005
898
|
await client.projects.exports.get(
|
|
1006
|
-
|
|
1007
|
-
|
|
899
|
+
export_pk=1,
|
|
900
|
+
id=1,
|
|
1008
901
|
)
|
|
1009
902
|
|
|
1010
903
|
|
|
1011
904
|
asyncio.run(main())
|
|
1012
905
|
"""
|
|
1013
906
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1014
|
-
f"api/projects/{jsonable_encoder(
|
|
907
|
+
f"api/projects/{jsonable_encoder(id)}/exports/{jsonable_encoder(export_pk)}",
|
|
1015
908
|
method="GET",
|
|
1016
909
|
request_options=request_options,
|
|
1017
910
|
)
|
|
@@ -1019,7 +912,7 @@ class AsyncExportsClient:
|
|
|
1019
912
|
if 200 <= _response.status_code < 300:
|
|
1020
913
|
return typing.cast(
|
|
1021
914
|
Export,
|
|
1022
|
-
|
|
915
|
+
construct_type(
|
|
1023
916
|
type_=Export, # type: ignore
|
|
1024
917
|
object_=_response.json(),
|
|
1025
918
|
),
|
|
@@ -1029,23 +922,18 @@ class AsyncExportsClient:
|
|
|
1029
922
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1030
923
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1031
924
|
|
|
1032
|
-
async def delete(
|
|
1033
|
-
self, project_id: int, export_pk: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1034
|
-
) -> None:
|
|
925
|
+
async def delete(self, export_pk: int, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
1035
926
|
"""
|
|
1036
|
-
|
|
1037
927
|
Delete an export file by specified export ID.
|
|
1038
928
|
|
|
1039
|
-
You will need the export ID. You can find this in the response when you [create the snapshot via the API](create) or using [List all export snapshots](list).
|
|
1040
|
-
|
|
1041
929
|
Parameters
|
|
1042
930
|
----------
|
|
1043
|
-
|
|
1044
|
-
A unique integer value identifying this project.
|
|
1045
|
-
|
|
1046
|
-
export_pk : str
|
|
931
|
+
export_pk : int
|
|
1047
932
|
Primary key identifying the export file.
|
|
1048
933
|
|
|
934
|
+
id : int
|
|
935
|
+
A unique integer value identifying this project.
|
|
936
|
+
|
|
1049
937
|
request_options : typing.Optional[RequestOptions]
|
|
1050
938
|
Request-specific configuration.
|
|
1051
939
|
|
|
@@ -1066,15 +954,15 @@ class AsyncExportsClient:
|
|
|
1066
954
|
|
|
1067
955
|
async def main() -> None:
|
|
1068
956
|
await client.projects.exports.delete(
|
|
1069
|
-
|
|
1070
|
-
|
|
957
|
+
export_pk=1,
|
|
958
|
+
id=1,
|
|
1071
959
|
)
|
|
1072
960
|
|
|
1073
961
|
|
|
1074
962
|
asyncio.run(main())
|
|
1075
963
|
"""
|
|
1076
964
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1077
|
-
f"api/projects/{jsonable_encoder(
|
|
965
|
+
f"api/projects/{jsonable_encoder(id)}/exports/{jsonable_encoder(export_pk)}",
|
|
1078
966
|
method="DELETE",
|
|
1079
967
|
request_options=request_options,
|
|
1080
968
|
)
|
|
@@ -1088,35 +976,29 @@ class AsyncExportsClient:
|
|
|
1088
976
|
|
|
1089
977
|
async def convert(
|
|
1090
978
|
self,
|
|
1091
|
-
|
|
1092
|
-
|
|
979
|
+
export_pk: int,
|
|
980
|
+
id: int,
|
|
1093
981
|
*,
|
|
1094
|
-
export_type:
|
|
982
|
+
export_type: str,
|
|
1095
983
|
download_resources: typing.Optional[bool] = OMIT,
|
|
1096
984
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1097
985
|
) -> ExportsConvertResponse:
|
|
1098
986
|
"""
|
|
1099
|
-
|
|
1100
|
-
You can use this to convert an export snapshot into the selected format.
|
|
1101
|
-
|
|
1102
|
-
To see what formats are supported, you can use [Get export formats](list-formats) or see [Export formats supported by Label Studio](https://labelstud.io/guide/export#Export-formats-supported-by-Label-Studio).
|
|
1103
|
-
|
|
1104
|
-
You will need to provide the project ID and export ID (`export_pk`). The export ID is returned when you create the export or you can use [List all export snapshots](list).
|
|
1105
|
-
|
|
1106
|
-
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).
|
|
987
|
+
Convert export snapshot to selected format
|
|
1107
988
|
|
|
1108
989
|
Parameters
|
|
1109
990
|
----------
|
|
1110
|
-
|
|
1111
|
-
A unique integer value identifying this project.
|
|
1112
|
-
|
|
1113
|
-
export_pk : str
|
|
991
|
+
export_pk : int
|
|
1114
992
|
Primary key identifying the export file.
|
|
1115
993
|
|
|
1116
|
-
|
|
994
|
+
id : int
|
|
995
|
+
A unique integer value identifying this project.
|
|
996
|
+
|
|
997
|
+
export_type : str
|
|
998
|
+
Export file format.
|
|
1117
999
|
|
|
1118
1000
|
download_resources : typing.Optional[bool]
|
|
1119
|
-
|
|
1001
|
+
Download resources in converter.
|
|
1120
1002
|
|
|
1121
1003
|
request_options : typing.Optional[RequestOptions]
|
|
1122
1004
|
Request-specific configuration.
|
|
@@ -1139,15 +1021,16 @@ class AsyncExportsClient:
|
|
|
1139
1021
|
|
|
1140
1022
|
async def main() -> None:
|
|
1141
1023
|
await client.projects.exports.convert(
|
|
1142
|
-
|
|
1143
|
-
|
|
1024
|
+
export_pk=1,
|
|
1025
|
+
id=1,
|
|
1026
|
+
export_type="export_type",
|
|
1144
1027
|
)
|
|
1145
1028
|
|
|
1146
1029
|
|
|
1147
1030
|
asyncio.run(main())
|
|
1148
1031
|
"""
|
|
1149
1032
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1150
|
-
f"api/projects/{jsonable_encoder(
|
|
1033
|
+
f"api/projects/{jsonable_encoder(id)}/exports/{jsonable_encoder(export_pk)}/convert",
|
|
1151
1034
|
method="POST",
|
|
1152
1035
|
json={
|
|
1153
1036
|
"export_type": export_type,
|
|
@@ -1163,7 +1046,7 @@ class AsyncExportsClient:
|
|
|
1163
1046
|
if 200 <= _response.status_code < 300:
|
|
1164
1047
|
return typing.cast(
|
|
1165
1048
|
ExportsConvertResponse,
|
|
1166
|
-
|
|
1049
|
+
construct_type(
|
|
1167
1050
|
type_=ExportsConvertResponse, # type: ignore
|
|
1168
1051
|
object_=_response.json(),
|
|
1169
1052
|
),
|
|
@@ -1172,3 +1055,60 @@ class AsyncExportsClient:
|
|
|
1172
1055
|
except JSONDecodeError:
|
|
1173
1056
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1174
1057
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1058
|
+
|
|
1059
|
+
async def download(
|
|
1060
|
+
self,
|
|
1061
|
+
export_pk: int,
|
|
1062
|
+
id: int,
|
|
1063
|
+
*,
|
|
1064
|
+
export_type: typing.Optional[str] = None,
|
|
1065
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1066
|
+
) -> typing.AsyncIterator[bytes]:
|
|
1067
|
+
"""
|
|
1068
|
+
|
|
1069
|
+
Download an export file in the specified format for a specific project. Specify the project ID with the `id`
|
|
1070
|
+
parameter in the path and the ID of the export file you want to download using the `export_pk` parameter
|
|
1071
|
+
in the path.
|
|
1072
|
+
|
|
1073
|
+
Get the `export_pk` from the response of the request to [Create new export](/api#operation/api_projects_exports_create)
|
|
1074
|
+
or after [listing export files](/api#operation/api_projects_exports_list).
|
|
1075
|
+
|
|
1076
|
+
|
|
1077
|
+
Parameters
|
|
1078
|
+
----------
|
|
1079
|
+
export_pk : int
|
|
1080
|
+
Primary key identifying the export file.
|
|
1081
|
+
|
|
1082
|
+
id : int
|
|
1083
|
+
A unique integer value identifying this project.
|
|
1084
|
+
|
|
1085
|
+
export_type : typing.Optional[str]
|
|
1086
|
+
Selected export format
|
|
1087
|
+
|
|
1088
|
+
request_options : typing.Optional[RequestOptions]
|
|
1089
|
+
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
1090
|
+
|
|
1091
|
+
Yields
|
|
1092
|
+
------
|
|
1093
|
+
typing.AsyncIterator[bytes]
|
|
1094
|
+
Export file
|
|
1095
|
+
"""
|
|
1096
|
+
async with self._client_wrapper.httpx_client.stream(
|
|
1097
|
+
f"api/projects/{jsonable_encoder(id)}/exports/{jsonable_encoder(export_pk)}/download",
|
|
1098
|
+
method="GET",
|
|
1099
|
+
params={
|
|
1100
|
+
"exportType": export_type,
|
|
1101
|
+
},
|
|
1102
|
+
request_options=request_options,
|
|
1103
|
+
) as _response:
|
|
1104
|
+
try:
|
|
1105
|
+
if 200 <= _response.status_code < 300:
|
|
1106
|
+
_chunk_size = request_options.get("chunk_size", None) if request_options is not None else None
|
|
1107
|
+
async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size):
|
|
1108
|
+
yield _chunk
|
|
1109
|
+
return
|
|
1110
|
+
await _response.aread()
|
|
1111
|
+
_response_json = _response.json()
|
|
1112
|
+
except JSONDecodeError:
|
|
1113
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1114
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|