machineconfig 6.53__py3-none-any.whl → 6.54__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 machineconfig might be problematic. Click here for more details.
- machineconfig/cluster/sessions_managers/utils/maker.py +7 -10
- machineconfig/scripts/python/helpers_repos/cloud_repo_sync.py +10 -10
- machineconfig/utils/code.py +8 -18
- machineconfig/utils/ssh.py +5 -5
- {machineconfig-6.53.dist-info → machineconfig-6.54.dist-info}/METADATA +1 -1
- {machineconfig-6.53.dist-info → machineconfig-6.54.dist-info}/RECORD +9 -9
- {machineconfig-6.53.dist-info → machineconfig-6.54.dist-info}/WHEEL +0 -0
- {machineconfig-6.53.dist-info → machineconfig-6.54.dist-info}/entry_points.txt +0 -0
- {machineconfig-6.53.dist-info → machineconfig-6.54.dist-info}/top_level.txt +0 -0
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
|
|
2
2
|
from types import FunctionType
|
|
3
|
-
from typing import Literal
|
|
3
|
+
from typing import Optional, Literal
|
|
4
4
|
from machineconfig.utils.schemas.layouts.layout_types import TabConfig, LayoutConfig
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
|
|
7
|
-
def
|
|
7
|
+
def get_fire_tab_using_uv(func: FunctionType, uv_with: Optional[list[str]], uv_project_dir: Optional[str]) -> tuple[TabConfig, Path]:
|
|
8
8
|
from machineconfig.utils.meta import lambda_to_defstring
|
|
9
9
|
py_script = lambda_to_defstring(lmb=lambda: func, in_global=True)
|
|
10
|
-
from machineconfig.utils.
|
|
11
|
-
py_script_path =
|
|
12
|
-
py_script_path.parent.mkdir(parents=True, exist_ok=True)
|
|
13
|
-
py_script_path.write_text(py_script, encoding="utf-8")
|
|
14
|
-
command_to_run = f"uv run {py_script_path}"
|
|
10
|
+
from machineconfig.utils.code import get_uv_command_executing_python_script
|
|
11
|
+
command_to_run, py_script_path = get_uv_command_executing_python_script(python_script=py_script, uv_with=uv_with, uv_project_dir=uv_project_dir)
|
|
15
12
|
tab_config: TabConfig = {
|
|
16
13
|
"command": command_to_run,
|
|
17
14
|
"startDir": "$HOME",
|
|
18
15
|
"tabName": func.__name__
|
|
19
16
|
}
|
|
20
17
|
return tab_config, py_script_path
|
|
21
|
-
def
|
|
18
|
+
def get_fire_tab_using_fire(func: FunctionType):
|
|
22
19
|
import inspect
|
|
23
20
|
path = Path(inspect.getfile(func))
|
|
24
21
|
path_relative = path.relative_to(Path.home())
|
|
@@ -36,10 +33,10 @@ def make_layout_from_functions(functions: list[FunctionType], tab_configs: list[
|
|
|
36
33
|
for a_func in functions:
|
|
37
34
|
match method:
|
|
38
35
|
case "script":
|
|
39
|
-
tab_config, artifact_files_1 =
|
|
36
|
+
tab_config, artifact_files_1 = get_fire_tab_using_uv(a_func, uv_with=None, uv_project_dir=None)
|
|
40
37
|
artifact_files = [artifact_files_1]
|
|
41
38
|
case "fire":
|
|
42
|
-
tab_config =
|
|
39
|
+
tab_config = get_fire_tab_using_fire(a_func)
|
|
43
40
|
artifact_files = []
|
|
44
41
|
tabs2artifacts.append((tab_config, artifact_files))
|
|
45
42
|
list_of_tabs = [tab for tab, _ in tabs2artifacts] + tab_configs
|
|
@@ -6,7 +6,7 @@ import typer
|
|
|
6
6
|
from machineconfig.utils.path_extended import PathExtended
|
|
7
7
|
from machineconfig.utils.terminal import Response
|
|
8
8
|
from machineconfig.utils.source_of_truth import CONFIG_ROOT, DEFAULTS_PATH
|
|
9
|
-
from machineconfig.utils.code import
|
|
9
|
+
from machineconfig.utils.code import get_uv_command_executing_python_script
|
|
10
10
|
from pathlib import Path
|
|
11
11
|
import platform
|
|
12
12
|
import subprocess
|
|
@@ -112,7 +112,7 @@ git pull originEnc master
|
|
|
112
112
|
from machineconfig.scripts.python.helpers_repos.sync import delete_remote_repo_copy_and_push_local
|
|
113
113
|
delete_remote_repo_copy_and_push_local(remote_repo=remote_repo, local_repo=local_repo, cloud=cloud)
|
|
114
114
|
program_1_py = lambda_to_defstring(lambda: func2(remote_repo=str(repo_remote_root), local_repo=str(repo_local_root), cloud=str(cloud_resolved)), in_global=True)
|
|
115
|
-
|
|
115
|
+
uv_command_1, _pyfile1 = get_uv_command_executing_python_script(python_script=program_1_py, uv_with=uv_with, uv_project_dir=uv_project_dir)
|
|
116
116
|
# ================================================================================
|
|
117
117
|
option2 = "Delete local repo and replace it with remote copy:"
|
|
118
118
|
program_2 = f"""
|
|
@@ -137,7 +137,7 @@ sudo chmod +x $HOME/dotfiles/scripts/linux -R
|
|
|
137
137
|
# program_3_py = function_to_script(func=func, call_with_kwargs={"repo_local_root": str(repo_local_root), "repo_remote_root": str(repo_remote_root)})
|
|
138
138
|
# shell_file_3 = get_shell_file_executing_python_script(python_script=program_3_py, ve_path=None, executable=executable)
|
|
139
139
|
program_3_py = lambda_to_defstring(lambda: func(repo_local_root=str(repo_local_root), repo_remote_root=str(repo_remote_root)), in_global=True)
|
|
140
|
-
|
|
140
|
+
uv_command_3, _pyfile3 = get_uv_command_executing_python_script(python_script=program_3_py, uv_with=uv_with, uv_project_dir=uv_project_dir)
|
|
141
141
|
# ================================================================================
|
|
142
142
|
|
|
143
143
|
option4 = "Remove problematic rclone file from repo and replace with remote:"
|
|
@@ -146,7 +146,7 @@ rm $HOME/dotfiles/creds/rclone/rclone.conf
|
|
|
146
146
|
cp $HOME/.config/machineconfig/remote/dotfiles/creds/rclone/rclone.conf $HOME/dotfiles/creds/rclone
|
|
147
147
|
cd $HOME/dotfiles
|
|
148
148
|
git commit -am "finished merging"
|
|
149
|
-
|
|
149
|
+
{uv_command_1}
|
|
150
150
|
"""
|
|
151
151
|
shell_file_4 = Path(tempfile.mkstemp(suffix=".ps1" if platform.system() == "Windows" else ".sh")[1])
|
|
152
152
|
shell_file_4.write_text(program_4, encoding="utf-8")
|
|
@@ -154,9 +154,9 @@ git commit -am "finished merging"
|
|
|
154
154
|
|
|
155
155
|
console.print(Panel("🔄 RESOLVE MERGE CONFLICT\nChoose an option to resolve the conflict:", title_align="left", border_style="blue"))
|
|
156
156
|
|
|
157
|
-
print(f"• {option1:75} 👉 {
|
|
157
|
+
print(f"• {option1:75} 👉 {uv_command_1}")
|
|
158
158
|
print(f"• {option2:75} 👉 {shell_file_2}")
|
|
159
|
-
print(f"• {option3:75} 👉 {
|
|
159
|
+
print(f"• {option3:75} 👉 {uv_command_3}")
|
|
160
160
|
print(f"• {option4:75} 👉 {shell_file_4}")
|
|
161
161
|
print("\n\n")
|
|
162
162
|
|
|
@@ -166,21 +166,21 @@ git commit -am "finished merging"
|
|
|
166
166
|
import questionary
|
|
167
167
|
choice = questionary.select("Choose one option:", choices=[option1, option2, option3, option4]).ask()
|
|
168
168
|
if choice == option1:
|
|
169
|
-
program_content =
|
|
169
|
+
program_content = uv_command_1
|
|
170
170
|
elif choice == option2:
|
|
171
171
|
program_content = program_2
|
|
172
172
|
elif choice == option3:
|
|
173
|
-
program_content =
|
|
173
|
+
program_content = uv_command_3
|
|
174
174
|
elif choice == option4:
|
|
175
175
|
program_content = program_4
|
|
176
176
|
else:
|
|
177
177
|
raise NotImplementedError(f"Choice {choice} not implemented.")
|
|
178
178
|
case "push-local-merge":
|
|
179
|
-
program_content =
|
|
179
|
+
program_content = uv_command_1
|
|
180
180
|
case "overwrite-local":
|
|
181
181
|
program_content = program_2
|
|
182
182
|
case "stop-on-conflict":
|
|
183
|
-
program_content =
|
|
183
|
+
program_content = uv_command_3
|
|
184
184
|
case "remove-rclone-conflict":
|
|
185
185
|
program_content = program_4
|
|
186
186
|
case _:
|
machineconfig/utils/code.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
|
|
1
2
|
import atexit
|
|
2
|
-
import platform
|
|
3
|
+
# import platform
|
|
3
4
|
from typing import Optional
|
|
4
5
|
import subprocess
|
|
5
6
|
from machineconfig.utils.accessories import randstr
|
|
@@ -23,34 +24,23 @@ def print_code(code: str, lexer: str, desc: str, subtitle: str = ""):
|
|
|
23
24
|
console.print(Panel(Syntax(code=code, lexer=lexer), title=f"📄 {desc}", subtitle=subtitle), style="bold red")
|
|
24
25
|
|
|
25
26
|
|
|
26
|
-
def
|
|
27
|
+
def get_uv_command_executing_python_script(python_script: str, uv_with: Optional[list[str]], uv_project_dir: Optional[str]) -> tuple[str, Path]:
|
|
27
28
|
python_file = PathExtended.tmp().joinpath("tmp_scripts", "python", randstr() + ".py")
|
|
28
29
|
python_file.parent.mkdir(parents=True, exist_ok=True)
|
|
29
|
-
python_file.write_text(python_script, encoding="utf-8")
|
|
30
30
|
if uv_with is not None and len(uv_with) > 0:
|
|
31
|
+
uv_with.append("rich")
|
|
31
32
|
uv_with_arg = "--with " + '"' + ",".join(uv_with) + '"'
|
|
32
33
|
else:
|
|
33
|
-
uv_with_arg = ""
|
|
34
|
+
uv_with_arg = "--with rich"
|
|
34
35
|
if uv_project_dir is not None:
|
|
35
36
|
uv_project_dir_arg = "--project" + f' "{uv_project_dir}"'
|
|
36
37
|
else:
|
|
37
38
|
uv_project_dir_arg = ""
|
|
38
|
-
|
|
39
39
|
from machineconfig.utils.meta import lambda_to_defstring
|
|
40
40
|
print_code_string = lambda_to_defstring(lambda: print_code(code=python_script, lexer="python", desc="Temporary Python Script", subtitle="Executing via shell script"), in_global=True)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
shell_script = f"""
|
|
46
|
-
uv run --with rich {python_file_tmp}
|
|
47
|
-
uv run {uv_with_arg} {uv_project_dir_arg} {str(python_file)}
|
|
48
|
-
"""
|
|
49
|
-
|
|
50
|
-
shell_path = PathExtended.tmp().joinpath("tmp_scripts", "shell", randstr() + (".ps1" if platform.system() == "Windows" else ".sh"))
|
|
51
|
-
shell_path.parent.mkdir(parents=True, exist_ok=True)
|
|
52
|
-
shell_path.write_text(shell_script, encoding="utf-8")
|
|
53
|
-
return shell_path
|
|
41
|
+
python_file.write_text(print_code_string + "\n" + python_script, encoding="utf-8")
|
|
42
|
+
shell_script = f"""uv run {uv_with_arg} {uv_project_dir_arg} {str(python_file)} """
|
|
43
|
+
return shell_script, python_file
|
|
54
44
|
|
|
55
45
|
|
|
56
46
|
def run_shell_script(script: str, display_script: bool = True, clean_env: bool = False):
|
machineconfig/utils/ssh.py
CHANGED
|
@@ -189,10 +189,10 @@ class SSH:
|
|
|
189
189
|
def run_py(self, python_code: str, uv_with: Optional[list[str]], uv_project_dir: Optional[str],
|
|
190
190
|
description: str, verbose_output: bool, strict_stderr: bool, strict_return_code: bool) -> Response:
|
|
191
191
|
from machineconfig.utils.accessories import randstr
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
self.copy_from_here(source_path=
|
|
192
|
+
py_path = Path.home().joinpath(f"{DEFAULT_PICKLE_SUBDIR}/runpy_{randstr()}.py")
|
|
193
|
+
py_path.parent.mkdir(parents=True, exist_ok=True)
|
|
194
|
+
py_path.write_text(python_code, encoding="utf-8")
|
|
195
|
+
self.copy_from_here(source_path=py_path, target_path=None, compress_with_zip=False, recursive=False, overwrite_existing=False)
|
|
196
196
|
if uv_with is not None and len(uv_with) > 0:
|
|
197
197
|
with_clause = " --with " + '"' + ",".join(uv_with) + '"'
|
|
198
198
|
else:
|
|
@@ -201,7 +201,7 @@ class SSH:
|
|
|
201
201
|
with_clause += f" --project {uv_project_dir}"
|
|
202
202
|
else:
|
|
203
203
|
with_clause += ""
|
|
204
|
-
uv_cmd = f"""{UV_RUN_CMD} {with_clause} python {
|
|
204
|
+
uv_cmd = f"""{UV_RUN_CMD} {with_clause} python {py_path.relative_to(Path.home())}"""
|
|
205
205
|
return self.run_shell(command=uv_cmd, verbose_output=verbose_output, description=description or f"run_py on {self.get_remote_repr(add_machine=False)}", strict_stderr=strict_stderr, strict_return_code=strict_return_code)
|
|
206
206
|
|
|
207
207
|
def run_py_func(self, func: Callable[..., Any], uv_with: Optional[list[str]], uv_project_dir: Optional[str]) -> Response:
|
|
@@ -25,7 +25,7 @@ machineconfig/cluster/sessions_managers/zellij_remote_manager.py,sha256=xzih0y8_
|
|
|
25
25
|
machineconfig/cluster/sessions_managers/helpers/enhanced_command_runner.py,sha256=3vcQVg-HHa_WTxBGPtKMAdoSqJVa2EO5KAtrY8a6I3c,5264
|
|
26
26
|
machineconfig/cluster/sessions_managers/helpers/load_balancer_helper.py,sha256=i5TRittC1IWTgMZNyG8AR5qq-3WrGp3xgIx2m5ktT7g,7526
|
|
27
27
|
machineconfig/cluster/sessions_managers/utils/load_balancer.py,sha256=Y4RQmhROY6o7JXSJXRrBTkoAuEmu1gvmvN_7JKPw5sc,3178
|
|
28
|
-
machineconfig/cluster/sessions_managers/utils/maker.py,sha256=
|
|
28
|
+
machineconfig/cluster/sessions_managers/utils/maker.py,sha256=GPt1A17LcU7hsrG_OHoy8jmD3HTrzJR5rPFAa70xn60,2102
|
|
29
29
|
machineconfig/cluster/sessions_managers/wt_utils/layout_generator.py,sha256=OA50j16uUS9ZTjL38TLuR3jufIOln_EszMZpbWyejTo,6972
|
|
30
30
|
machineconfig/cluster/sessions_managers/wt_utils/process_monitor.py,sha256=Mitm7mKiKl5lT0OiEUHAqVg2Q21RjsKO1-hpJTHJ5lM,15196
|
|
31
31
|
machineconfig/cluster/sessions_managers/wt_utils/remote_executor.py,sha256=lApUy67_WhfaBXqt0meZSx_QvwiXjN0YLdyE3c7kP_s,6744
|
|
@@ -222,7 +222,7 @@ machineconfig/scripts/python/helpers_navigator/main_app.py,sha256=R1vOBMUKaiFHOg
|
|
|
222
222
|
machineconfig/scripts/python/helpers_navigator/search_bar.py,sha256=kDi8Jhxap8wdm7YpDBtfhwcPnSqDPFrV2LqbcSBWMT4,414
|
|
223
223
|
machineconfig/scripts/python/helpers_repos/action.py,sha256=9AxWy8mB9HFeV5t11-qD_l-KA5jkUmm0pXVKT1L6-Qk,14894
|
|
224
224
|
machineconfig/scripts/python/helpers_repos/clone.py,sha256=UULEG5xJuXlPGU0nqXH6U45jA9DOFqLw8B4iPytCwOQ,5471
|
|
225
|
-
machineconfig/scripts/python/helpers_repos/cloud_repo_sync.py,sha256=
|
|
225
|
+
machineconfig/scripts/python/helpers_repos/cloud_repo_sync.py,sha256=Ewl-flfosUO3jL23ixKcysKjR149ySlNe22W_2osmPA,10432
|
|
226
226
|
machineconfig/scripts/python/helpers_repos/count_lines.py,sha256=Q5c7b-DxvTlQmljoic7niTuiAVyFlwYvkVQ7uRJHiTo,16009
|
|
227
227
|
machineconfig/scripts/python/helpers_repos/count_lines_frontend.py,sha256=epbXDwuXe_9jXaX3KA2JlG1sPXybdGq1NX4dRljHpF8,607
|
|
228
228
|
machineconfig/scripts/python/helpers_repos/entrypoint.py,sha256=WYEFGUJp9HWImlFjbs_hiFZrUqM_KEYm5VvSUjWd04I,2810
|
|
@@ -390,7 +390,7 @@ machineconfig/setup_windows/wt_and_pwsh/__init__.py,sha256=47DEQpj8HBSa-_TImW-5J
|
|
|
390
390
|
machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py,sha256=ogxJnwpdcpH7N6dFJu95UCNoGYirZKQho_3X0F_hmXs,6791
|
|
391
391
|
machineconfig/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
392
392
|
machineconfig/utils/accessories.py,sha256=W_9dLzjwNTW5JQk_pe3B2ijQ1nA2-8Kdg2r7VBtzgQs,4340
|
|
393
|
-
machineconfig/utils/code.py,sha256=
|
|
393
|
+
machineconfig/utils/code.py,sha256=jf9RbO0daBkUUuj6jyoTY-0judpBZ4Wfp7i8PZoxzuY,5344
|
|
394
394
|
machineconfig/utils/installer.py,sha256=UzI_DtTcKbgvkAkWkNLAPUtx-RVqITHCpvZyLiCpD9g,10377
|
|
395
395
|
machineconfig/utils/io.py,sha256=4dSieoqZO8Vvi4vW8lLoITDHBvmFp4dtl3kyeZHQ6Co,2528
|
|
396
396
|
machineconfig/utils/links.py,sha256=KM6vIn3hag9FYEzLSHP5MAM9tU_RStw2mCq2_OvmmZA,23672
|
|
@@ -403,7 +403,7 @@ machineconfig/utils/procs.py,sha256=YPA_vEYQGwPd_o_Lc6nOTBo5BrB1tSs8PJ42XiGpenM,
|
|
|
403
403
|
machineconfig/utils/scheduler.py,sha256=44CASABJg3epccxhAwv2CX7TVgZh6zVy3K4vqHKTuf4,14228
|
|
404
404
|
machineconfig/utils/scheduling.py,sha256=6x5zLA7sY5gohrEtN6zGrXIqNFasMoyBfwLcOjrjiME,11109
|
|
405
405
|
machineconfig/utils/source_of_truth.py,sha256=ZAnCRltiM07ig--P6g9_6nEAvNFC4X4ERFTVcvpIYsE,764
|
|
406
|
-
machineconfig/utils/ssh.py,sha256=
|
|
406
|
+
machineconfig/utils/ssh.py,sha256=eRNatbyhxnMFSzzEEnbuORiVnQVUiAYVhVohIYuEu-Q,39310
|
|
407
407
|
machineconfig/utils/terminal.py,sha256=IlmOByfQG-vjhaFFxxzU5rWzP5_qUzmalRfuey3PAmc,11801
|
|
408
408
|
machineconfig/utils/tst.py,sha256=6u1GI49NdcpxH2BYGAusNfY5q9G_ytCGVzFM5b6HYpM,674
|
|
409
409
|
machineconfig/utils/upgrade_packages.py,sha256=mSFyKvB3JhHte_x1dtmEgrJZCAXgTUQoaJUSx1OXQ3Y,4145
|
|
@@ -432,8 +432,8 @@ machineconfig/utils/schemas/installer/installer_types.py,sha256=QClRY61QaduBPJoS
|
|
|
432
432
|
machineconfig/utils/schemas/layouts/layout_types.py,sha256=TcqlZdGVoH8htG5fHn1KWXhRdPueAcoyApppZsPAPto,2020
|
|
433
433
|
machineconfig/utils/schemas/repos/repos_types.py,sha256=ECVr-3IVIo8yjmYmVXX2mnDDN1SLSwvQIhx4KDDQHBQ,405
|
|
434
434
|
machineconfig/utils/ssh_utils/utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
435
|
-
machineconfig-6.
|
|
436
|
-
machineconfig-6.
|
|
437
|
-
machineconfig-6.
|
|
438
|
-
machineconfig-6.
|
|
439
|
-
machineconfig-6.
|
|
435
|
+
machineconfig-6.54.dist-info/METADATA,sha256=FhrF7ZV12PTSmzsuC6JizwhGhEvBC4r2zrzaX7fvheg,2928
|
|
436
|
+
machineconfig-6.54.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
437
|
+
machineconfig-6.54.dist-info/entry_points.txt,sha256=M0jwN_brZdXWhmNVeXLvdKxfkv8WhhXFZYcuKBA9qnk,418
|
|
438
|
+
machineconfig-6.54.dist-info/top_level.txt,sha256=porRtB8qms8fOIUJgK-tO83_FeH6Bpe12oUVC670teA,14
|
|
439
|
+
machineconfig-6.54.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|