thestage 0.5.44__tar.gz → 0.5.45__tar.gz

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 (173) hide show
  1. {thestage-0.5.44 → thestage-0.5.45}/PKG-INFO +2 -2
  2. {thestage-0.5.44 → thestage-0.5.45}/pyproject.toml +2 -2
  3. {thestage-0.5.44 → thestage-0.5.45}/thestage/__init__.py +1 -1
  4. {thestage-0.5.44 → thestage-0.5.45}/thestage/controllers/container_controller.py +0 -3
  5. {thestage-0.5.44 → thestage-0.5.45}/thestage/controllers/instance_controller.py +8 -75
  6. {thestage-0.5.44 → thestage-0.5.45}/thestage/controllers/project_controller.py +3 -121
  7. {thestage-0.5.44 → thestage-0.5.45}/thestage/main.py +6 -1
  8. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/git/git_client.py +2 -2
  9. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/api_client.py +15 -37
  10. {thestage-0.5.44/thestage/services/clients/thestage_api/dtos → thestage-0.5.45/thestage/services/clients/thestage_api/dtos/user_controller}/user_profile.py +6 -3
  11. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/config_provider/config_provider.py +10 -29
  12. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/connect/connect_service.py +12 -5
  13. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/container/container_service.py +2 -2
  14. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/core_files/config_entity.py +2 -7
  15. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/filesystem_service.py +19 -2
  16. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/instance/instance_service.py +100 -6
  17. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/project/project_service.py +141 -2
  18. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/remote_server_service.py +2 -2
  19. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/service_factory.py +4 -4
  20. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/validation_service.py +0 -6
  21. {thestage-0.5.44 → thestage-0.5.45}/LICENSE.txt +0 -0
  22. {thestage-0.5.44 → thestage-0.5.45}/README.md +0 -0
  23. {thestage-0.5.44 → thestage-0.5.45}/thestage/.env +0 -0
  24. {thestage-0.5.44 → thestage-0.5.45}/thestage/__main__.py +0 -0
  25. {thestage-0.5.44 → thestage-0.5.45}/thestage/color_scheme/color_scheme.py +0 -0
  26. {thestage-0.5.44 → thestage-0.5.45}/thestage/config/__init__.py +0 -0
  27. {thestage-0.5.44 → thestage-0.5.45}/thestage/config/env_base.py +0 -0
  28. {thestage-0.5.44 → thestage-0.5.45}/thestage/controllers/__init__.py +0 -0
  29. {thestage-0.5.44 → thestage-0.5.45}/thestage/controllers/base_controller.py +0 -0
  30. {thestage-0.5.44 → thestage-0.5.45}/thestage/controllers/config_controller.py +0 -0
  31. {thestage-0.5.44 → thestage-0.5.45}/thestage/controllers/utils_controller.py +0 -0
  32. {thestage-0.5.44 → thestage-0.5.45}/thestage/debug_main.dist.py +0 -0
  33. {thestage-0.5.44 → thestage-0.5.45}/thestage/entities/__init__.py +0 -0
  34. {thestage-0.5.44 → thestage-0.5.45}/thestage/entities/container.py +0 -0
  35. {thestage-0.5.44 → thestage-0.5.45}/thestage/entities/enums/__init__.py +0 -0
  36. {thestage-0.5.44 → thestage-0.5.45}/thestage/entities/enums/order_direction_type.py +0 -0
  37. {thestage-0.5.44 → thestage-0.5.45}/thestage/entities/enums/shell_type.py +0 -0
  38. {thestage-0.5.44 → thestage-0.5.45}/thestage/entities/enums/tail_output_type.py +0 -0
  39. {thestage-0.5.44 → thestage-0.5.45}/thestage/entities/enums/yes_no_response.py +0 -0
  40. {thestage-0.5.44 → thestage-0.5.45}/thestage/entities/file_item.py +0 -0
  41. {thestage-0.5.44 → thestage-0.5.45}/thestage/entities/project_inference_simulator.py +0 -0
  42. {thestage-0.5.44 → thestage-0.5.45}/thestage/entities/project_inference_simulator_model.py +0 -0
  43. {thestage-0.5.44 → thestage-0.5.45}/thestage/entities/project_task.py +0 -0
  44. {thestage-0.5.44 → thestage-0.5.45}/thestage/entities/rented_instance.py +0 -0
  45. {thestage-0.5.44 → thestage-0.5.45}/thestage/entities/self_hosted_instance.py +0 -0
  46. {thestage-0.5.44 → thestage-0.5.45}/thestage/exceptions/__init__.py +0 -0
  47. {thestage-0.5.44 → thestage-0.5.45}/thestage/exceptions/auth_exception.py +0 -0
  48. {thestage-0.5.44 → thestage-0.5.45}/thestage/exceptions/base_exception.py +0 -0
  49. {thestage-0.5.44 → thestage-0.5.45}/thestage/exceptions/business_logic_exception.py +0 -0
  50. {thestage-0.5.44 → thestage-0.5.45}/thestage/exceptions/config_exception.py +0 -0
  51. {thestage-0.5.44 → thestage-0.5.45}/thestage/exceptions/file_system_exception.py +0 -0
  52. {thestage-0.5.44 → thestage-0.5.45}/thestage/exceptions/git_access_exception.py +0 -0
  53. {thestage-0.5.44 → thestage-0.5.45}/thestage/exceptions/http_error_exception.py +0 -0
  54. {thestage-0.5.44 → thestage-0.5.45}/thestage/exceptions/remote_server_exception.py +0 -0
  55. {thestage-0.5.44 → thestage-0.5.45}/thestage/git/ProgressPrinter.py +0 -0
  56. {thestage-0.5.44 → thestage-0.5.45}/thestage/helpers/__init__.py +0 -0
  57. {thestage-0.5.44 → thestage-0.5.45}/thestage/helpers/error_handler.py +0 -0
  58. {thestage-0.5.44 → thestage-0.5.45}/thestage/helpers/logger/__init__.py +0 -0
  59. {thestage-0.5.44 → thestage-0.5.45}/thestage/helpers/logger/app_logger.py +0 -0
  60. {thestage-0.5.44 → thestage-0.5.45}/thestage/helpers/ssh_util.py +0 -0
  61. {thestage-0.5.44 → thestage-0.5.45}/thestage/i18n/en_GB/messages.po +0 -0
  62. {thestage-0.5.44 → thestage-0.5.45}/thestage/i18n/translation.py +0 -0
  63. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/.env +0 -0
  64. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/__init__.py +0 -0
  65. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/abstract_mapper.py +0 -0
  66. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/abstract_service.py +0 -0
  67. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/app_config_service.py +0 -0
  68. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/.DS_Store +0 -0
  69. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/__init__.py +0 -0
  70. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/git/__init__.py +0 -0
  71. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/__init__.py +0 -0
  72. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/core/api_client_abstract.py +0 -0
  73. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/core/api_client_core.py +0 -0
  74. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/core/http_client_exception.py +0 -0
  75. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/__init__.py +0 -0
  76. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/base_response.py +0 -0
  77. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/cloud_provider_region.py +0 -0
  78. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/container_param_request.py +0 -0
  79. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/container_response.py +0 -0
  80. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/docker_container_assigned_device.py +0 -0
  81. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/docker_container_controller/docker_container_list_request.py +0 -0
  82. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/docker_container_controller/docker_container_list_response.py +0 -0
  83. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/docker_container_mapping.py +0 -0
  84. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/entity_filter_request.py +0 -0
  85. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/enums/__init__.py +0 -0
  86. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/enums/container_pending_action.py +0 -0
  87. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/enums/container_status.py +0 -0
  88. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/enums/cpu_type.py +0 -0
  89. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/enums/currency_type.py +0 -0
  90. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/enums/daemon_status.py +0 -0
  91. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/enums/disk_type.py +0 -0
  92. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/enums/drive_type.py +0 -0
  93. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/enums/gpu_name.py +0 -0
  94. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/enums/inference_model_status.py +0 -0
  95. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/enums/inference_simulator_status.py +0 -0
  96. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/enums/instance_rented_status.py +0 -0
  97. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/enums/instance_type.py +0 -0
  98. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/enums/location_region.py +0 -0
  99. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/enums/power_status.py +0 -0
  100. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/enums/provider_name.py +0 -0
  101. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/enums/selfhosted_status.py +0 -0
  102. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/enums/task_execution_status.py +0 -0
  103. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/enums/task_status.py +0 -0
  104. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/frontend_status.py +0 -0
  105. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/inference_controller/deploy_inference_model_to_instance_request.py +0 -0
  106. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/inference_controller/deploy_inference_model_to_instance_response.py +0 -0
  107. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/inference_controller/deploy_inference_model_to_sagemaker_request.py +0 -0
  108. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/inference_controller/deploy_inference_model_to_sagemaker_response.py +0 -0
  109. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/inference_controller/get_inference_simulator_request.py +0 -0
  110. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/inference_controller/get_inference_simulator_response.py +0 -0
  111. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/inference_controller/inference_simulator_list_for_project_request.py +0 -0
  112. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/inference_controller/inference_simulator_list_for_project_response.py +0 -0
  113. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/inference_controller/inference_simulator_model_list_for_project_request.py +0 -0
  114. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/inference_controller/inference_simulator_model_list_for_project_response.py +0 -0
  115. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/inference_simulator_model_response.py +0 -0
  116. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/inference_simulator_response.py +0 -0
  117. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/installed_service.py +0 -0
  118. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/instance_detected_gpus.py +0 -0
  119. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/instance_rented_response.py +0 -0
  120. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/logging_controller/docker_container_log_stream_request.py +0 -0
  121. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/logging_controller/log_polling_request.py +0 -0
  122. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/logging_controller/log_polling_response.py +0 -0
  123. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/logging_controller/task_log_stream_request.py +0 -0
  124. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/logging_controller/user_logs_query_request.py +0 -0
  125. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/logging_controller/user_logs_query_response.py +0 -0
  126. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/paginated_entity_list.py +0 -0
  127. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/pagination_data.py +0 -0
  128. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/price_definition.py +0 -0
  129. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/project_controller/project_get_deploy_ssh_key_request.py +0 -0
  130. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/project_controller/project_get_deploy_ssh_key_response.py +0 -0
  131. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/project_controller/project_push_inference_simulator_model_request.py +0 -0
  132. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/project_controller/project_push_inference_simulator_model_response.py +0 -0
  133. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/project_controller/project_run_task_request.py +0 -0
  134. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/project_controller/project_run_task_response.py +0 -0
  135. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/project_controller/project_start_inference_simulator_request.py +0 -0
  136. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/project_controller/project_start_inference_simulator_response.py +0 -0
  137. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/project_response.py +0 -0
  138. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/selfhosted_instance_response.py +0 -0
  139. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/sftp_path_helper.py +0 -0
  140. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/ssh_key_controller/add_ssh_key_to_user_request.py +0 -0
  141. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/ssh_key_controller/add_ssh_key_to_user_response.py +0 -0
  142. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/ssh_key_controller/add_ssh_public_key_to_instance_request.py +0 -0
  143. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/ssh_key_controller/add_ssh_public_key_to_instance_response.py +0 -0
  144. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/ssh_key_controller/is_user_has_public_ssh_key_request.py +0 -0
  145. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/ssh_key_controller/is_user_has_public_ssh_key_response.py +0 -0
  146. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/task_controller/task_list_for_project_request.py +0 -0
  147. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/task_controller/task_list_for_project_response.py +0 -0
  148. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/task_controller/task_status_localized_map_response.py +0 -0
  149. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/clients/thestage_api/dtos/task_controller/task_view_response.py +0 -0
  150. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/config_provider/__init__.py +0 -0
  151. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/connect/dto/remote_server_config.py +0 -0
  152. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/container/__init__.py +0 -0
  153. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/container/mapper/__init__.py +0 -0
  154. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/container/mapper/container_mapper.py +0 -0
  155. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/instance/__init__.py +0 -0
  156. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/instance/mapper/__init__.py +0 -0
  157. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/instance/mapper/instance_mapper.py +0 -0
  158. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/instance/mapper/selfhosted_mapper.py +0 -0
  159. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/logging/byte_print_style.py +0 -0
  160. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/logging/dto/log_message.py +0 -0
  161. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/logging/dto/log_type.py +0 -0
  162. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/logging/exception/log_polling_exception.py +0 -0
  163. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/logging/logging_constants.py +0 -0
  164. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/logging/logging_service.py +0 -0
  165. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/project/__init__.py +0 -0
  166. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/project/dto/inference_simulator_dto.py +0 -0
  167. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/project/dto/inference_simulator_model_dto.py +0 -0
  168. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/project/dto/project_config.py +0 -0
  169. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/project/mapper/__init__.py +0 -0
  170. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/project/mapper/project_inference_simulator_mapper.py +0 -0
  171. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/project/mapper/project_inference_simulator_model_mapper.py +0 -0
  172. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/project/mapper/project_task_mapper.py +0 -0
  173. {thestage-0.5.44 → thestage-0.5.45}/thestage/services/task/dto/task_dto.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: thestage
