thestage 0.6.1__py3-none-any.whl → 0.6.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- thestage/__init__.py +1 -1
- thestage/controllers/project_controller.py +18 -10
- thestage/services/clients/git/git_client.py +7 -4
- thestage/services/project/project_service.py +32 -39
- {thestage-0.6.1.dist-info → thestage-0.6.2.dist-info}/METADATA +1 -1
- {thestage-0.6.1.dist-info → thestage-0.6.2.dist-info}/RECORD +9 -9
- {thestage-0.6.1.dist-info → thestage-0.6.2.dist-info}/LICENSE.txt +0 -0
- {thestage-0.6.1.dist-info → thestage-0.6.2.dist-info}/WHEEL +0 -0
- {thestage-0.6.1.dist-info → thestage-0.6.2.dist-info}/entry_points.txt +0 -0
thestage/__init__.py
CHANGED
|
@@ -137,9 +137,16 @@ def run(
|
|
|
137
137
|
None,
|
|
138
138
|
"--files-add",
|
|
139
139
|
"-fa",
|
|
140
|
-
help=__("Files to add to the commit. You can add files by their relative path from the working directory with a comma as a separator.
|
|
140
|
+
help=__("Files to add to the commit. You can add files by their relative path from the working directory with a comma as a separator."),
|
|
141
141
|
is_eager=False,
|
|
142
142
|
),
|
|
143
|
+
is_skip_auto_commit: Optional[bool] = typer.Option(
|
|
144
|
+
False,
|
|
145
|
+
"--skip-autocommit",
|
|
146
|
+
"-sa",
|
|
147
|
+
help=__("Skip automatic commit of the changes"),
|
|
148
|
+
is_eager=False,
|
|
149
|
+
),
|
|
143
150
|
):
|
|
144
151
|
command_name = CliCommand.PROJECT_RUN
|
|
145
152
|
app_logger.info(f'Running {command_name} from {get_current_directory()}')
|
|
@@ -158,6 +165,7 @@ def run(
|
|
|
158
165
|
docker_container_slug=docker_container_slug,
|
|
159
166
|
task_title=task_title,
|
|
160
167
|
files_to_add=files_to_add,
|
|
168
|
+
is_skip_auto_commit=is_skip_auto_commit,
|
|
161
169
|
)
|
|
162
170
|
|
|
163
171
|
if enable_log_stream:
|
|
@@ -265,13 +273,6 @@ def checkout_project(
|
|
|
265
273
|
help=__("Full path to working directory"),
|
|
266
274
|
is_eager=False,
|
|
267
275
|
),
|
|
268
|
-
files_to_add: Optional[str] = typer.Option(
|
|
269
|
-
None,
|
|
270
|
-
"--files-add",
|
|
271
|
-
"-fa",
|
|
272
|
-
help=__("Files to add to the commit. You can add files by their relative path from the working directory with a comma as a separator. Use '.' to add all files."),
|
|
273
|
-
is_eager=False,
|
|
274
|
-
),
|
|
275
276
|
):
|
|
276
277
|
command_name = CliCommand.PROJECT_CHECKOUT
|
|
277
278
|
app_logger.info(f'Running {command_name} from {get_current_directory()}')
|
|
@@ -293,7 +294,6 @@ def checkout_project(
|
|
|
293
294
|
project_service.checkout_project(
|
|
294
295
|
task_id=task_id,
|
|
295
296
|
branch_name=branch_name,
|
|
296
|
-
files_to_add=files_to_add,
|
|
297
297
|
)
|
|
298
298
|
|
|
299
299
|
raise typer.Exit(0)
|
|
@@ -457,7 +457,14 @@ def run_inference_simulator(
|
|
|
457
457
|
None,
|
|
458
458
|
"--files-add",
|
|
459
459
|
"-fa",
|
|
460
|
-
help=__("Files to add to the commit. You can add files by their relative path from the working directory with a comma as a separator.
|
|
460
|
+
help=__("Files to add to the commit. You can add files by their relative path from the working directory with a comma as a separator."),
|
|
461
|
+
is_eager=False,
|
|
462
|
+
),
|
|
463
|
+
is_skip_auto_commit: Optional[bool] = typer.Option(
|
|
464
|
+
False,
|
|
465
|
+
"--skip-autocommit",
|
|
466
|
+
"-sa",
|
|
467
|
+
help=__("Skip automatic commit of the changes"),
|
|
461
468
|
is_eager=False,
|
|
462
469
|
),
|
|
463
470
|
):
|
|
@@ -506,6 +513,7 @@ def run_inference_simulator(
|
|
|
506
513
|
inference_dir=inference_dir,
|
|
507
514
|
is_skip_installation=is_skip_installation,
|
|
508
515
|
files_to_add=files_to_add,
|
|
516
|
+
is_skip_auto_commit=is_skip_auto_commit,
|
|
509
517
|
)
|
|
510
518
|
|
|
511
519
|
if enable_log_stream:
|
|
@@ -267,7 +267,10 @@ class GitLocalClient:
|
|
|
267
267
|
if repo:
|
|
268
268
|
try:
|
|
269
269
|
diff: str = repo.git.diff("--cached", "--stat")
|
|
270
|
-
|
|
270
|
+
if diff:
|
|
271
|
+
return diff.splitlines()[-1]
|
|
272
|
+
else:
|
|
273
|
+
return None
|
|
271
274
|
except ValueError as e:
|
|
272
275
|
return str(e)
|
|
273
276
|
|
|
@@ -282,10 +285,10 @@ class GitLocalClient:
|
|
|
282
285
|
If files_to_add is not provided, adds all changed/new files except those that are too large.
|
|
283
286
|
Returns True if files were added, False if operation was aborted due to large files.
|
|
284
287
|
"""
|
|
285
|
-
if files_to_add
|
|
286
|
-
return self.
|
|
288
|
+
if files_to_add:
|
|
289
|
+
return self.add_files_by_path(repo_path=repo_path, files_to_add=files_to_add, max_file_size=max_file_size)
|
|
287
290
|
|
|
288
|
-
return self.
|
|
291
|
+
return self.add_all_files(repo_path=repo_path, max_file_size=max_file_size)
|
|
289
292
|
|
|
290
293
|
|
|
291
294
|
def add_files_by_path(
|
|
@@ -233,6 +233,7 @@ class ProjectService(AbstractService):
|
|
|
233
233
|
commit_hash: Optional[str] = None,
|
|
234
234
|
docker_container_slug: Optional[str] = None,
|
|
235
235
|
files_to_add: Optional[str] = None,
|
|
236
|
+
is_skip_auto_commit: Optional[bool] = False,
|
|
236
237
|
) -> Optional[TaskDto]:
|
|
237
238
|
config = self.__config_provider.get_config()
|
|
238
239
|
project_config: ProjectConfig = self.__get_fixed_project_config()
|
|
@@ -280,24 +281,23 @@ class ProjectService(AbstractService):
|
|
|
280
281
|
|
|
281
282
|
self.__config_provider.save_project_config(project_config=project_config)
|
|
282
283
|
|
|
283
|
-
|
|
284
|
-
typer.echo(__("Cannot provide both files to add and commit hash."))
|
|
285
|
-
raise typer.Exit(1)
|
|
286
|
-
|
|
287
|
-
has_changes = self.__git_local_client.has_changes_with_untracked(
|
|
288
|
-
path=config.runtime.working_directory,
|
|
289
|
-
)
|
|
284
|
+
has_wrong_args = files_to_add and commit_hash or is_skip_auto_commit and commit_hash or files_to_add and is_skip_auto_commit
|
|
290
285
|
|
|
291
|
-
if
|
|
292
|
-
|
|
286
|
+
if has_wrong_args:
|
|
287
|
+
warning_msg = f"[{ColorScheme.WARNING.value}][WARNING] You can provide only one of the following arguments: --commit-hash, --files-add, --skip-autocommit[{ColorScheme.WARNING.value}]"
|
|
288
|
+
print(warning_msg)
|
|
289
|
+
raise typer.Exit(1)
|
|
293
290
|
|
|
294
|
-
if
|
|
291
|
+
if not is_skip_auto_commit and not commit_hash:
|
|
295
292
|
is_git_folder = self.__git_local_client.is_present_local_git(path=config.runtime.working_directory)
|
|
296
293
|
if not is_git_folder:
|
|
297
294
|
typer.echo("Error: working directory does not contain git repository")
|
|
298
295
|
raise typer.Exit(1)
|
|
299
296
|
|
|
300
297
|
is_commit_allowed: bool = True
|
|
298
|
+
has_changes = self.__git_local_client.has_changes_with_untracked(
|
|
299
|
+
path=config.runtime.working_directory,
|
|
300
|
+
)
|
|
301
301
|
|
|
302
302
|
if self.__git_local_client.is_head_detached(path=config.runtime.working_directory):
|
|
303
303
|
is_commit_allowed = False
|
|
@@ -326,9 +326,11 @@ class ProjectService(AbstractService):
|
|
|
326
326
|
print(warning_msg)
|
|
327
327
|
raise typer.Exit(1)
|
|
328
328
|
|
|
329
|
-
|
|
329
|
+
diff_stat = self.__git_local_client.git_diff_stat(repo_path=config.runtime.working_directory)
|
|
330
|
+
|
|
331
|
+
if has_changes and diff_stat:
|
|
330
332
|
branch_name = self.__git_local_client.get_active_branch_name(config.runtime.working_directory)
|
|
331
|
-
|
|
333
|
+
|
|
332
334
|
typer.echo(__('Active branch [%branch_name%] has uncommitted changes: %diff_stat_bottomline%', {
|
|
333
335
|
'diff_stat_bottomline': diff_stat,
|
|
334
336
|
'branch_name': branch_name,
|
|
@@ -433,6 +435,7 @@ class ProjectService(AbstractService):
|
|
|
433
435
|
inference_dir: Optional[str] = None,
|
|
434
436
|
is_skip_installation: Optional[bool] = False,
|
|
435
437
|
files_to_add: Optional[str] = None,
|
|
438
|
+
is_skip_auto_commit: Optional[bool] = False,
|
|
436
439
|
) -> Optional[InferenceSimulatorDto]:
|
|
437
440
|
config = self.__config_provider.get_config()
|
|
438
441
|
project_config: ProjectConfig = self.__get_fixed_project_config()
|
|
@@ -449,24 +452,23 @@ class ProjectService(AbstractService):
|
|
|
449
452
|
typer.echo(__("Error: Either a rented instance ID or a self-hosted instance unique ID must be provided."))
|
|
450
453
|
raise typer.Exit(1)
|
|
451
454
|
|
|
452
|
-
|
|
453
|
-
typer.echo(__("Cannot provide both files to add and commit hash."))
|
|
454
|
-
raise typer.Exit(1)
|
|
455
|
-
|
|
456
|
-
has_changes = self.__git_local_client.has_changes_with_untracked(
|
|
457
|
-
path=config.runtime.working_directory,
|
|
458
|
-
)
|
|
455
|
+
has_wrong_args = files_to_add and commit_hash or is_skip_auto_commit and commit_hash or files_to_add and is_skip_auto_commit
|
|
459
456
|
|
|
460
|
-
if
|
|
461
|
-
|
|
457
|
+
if has_wrong_args:
|
|
458
|
+
warning_msg = f"[{ColorScheme.WARNING.value}][WARNING] You can provide only one of the following arguments: --commit-hash, --files-add, --skip-autocommit[{ColorScheme.WARNING.value}]"
|
|
459
|
+
print(warning_msg)
|
|
460
|
+
raise typer.Exit(1)
|
|
462
461
|
|
|
463
|
-
if
|
|
462
|
+
if not is_skip_auto_commit and not commit_hash:
|
|
464
463
|
is_git_folder = self.__git_local_client.is_present_local_git(path=config.runtime.working_directory)
|
|
465
464
|
if not is_git_folder:
|
|
466
465
|
typer.echo("Error: Working directory does not contain git repository.")
|
|
467
466
|
raise typer.Exit(1)
|
|
468
467
|
|
|
469
468
|
is_commit_allowed: bool = True
|
|
469
|
+
has_changes = self.__git_local_client.has_changes_with_untracked(
|
|
470
|
+
path=config.runtime.working_directory,
|
|
471
|
+
)
|
|
470
472
|
|
|
471
473
|
if self.__git_local_client.is_head_detached(path=config.runtime.working_directory):
|
|
472
474
|
print(f"[{ColorScheme.GIT_HEADLESS.value}]HEAD is detached[{ColorScheme.GIT_HEADLESS.value}]")
|
|
@@ -498,9 +500,10 @@ class ProjectService(AbstractService):
|
|
|
498
500
|
print(warning_msg)
|
|
499
501
|
raise typer.Exit(1)
|
|
500
502
|
|
|
501
|
-
|
|
503
|
+
diff_stat = self.__git_local_client.git_diff_stat(repo_path=config.runtime.working_directory)
|
|
504
|
+
|
|
505
|
+
if has_changes and diff_stat:
|
|
502
506
|
branch_name = self.__git_local_client.get_active_branch_name(config.runtime.working_directory)
|
|
503
|
-
diff_stat = self.__git_local_client.git_diff_stat(repo_path=config.runtime.working_directory)
|
|
504
507
|
typer.echo(__('Active branch [%branch_name%] has uncommitted changes: %diff_stat_bottomline%', {
|
|
505
508
|
'diff_stat_bottomline': diff_stat,
|
|
506
509
|
'branch_name': branch_name,
|
|
@@ -695,7 +698,6 @@ class ProjectService(AbstractService):
|
|
|
695
698
|
self,
|
|
696
699
|
task_id: Optional[int],
|
|
697
700
|
branch_name: Optional[str],
|
|
698
|
-
files_to_add: Optional[str] = None,
|
|
699
701
|
):
|
|
700
702
|
config = self.__config_provider.get_config()
|
|
701
703
|
project_config: ProjectConfig = self.__get_fixed_project_config()
|
|
@@ -741,22 +743,13 @@ class ProjectService(AbstractService):
|
|
|
741
743
|
if self.__git_local_client.get_active_branch_name(path=config.runtime.working_directory) == branch_name:
|
|
742
744
|
typer.echo(f"You are already at branch '{branch_name}'")
|
|
743
745
|
raise typer.Exit(0)
|
|
744
|
-
|
|
745
|
-
has_changes = self.__git_local_client.has_changes_with_untracked(
|
|
746
|
-
path=config.runtime.working_directory,
|
|
747
|
-
)
|
|
748
|
-
|
|
749
|
-
if not files_to_add and has_changes:
|
|
750
|
-
print(f"[{ColorScheme.WARNING.value}][WARNING] Uncommitted changes detected, cannot checkout with uncommitted changes. You should use the -fa flag (e.g., -fa .)[{ColorScheme.WARNING.value}]")
|
|
751
|
-
raise typer.Exit(1)
|
|
752
746
|
|
|
753
|
-
if is_commit_allowed
|
|
754
|
-
|
|
747
|
+
if is_commit_allowed:
|
|
748
|
+
self.__git_local_client.git_add_all(repo_path=config.runtime.working_directory)
|
|
755
749
|
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
raise typer.Exit(1)
|
|
750
|
+
has_changes = self.__git_local_client.has_changes_with_untracked(
|
|
751
|
+
path=config.runtime.working_directory,
|
|
752
|
+
)
|
|
760
753
|
|
|
761
754
|
if has_changes:
|
|
762
755
|
active_branch_name = self.__git_local_client.get_active_branch_name(config.runtime.working_directory)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
thestage/.env,sha256=GcB35BNZN2gGwbFT-HYIBksewtL30cqdelR1fwDOj9o,188
|
|
2
|
-
thestage/__init__.py,sha256=
|
|
2
|
+
thestage/__init__.py,sha256=1zNJbCrXJLJPqFUbb0J1zP44oAmusf9voLJ_GutjhX8,67
|
|
3
3
|
thestage/__main__.py,sha256=VJhc94MF5fBWLGHwddH3IatItmRijgDF3NNQ4O6g6ck,110
|
|
4
4
|
thestage/cli_command.py,sha256=TDkmbdhlv5JD_s9DfObwliyvpuF-qRMCcBzZ9qQjn5g,2229
|
|
5
5
|
thestage/cli_command_helper.py,sha256=PaLoYRuY47FipxnORGjfL_BtudDR3cPkCzlFc8giksk,1990
|
|
@@ -12,7 +12,7 @@ thestage/controllers/base_controller.py,sha256=Zppx8OLPxgfe_7rrWoX-vw9rTs6_KkQyn
|
|
|
12
12
|
thestage/controllers/config_controller.py,sha256=g-1Jfo0y-PyA-VRYzKoJULFGfWgcLa7PJvPSNQlFj2s,5554
|
|
13
13
|
thestage/controllers/container_controller.py,sha256=_GETRHtMEWF0VjwR86adCyUZ2l2awBtP-O7p_qAbBHg,15701
|
|
14
14
|
thestage/controllers/instance_controller.py,sha256=FyNRivZUaTHHrlwqBYIUnwLQcCvYYS0N9GmhlOvygqc,6863
|
|
15
|
-
thestage/controllers/project_controller.py,sha256=
|
|
15
|
+
thestage/controllers/project_controller.py,sha256=QHlkf8OlwxqM1R8wb9Ewf5QIQPTLtbCLYde09IG_9kY,32849
|
|
16
16
|
thestage/controllers/utils_controller.py,sha256=slpKGNvqAju3Zi4ktSYm9ghYI_L3R_t6r9qhsGN8Ng0,944
|
|
17
17
|
thestage/debug_main.dist.py,sha256=a-MB916g639DcgjFLF5j7tsFZ3-_X6_Gm53uCr_zTXo,811
|
|
18
18
|
thestage/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -53,7 +53,7 @@ thestage/services/abstract_service.py,sha256=fbxuHOpBTBLMbLHCsDRa5891pDYPbzDPmnW
|
|
|
53
53
|
thestage/services/app_config_service.py,sha256=riPtwRUdLHqsdjyj2Wa5mPdsZ5P1248jKL-zJw-9Rsw,1731
|
|
54
54
|
thestage/services/clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
55
55
|
thestage/services/clients/git/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
56
|
-
thestage/services/clients/git/git_client.py,sha256=
|
|
56
|
+
thestage/services/clients/git/git_client.py,sha256=EbnviKoDvzKSgxo7IYF-ZLoISDeVXL6GkSlAhYYSBXA,17247
|
|
57
57
|
thestage/services/clients/thestage_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
58
58
|
thestage/services/clients/thestage_api/api_client.py,sha256=V3wLhUui6wilY0ISadMGiQh4CpAKCWDjg-CAcMTp4fk,31040
|
|
59
59
|
thestage/services/clients/thestage_api/core/api_client_core.py,sha256=9gVl9vRAPs_0OSF-l3d8h6ZXrabuCmd26F6VjYm3a-A,3561
|
|
@@ -164,13 +164,13 @@ thestage/services/project/mapper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
|
|
|
164
164
|
thestage/services/project/mapper/project_inference_simulator_mapper.py,sha256=ydP3_ehaZxlVHpqVXz0xtDIjFLtLxGQOIVLK30griqI,833
|
|
165
165
|
thestage/services/project/mapper/project_inference_simulator_model_mapper.py,sha256=Q3_CVzTNLzjRjnReqHjkueYWO_9xeQ6rDiQSR02-u-0,890
|
|
166
166
|
thestage/services/project/mapper/project_task_mapper.py,sha256=T8eFnmMh4ebY35oX_tSSMiP2dGfvoPMMm0FHPXTCDGg,835
|
|
167
|
-
thestage/services/project/project_service.py,sha256=
|
|
167
|
+
thestage/services/project/project_service.py,sha256=hKd-hlgq3pikLVVDHfwnyf6EctON5m4Xttxw1h5nj8E,60237
|
|
168
168
|
thestage/services/remote_server_service.py,sha256=UziUvQPG2TsdbCN-GeSseXm-mqp7jiNKKHgSKZ-jozM,23873
|
|
169
169
|
thestage/services/service_factory.py,sha256=PEzZcOcJvgE9WjtfizA834Rkz0GXpL68iejQXW6-l4E,4388
|
|
170
170
|
thestage/services/task/dto/task_dto.py,sha256=xPcJ7g70RcqrmPtwscXtXAQrX2WYNdqdwCShcivNX80,2375
|
|
171
171
|
thestage/services/validation_service.py,sha256=MHH2eIPyg41otMHq9unwuLAE83BpjYIAx2sFT_DyrsI,2304
|
|
172
|
-
thestage-0.6.
|
|
173
|
-
thestage-0.6.
|
|
174
|
-
thestage-0.6.
|
|
175
|
-
thestage-0.6.
|
|
176
|
-
thestage-0.6.
|
|
172
|
+
thestage-0.6.2.dist-info/LICENSE.txt,sha256=2fTfWmY094en7UPSH1QIbS12Qa3Wsfx-zI6z04oNASI,584
|
|
173
|
+
thestage-0.6.2.dist-info/METADATA,sha256=EOOwFwCJtNaaY6_X7mMStvSj4Z6idS3BLUOFZ9gLTBo,5506
|
|
174
|
+
thestage-0.6.2.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
175
|
+
thestage-0.6.2.dist-info/entry_points.txt,sha256=57pMhs8zaCM-jgeTffC0WVqCsh35Uq_dUDmzXR80CI4,47
|
|
176
|
+
thestage-0.6.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|