3
- Version: 0.5.44
3
+ Version: 0.5.45
4
4
  Summary:
5
5
  Author: TheStage AI team
6
6
  Author-email: hello@thestage.ai
@@ -21,7 +21,7 @@ Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
21
21
  Requires-Dist: python-gettext-translations (>=1.1.0,<2.0.0)
22
22
  Requires-Dist: requests (>=2.31.0,<3.0.0)
23
23
  Requires-Dist: tabulate (>=0.9.0,<0.10.0)
24
- Requires-Dist: typer[all] (>=0.9.0,<0.10.0)
24
+ Requires-Dist: typer[all] (>=0.15.2,<0.16.0)
25
25
  Description-Content-Type: text/markdown
26
26
 
27
27
  # Introduction
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "thestage"
3
- version = "0.5.44"
3
+ version = "0.5.45"
4
4
  description = ""
5
5
  authors = ["TheStage AI team <hello@thestage.ai>"]
6
6
  readme = "README.md"
@@ -20,7 +20,7 @@ exclude = [
20
20
 
21
21
  [tool.poetry.dependencies]
22
22
  python = ">=3.9,<=3.13"
23
- typer = {extras = ["all"], version = "^0.9.0"}
23
+ typer = {extras = ["all"], version = "^0.15.2"}
24
24
  tabulate = "^0.9.0"
25
25
  python-dotenv = "^1.0.0"
26
26
  pydantic = "^2.4.2"
@@ -1,3 +1,3 @@
1
1
  from . import *
2
2
  __app_name__ = "thestage"
3
- __version__ = "0.5.44"
3
+ __version__ = "0.5.45"
@@ -3,13 +3,10 @@ import re
3
3
  from pathlib import Path
4
4
  from typing import Optional, List
5
5
 
6
- from thestage.entities.container import DockerContainerEntity
7
6
  from thestage.services.clients.thestage_api.dtos.enums.container_pending_action import DockerContainerAction
8
7
  from thestage.services.clients.thestage_api.dtos.container_response import DockerContainerDto
9
8
  from thestage.i18n.translation import __
10
- from thestage.services.clients.thestage_api.dtos.enums.container_status import DockerContainerStatus
11
9
  from thestage.services.container.container_service import ContainerService
12
- from thestage.services.container.mapper.container_mapper import ContainerMapper
13
10
  from thestage.helpers.logger.app_logger import app_logger
14
11
  from thestage.controllers.utils_controller import validate_config_and_get_service_factory, get_current_directory
15
12
 
@@ -57,46 +57,12 @@ def rented_list(
57
57
  config = service_factory.get_config_provider().get_full_config()
58
58
 
59
59
  instance_service: InstanceService = service_factory.get_instance_service()
60
- instance_rented_status_map = service_factory.get_thestage_api_client().get_rented_business_status_map(config.main.thestage_auth_token)
61
-
62
- if not statuses:
63
- statuses = ({key: instance_rented_status_map[key] for key in [
64
- InstanceRentedBusinessStatus.ONLINE,
65
- InstanceRentedBusinessStatus.CREATING,
66
- InstanceRentedBusinessStatus.TERMINATING,
67
- InstanceRentedBusinessStatus.REBOOTING,
68
- ]}).values()
69
-
70
- if "all" in statuses:
71
- statuses = instance_rented_status_map.values()
72
-
73
- for input_status_item in statuses:
74
- if input_status_item not in instance_rented_status_map.values():
75
- typer.echo(__("'%invalid_status%' is not one of %valid_statuses%", {
76
- 'invalid_status': input_status_item,
77
- 'valid_statuses': str(list(instance_rented_status_map.values()))
78
- }))
79
- raise typer.Exit(1)
80
-
81
- typer.echo(__(
82
- "Listing rented server instances with the following statuses: %statuses%, to view all rented server instances, use --status all",
83
- placeholders={
84
- 'statuses': ', '.join([status_item for status_item in statuses])
85
- }))
86
-
87
- backend_statuses: List[str] = [key for key, value in instance_rented_status_map.items() if value in statuses]
88
-
89
- instance_service.print(
90
- func_get_data=instance_service.get_rented_list,
91
- func_special_params={
92
- 'statuses': backend_statuses,
93
- },
94
- mapper=InstanceMapper(),
60
+
61
+ instance_service.print_rented_instance_list(
95
62
  config=config,
96
- headers=list(map(lambda x: x.alias, RentedInstanceEntity.model_fields.values())),
63
+ statuses=statuses,
97
64
  row=row,
98
- page=page,
99
- show_index="never",
65
+ page=page
100
66
  )
101
67
 
102
68
  typer.echo(__("Rented server instances listing complete"))
@@ -175,45 +141,12 @@ def self_hosted_list(
175
141
  config = service_factory.get_config_provider().get_full_config()
176
142
 
177
143
  instance_service: InstanceService = service_factory.get_instance_service()
178
- selfhosted_instance_status_map = service_factory.get_thestage_api_client().get_selfhosted_business_status_map(config.main.thestage_auth_token)
179
-
180
- if not statuses:
181
- statuses = ({key: selfhosted_instance_status_map[key] for key in [
182
- SelfhostedBusinessStatus.AWAITING_CONFIGURATION,
183
- SelfhostedBusinessStatus.RUNNING,
184
- SelfhostedBusinessStatus.TERMINATED,
185
- ]}).values()
186
-
187
- if "all" in statuses:
188
- statuses = selfhosted_instance_status_map.values()
189
-
190
- for input_status_item in statuses:
191
- if input_status_item not in selfhosted_instance_status_map.values():
192
- typer.echo(__("'%invalid_status%' is not one of %valid_statuses%", {
193
- 'invalid_status': input_status_item,
194
- 'valid_statuses': str(list(selfhosted_instance_status_map.values()))
195
- }))
196
- raise typer.Exit(1)
197
-
198
- typer.echo(__(
199
- "Listing self-hosted instances with the following statuses: %statuses%, to view all self-hosted instances, use --status all",
200
- placeholders={
201
- 'statuses': ', '.join([status_item for status_item in statuses])
202
- }))
203
-
204
- backend_statuses: List[str] = [key for key, value in selfhosted_instance_status_map.items() if value in statuses]
205
-
206
- instance_service.print(
207
- func_get_data=instance_service.get_self_hosted_list,
208
- func_special_params={
209
- 'statuses': backend_statuses,
210
- },
211
- mapper=SelfHostedMapper(),
144
+
145
+ instance_service.print_self_hosted_instance_list(
212
146
  config=config,
213
- headers=list(map(lambda x: x.alias, SelfHostedInstanceEntity.model_fields.values())),
147
+ statuses=statuses,
214
148
  row=row,
215
- page=page,
216
- show_index="never",
149
+ page=page
217
150
  )
218
151
 
219
152
  typer.echo(__("Self-hosted instances listing complete"))
@@ -236,29 +236,9 @@ def list_runs(
236
236
 
237
237
  service_factory = validate_config_and_get_service_factory()
238
238
  config = service_factory.get_config_provider().get_full_config()
239
-
240
239
  project_service: ProjectService = service_factory.get_project_service()
241
240
 
242
- if not project_uid:
243
- project_config: ProjectConfig = service_factory.get_config_provider().read_project_config()
244
- if not project_config:
245
- typer.echo(__("Provide the project unique ID or run this command from within an initialized project directory"))
246
- raise typer.Exit(1)
247
- project_uid = project_config.slug
248
-
249
- project_service.print(
250
- func_get_data=project_service.get_project_task_list,
251
- func_special_params={
252
- 'project_slug': project_uid,
253
- },
254
- mapper=ProjectTaskMapper(),
255
- config=config,
256
- headers=list(map(lambda x: x.alias, ProjectTaskEntity.model_fields.values())),
257
- row=row,
258
- page=page,
259
- max_col_width=[100, 100, 100, 100, 100, 100, 100, 100],
260
- show_index="never",
261
- )
241
+ project_service.print_task_list(config, project_uid, row, page)
262
242
 
263
243
  typer.echo(__("Tasks listing complete"))
264
244
  raise typer.Exit(0)
@@ -664,58 +644,9 @@ def list_inference_simulators(
664
644
 
665
645
  service_factory = validate_config_and_get_service_factory()
666
646
  config = service_factory.get_config_provider().get_full_config()
667
-
668
647
  project_service: ProjectService = service_factory.get_project_service()
669
- if not project_uid:
670
- project_config: ProjectConfig = service_factory.get_config_provider().read_project_config()
671
- if not project_config:
672
- typer.echo(__("Provide the project unique ID or run this command from within an initialized project directory"))
673
- raise typer.Exit(1)
674
- project_uid = project_config.slug
675
-
676
- inference_simulator_status_map = service_factory.get_thestage_api_client().get_inference_simulator_business_status_map(
677
- config.main.thestage_auth_token)
678
-
679
- if not statuses:
680
- statuses = ({key: inference_simulator_status_map[key] for key in [
681
- InferenceSimulatorStatus.SCHEDULED,
682
- InferenceSimulatorStatus.CREATING,
683
- InferenceSimulatorStatus.RUNNING,
684
- ]}).values()
685
-
686
- if "all" in statuses:
687
- statuses = inference_simulator_status_map.values()
688
-
689
- for input_status_item in statuses:
690
- if input_status_item not in inference_simulator_status_map.values():
691
- typer.echo(__("'%invalid_status%' is not one of %valid_statuses%", {
692
- 'invalid_status': input_status_item,
693
- 'valid_statuses': str(list(inference_simulator_status_map.values()))
694
- }))
695
- raise typer.Exit(1)
696
648
 
697
- typer.echo(__(
698
- "Listing inference simulators with the following statuses: %statuses%, to view all inference simulators, use --status all",
699
- placeholders={
700
- 'statuses': ', '.join([status_item for status_item in statuses])
701
- }))
702
-
703
- backend_statuses: List[str] = [key for key, value in inference_simulator_status_map.items() if value in statuses]
704
-
705
- project_service.print(
706
- func_get_data=project_service.get_project_inference_simulator_list,
707
- func_special_params={
708
- 'project_slug': project_uid,
709
- 'statuses': backend_statuses,
710
- },
711
- mapper=ProjectInferenceSimulatorMapper(),
712
- config=config,
713
- headers=list(map(lambda x: x.alias, ProjectInferenceSimulatorEntity.model_fields.values())),
714
- row=row,
715
- page=page,
716
- max_col_width=[100, 100, 100, 100, 100, 100, 100, 100],
717
- show_index="never",
718
- )
649
+ project_service.print_inference_simulator_list(config, project_uid, statuses, row, page)
719
650
 
720
651
  typer.echo(__("Inference simulators listing complete"))
721
652
  raise typer.Exit(0)
@@ -753,58 +684,9 @@ def list_inference_simulator_models(
753
684
 
754
685
  service_factory = validate_config_and_get_service_factory()
755
686
  config = service_factory.get_config_provider().get_full_config()
756
-
757
687
  project_service: ProjectService = service_factory.get_project_service()
758
- if not project_uid:
759
- project_config: ProjectConfig = service_factory.get_config_provider().read_project_config()
760
- if not project_config:
761
- typer.echo(__("Provide the project unique ID or run this command from within an initialized project directory"))
762
- raise typer.Exit(1)
763
- project_uid = project_config.slug
764
-
765
- inference_simulator_model_status_map = service_factory.get_thestage_api_client().get_inference_simulator_model_business_status_map(
766
- config.main.thestage_auth_token)
767
-
768
- if not statuses:
769
- statuses = ({key: inference_simulator_model_status_map[key] for key in [
770
- InferenceModelStatus.SCHEDULED,
771
- InferenceModelStatus.PROCESSING,
772
- InferenceModelStatus.PUSH_SUCCEED,
773
- ]}).values()
774
-
775
- if "all" in statuses:
776
- statuses = inference_simulator_model_status_map.values()
777
-
778
- for input_status_item in statuses:
779
- if input_status_item not in inference_simulator_model_status_map.values():
780
- typer.echo(__("'%invalid_status%' is not one of %valid_statuses%", {
781
- 'invalid_status': input_status_item,
782
- 'valid_statuses': str(list(inference_simulator_model_status_map.values()))
783
- }))
784
- raise typer.Exit(1)
785
688
 
786
- typer.echo(__(
787
- "Listing inference simulator models with the following statuses: %statuses%, to view all inference simulator models, use --status all",
788
- placeholders={
789
- 'statuses': ', '.join([status_item for status_item in statuses])
790
- }))
791
-
792
- backend_statuses: List[str] = [key for key, value in inference_simulator_model_status_map.items() if value in statuses]
793
-
794
- project_service.print(
795
- func_get_data=project_service.get_project_inference_simulator_model_list,
796
- func_special_params={
797
- 'project_slug': project_uid,
798
- 'statuses': backend_statuses,
799
- },
800
- mapper=ProjectInferenceSimulatorModelMapper(),
801
- config=config,
802
- headers=list(map(lambda x: x.alias, ProjectInferenceSimulatorModelEntity.model_fields.values())),
803
- row=row,
804
- page=page,
805
- max_col_width=[100, 100, 100, 100, 100, 100, 100, 100],
806
- show_index="never",
807
- )
689
+ project_service.print_inference_simulator_model_list(config, project_uid, statuses, row, page)
808
690
 
809
691
  typer.echo(__("Inference simulator models listing complete"))
810
692
  raise typer.Exit(0)
@@ -1,3 +1,8 @@
1
+ from thestage.services.core_files.config_entity import ConfigEntity
2
+
3
+ # TODO use this in config_provider
4
+ initial_config: ConfigEntity = ConfigEntity()
5
+
1
6
  def main():
2
7
  try:
3
8
  import warnings
@@ -8,9 +13,9 @@ def main():
8
13
  from thestage.controllers import base_controller, container_controller, instance_controller, project_controller, \
9
14
  config_controller
10
15
 
16
+ base_controller.app.add_typer(project_controller.app, name="project")
11
17
  base_controller.app.add_typer(container_controller.app, name="container")
12
18
  base_controller.app.add_typer(instance_controller.app, name="instance")
13
- base_controller.app.add_typer(project_controller.app, name="project")
14
19
  base_controller.app.add_typer(config_controller.app, name="config")
15
20
 
16
21
  import thestage.config
@@ -13,7 +13,7 @@ from thestage.color_scheme.color_scheme import ColorScheme
13
13
  from thestage.config import THESTAGE_CONFIG_DIR
14
14
  from thestage.exceptions.git_access_exception import GitAccessException
15
15
  from thestage.git.ProgressPrinter import ProgressPrinter
16
- from thestage.services.filesystem_service import FileSystemServiceCore
16
+ from thestage.services.filesystem_service import FileSystemService
17
17
 
18
18
 
19
19
  class GitLocalClient:
@@ -27,7 +27,7 @@ class GitLocalClient:
27
27
 
28
28
  def __init__(
29
29
  self,
30
- file_system_service: FileSystemServiceCore,
30
+ file_system_service: FileSystemService,
31
31
  ):
32
32
  self.__file_system_service = file_system_service
33
33
 
@@ -85,12 +85,11 @@ from thestage.services.clients.thestage_api.dtos.task_controller.task_list_for_p
85
85
  from thestage.services.clients.thestage_api.dtos.task_controller.task_status_localized_map_response import \
86
86
  TaskStatusLocalizedMapResponse
87
87
  from thestage.services.clients.thestage_api.dtos.task_controller.task_view_response import TaskViewResponse
88
- from thestage.services.clients.thestage_api.dtos.user_profile import UserProfileResponse
89
88
  from thestage.services.clients.thestage_api.dtos.instance_rented_response import InstanceRentedListResponse, \
90
89
  InstanceRentedDto, InstanceRentedItemResponse, InstanceRentedBusinessStatusMapperResponse
91
90
 
92
- from thestage.services.clients.thestage_api.dtos.base_response import TheStageBaseResponse, \
93
- TheStageBasePaginatedResponse
91
+ from thestage.services.clients.thestage_api.dtos.base_response import TheStageBaseResponse
92
+ from thestage.services.clients.thestage_api.dtos.user_controller.user_profile import UserProfileResponse
94
93
  from thestage.services.project.dto.inference_simulator_dto import InferenceSimulatorDto
95
94
  from thestage.services.project.dto.inference_simulator_model_dto import InferenceSimulatorModelDto
96
95
  from thestage.services.task.dto.task_dto import TaskDto
@@ -146,7 +145,6 @@ class TheStageApiClient(TheStageApiClientCore):
146
145
  result = TaskListForProjectResponse.model_validate(response) if response else None
147
146
  return result.tasks if result and result.is_success else None
148
147
 
149
-
150
148
  def get_inference_simulator_list_for_project(
151
149
  self,
152
150
  token: str,
@@ -203,7 +201,6 @@ class TheStageApiClient(TheStageApiClientCore):
203
201
  result = InferenceSimulatorModelListForProjectResponse.model_validate(response) if response else None
204
202
  return result.inferenceSimulatorModels if result and result.is_success else None
205
203
 
206
-
207
204
  def get_rented_instance_list(
208
205
  self,
209
206
  token: str,
@@ -260,7 +257,7 @@ class TheStageApiClient(TheStageApiClientCore):
260
257
 
261
258
  return data.taskStatusMap if data else None
262
259
 
263
- def get_rented_item(
260
+ def get_rented_instance(
264
261
  self,
265
262
  token: str,
266
263
  instance_slug: Optional[str] = None,
@@ -282,7 +279,7 @@ class TheStageApiClient(TheStageApiClientCore):
282
279
 
283
280
  return InstanceRentedItemResponse.model_validate(response).instance_rented if response else None
284
281
 
285
- def get_selfhosted_item(
282
+ def get_selfhosted_instance(
286
283
  self,
287
284
  token: str,
288
285
  instance_slug: Optional[str] = None,
@@ -347,19 +344,6 @@ class TheStageApiClient(TheStageApiClientCore):
347
344
  data = SelfHostedRentedRentedBusinessStatusMapperResponse.model_validate(response) if response else None
348
345
  return data.selfhosted_instance_business_status_map if data else None
349
346
 
350
- def get_profile(
351
- self,
352
- token: str,
353
- ) -> Optional[UserProfileResponse]:
354
-
355
- response = self._request(
356
- method='GET',
357
- url='/frontend-api/user/my-profile',
358
- token=token,
359
- )
360
-
361
- result = UserProfileResponse.model_validate(response) if response else None
362
- return result if result else None
363
347
 
364
348
  def cancel_task(
365
349
  self,
@@ -521,8 +505,9 @@ class TheStageApiClient(TheStageApiClientCore):
521
505
 
522
506
  return ProjectRunTaskResponse.model_validate(response) if response else None
523
507
 
524
-
525
- async def poll_logs_httpx(self, token: str, docker_container_id: Optional[int], last_log_timestamp: str, last_log_id: str, task_id: Optional[int] = None, inference_simulator_id: Optional[int] = None) -> Optional[LogPollingResponse]:
508
+ async def poll_logs_httpx(self, token: str, docker_container_id: Optional[int], last_log_timestamp: str,
509
+ last_log_id: str, task_id: Optional[int] = None,
510
+ inference_simulator_id: Optional[int] = None) -> Optional[LogPollingResponse]:
526
511
  request_headers = {'Content-Type': 'application/json'}
527
512
  if token: request_headers['Authorization'] = f"Bearer {token}"
528
513
 
@@ -544,7 +529,6 @@ class TheStageApiClient(TheStageApiClientCore):
544
529
 
545
530
  return LogPollingResponse.model_validate(response.json()) if response else None
546
531
 
547
-
548
532
  def add_public_ssh_key_to_user(self, token: str, public_key: str, note: str) -> AddSshKeyToUserResponse:
549
533
  request = AddSshKeyToUserRequest(
550
534
  sshKey=public_key,
@@ -561,7 +545,6 @@ class TheStageApiClient(TheStageApiClientCore):
561
545
  result = AddSshKeyToUserResponse.model_validate(response) if response else None
562
546
  return result
563
547
 
564
-
565
548
  def is_user_has_ssh_public_key(self, token: str, public_key: str) -> IsUserHasSshPublicKeyResponse:
566
549
  request = IsUserHasSshPublicKeyRequest(
567
550
  sshKey=public_key,
@@ -577,8 +560,8 @@ class TheStageApiClient(TheStageApiClientCore):
577
560
  result = IsUserHasSshPublicKeyResponse.model_validate(response) if response else None
578
561
  return result
579
562
 
580
-
581
- def add_public_ssh_key_to_instance_rented(self, token: str, instance_rented_id: int, ssh_key_pair_id: int) -> AddSshPublicKeyToInstanceResponse:
563
+ def add_public_ssh_key_to_instance_rented(self, token: str, instance_rented_id: int,
564
+ ssh_key_pair_id: int) -> AddSshPublicKeyToInstanceResponse:
582
565
  request = AddSshPublicKeyToInstanceRequest(
583
566
  instanceRentedId=instance_rented_id,
584
567
  sshPublicKeyId=ssh_key_pair_id,
@@ -594,7 +577,6 @@ class TheStageApiClient(TheStageApiClientCore):
594
577
  result = AddSshPublicKeyToInstanceResponse.model_validate(response) if response else None
595
578
  return result
596
579
 
597
-
598
580
  def start_project_inference_simulator(
599
581
  self,
600
582
  token: str,
@@ -625,7 +607,6 @@ class TheStageApiClient(TheStageApiClientCore):
625
607
 
626
608
  return ProjectStartInferenceSimulatorResponse.model_validate(response) if response else None
627
609
 
628
-
629
610
  def push_project_inference_simulator_model(
630
611
  self,
631
612
  token: str,
@@ -644,7 +625,6 @@ class TheStageApiClient(TheStageApiClientCore):
644
625
 
645
626
  return ProjectPushInferenceSimulatorModelResponse.model_validate(response) if response else None
646
627
 
647
-
648
628
  def get_inference_simulator_business_status_map(self, token: str, ) -> Optional[Dict[str, str]]:
649
629
  response = self._request(
650
630
  method='POST',
@@ -657,7 +637,6 @@ class TheStageApiClient(TheStageApiClientCore):
657
637
 
658
638
  return data.inference_simulator_status_map if data else None
659
639
 
660
-
661
640
  def get_inference_simulator_model_business_status_map(self, token: str, ) -> Optional[Dict[str, str]]:
662
641
  response = self._request(
663
642
  method='POST',
@@ -688,7 +667,6 @@ class TheStageApiClient(TheStageApiClientCore):
688
667
  )
689
668
  return GetInferenceSimulatorResponse.model_validate(response) if response else None
690
669
 
691
-
692
670
  @error_handler()
693
671
  def deploy_inference_model_to_instance(
694
672
  self,
@@ -702,8 +680,8 @@ class TheStageApiClient(TheStageApiClientCore):
702
680
  request = DeployInferenceModelToInstanceRequest(
703
681
  inferenceSimulatorSlug=unique_id_with_timestamp,
704
682
  modelSlug=unique_id,
705
- instanceRentedSlug = rented_instance_unique_id,
706
- selfhostedInstanceSlug = self_hosted_instance_unique_id
683
+ instanceRentedSlug=rented_instance_unique_id,
684
+ selfhostedInstanceSlug=self_hosted_instance_unique_id
707
685
  )
708
686
 
709
687
  response = self._request(
@@ -714,7 +692,6 @@ class TheStageApiClient(TheStageApiClientCore):
714
692
  )
715
693
  return DeployInferenceModelToInstanceResponse.model_validate(response) if response else None
716
694
 
717
-
718
695
  @error_handler()
719
696
  def deploy_inference_model_to_sagemaker(
720
697
  self,
@@ -735,8 +712,9 @@ class TheStageApiClient(TheStageApiClientCore):
735
712
  )
736
713
  return DeployInferenceModelToSagemakerResponse.model_validate(response) if response else None
737
714
 
738
-
739
- def query_user_logs(self, token: str, limit: int, task_id: Optional[int] = None, inference_simulator_id: Optional[int] = None, container_id: Optional[int] = None) -> UserLogsQueryResponse:
715
+ def query_user_logs(self, token: str, limit: int, task_id: Optional[int] = None,
716
+ inference_simulator_id: Optional[int] = None,
717
+ container_id: Optional[int] = None) -> UserLogsQueryResponse:
740
718
  request = UserLogsQueryRequest(
741
719
  inferenceSimulatorId=inference_simulator_id,
742
720
  taskId=task_id,
@@ -753,4 +731,4 @@ class TheStageApiClient(TheStageApiClientCore):
753
731
  )
754
732
 
755
733
  result = UserLogsQueryResponse.model_validate(response) if response else None
756
- return result
734
+ return result
@@ -3,7 +3,10 @@ from typing import Optional
3
3
  from pydantic import BaseModel, Field
4
4
 
5
5
 
6
- class UserProfileResponse(BaseModel):
7
- name: Optional[str] = Field(None, alias='name')
6
+ class UserProfile(BaseModel):
8
7
  email: Optional[str] = Field(None, alias='email')
9
- metamask_wallet: Optional[str] = Field(None, alias='metamaskWallet')
8
+
9
+
10
+
11
+ class UserProfileResponse(BaseModel):
12
+ userProfile: Optional[UserProfile] = Field(None, alias='userProfile')
@@ -10,7 +10,7 @@ from thestage.exceptions.file_system_exception import FileSystemException
10
10
  from thestage.services.core_files.config_entity import ConfigEntity
11
11
  from thestage.helpers.ssh_util import parse_private_key
12
12
  from thestage.services.connect.dto.remote_server_config import RemoteServerConfig
13
- from thestage.services.filesystem_service import FileSystemServiceCore
13
+ from thestage.services.filesystem_service import FileSystemService
14
14
  from thestage.services.project.dto.project_config import ProjectConfig
15
15
  from thestage.config import THESTAGE_CONFIG_DIR, THESTAGE_CONFIG_FILE, THESTAGE_AUTH_TOKEN, THESTAGE_API_URL
16
16
 
@@ -20,30 +20,27 @@ class ConfigProvider():
20
20
  _local_config_path: Optional[Path] = None
21
21
  _global_config_path: Optional[Path] = None
22
22
  _global_config_file: Optional[Path] = None
23
- _file_system_service = FileSystemServiceCore
23
+ _file_system_service = FileSystemService
24
24
 
25
25
 
26
26
  def __init__(
27
27
  self,
28
28
  local_path: Optional[str] = None,
29
29
  ):
30
- self._file_system_service = FileSystemServiceCore()
30
+ self._file_system_service = FileSystemService()
31
31
  if local_path:
32
32
  self._local_path = self._file_system_service.get_path(directory=local_path, auto_create=False)
33
33
 
34
- config_folder_name = self._file_system_service.get_path(f"{THESTAGE_CONFIG_DIR}", False)
35
- self._local_config_path = self._local_path.joinpath(config_folder_name)
34
+ self._local_config_path = self._local_path.joinpath(THESTAGE_CONFIG_DIR)
36
35
 
37
36
  home_dir = self._file_system_service.get_home_path()
38
- self._global_config_path = home_dir.joinpath(config_folder_name)
37
+ self._global_config_path = home_dir.joinpath(THESTAGE_CONFIG_DIR)
39
38
 
40
39
  if self._global_config_path:
41
40
  if not self._global_config_path.exists():
42
41
  self._file_system_service.create_if_not_exists_dir(self._global_config_path)
43
42
 
44
- self._global_config_file = self._global_config_path.joinpath(
45
- self._file_system_service.get_path(f"{THESTAGE_CONFIG_FILE}", False)
46
- )
43
+ self._global_config_file = self._global_config_path.joinpath(THESTAGE_CONFIG_FILE)
47
44
  if not self._global_config_file.exists():
48
45
  self._file_system_service.create_if_not_exists_file(self._global_config_file)
49
46
 
@@ -61,7 +58,7 @@ class ConfigProvider():
61
58
  if config_from_env:
62
59
  self.__update_config_values_dict(values_to_update=config_values, new_values=config_from_env)
63
60
 
64
- config_from_file = self.__read_config_file(self._global_config_file)
61
+ config_from_file = self._file_system_service.read_config_file(self._global_config_file)
65
62
  if config_from_file:
66
63
  self.__update_config_values_dict(values_to_update=config_values, new_values=config_from_file)
67
64
 
@@ -112,7 +109,7 @@ class ConfigProvider():
112
109
  if not project_data_filepath.exists():
113
110
  return None
114
111
 
115
- config_data = self.__read_config_file(project_data_filepath) if project_data_filepath and project_data_filepath.exists() else {}
112
+ config_data = self._file_system_service.read_config_file(project_data_filepath) if project_data_filepath and project_data_filepath.exists() else {}
116
113
  return ProjectConfig.model_validate(config_data)
117
114
 
118
115
 
@@ -165,7 +162,7 @@ class ConfigProvider():
165
162
  if not config_filepath.is_file():
166
163
  return None
167
164
 
168
- config_data = self.__read_config_file(config_filepath) if config_filepath and config_filepath.exists() else {}
165
+ config_data = self._file_system_service.read_config_file(config_filepath) if config_filepath and config_filepath.exists() else {}
169
166
  return RemoteServerConfig.model_validate(config_data)
170
167
 
171
168
 
@@ -188,22 +185,6 @@ class ConfigProvider():
188
185
  else:
189
186
  values_to_update['main'] = new_values['main']
190
187
 
191
-
192
- def __read_config_file(self, path: Path) -> Dict[str, Any]:
193
- result = {}
194
- try:
195
- if path and path.exists():
196
- with path.open("r") as file:
197
- try:
198
- if os.stat(path).st_size != 0:
199
- result = json.load(file)
200
- except JSONDecodeError:
201
- pass
202
- except OSError:
203
- raise FileSystemException(f"Could not open config file: {path}")
204
- return result
205
-
206
-
207
188
  @staticmethod
208
189
  def __save_config_file(data: Dict, file_path: Path):
209
190
  with open(file_path, 'w') as configfile:
@@ -211,7 +192,7 @@ class ConfigProvider():
211
192
 
212
193
 
213
194
  def save_config(self, config: ConfigEntity):
214
- data: Dict[str, Any] = self.__read_config_file(self._global_config_file)
195
+ data: Dict[str, Any] = self._file_system_service.read_config_file(self._global_config_file)
215
196
  data.update(config.model_dump(exclude_none=True, by_alias=True, exclude={'runtime', 'RUNTIME', 'daemon', 'DAEMON'}))
216
197
  self.__save_config_file(data=data, file_path=self._global_config_file)
217
198