machineconfig 6.54__py3-none-any.whl → 6.56__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.

@@ -5,8 +5,8 @@ from machineconfig.utils.schemas.layouts.layout_types import TabConfig, LayoutCo
5
5
  from pathlib import Path
6
6
 
7
7
  def get_fire_tab_using_uv(func: FunctionType, uv_with: Optional[list[str]], uv_project_dir: Optional[str]) -> tuple[TabConfig, Path]:
8
- from machineconfig.utils.meta import lambda_to_defstring
9
- py_script = lambda_to_defstring(lmb=lambda: func, in_global=True)
8
+ from machineconfig.utils.meta import lambda_to_python_script
9
+ py_script = lambda_to_python_script(lmb=lambda: func, in_global=True)
10
10
  from machineconfig.utils.code import get_uv_command_executing_python_script
11
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)
12
12
  tab_config: TabConfig = {
@@ -6,7 +6,7 @@ croshell
6
6
 
7
7
  from typing import Annotated, Optional
8
8
  from machineconfig.scripts.python.helpers_croshell.crosh import code, get_read_data_pycode
9
- from machineconfig.utils.meta import lambda_to_defstring
9
+ from machineconfig.utils.meta import lambda_to_python_script
10
10
  import typer
11
11
  from machineconfig.utils.path_extended import PathExtended
12
12
  from pathlib import Path
@@ -61,7 +61,7 @@ def croshell(
61
61
  print("Streamlit viewer is not yet implemented in this version.")
62
62
  return None
63
63
  file_obj = PathExtended(str(path).lstrip()).expanduser().absolute()
64
- program = lambda_to_defstring(lambda: get_read_data_pycode(path=str(file_obj)), in_global=True)
64
+ program = lambda_to_python_script(lambda: get_read_data_pycode(path=str(file_obj)), in_global=True)
65
65
  text = f"📄 Reading data from: {file_obj.name}"
66
66
  console.print(Panel(text, title="[bold blue]Info[/bold blue]"))
67
67
  else: # if nothing is specified, then run in interactive mode.
@@ -91,7 +91,7 @@ def croshell(
91
91
  pyfile.parent.mkdir(parents=True, exist_ok=True)
92
92
 
93
93
  title = "Reading Data"
94
- def_code = lambda_to_defstring(lambda: code(path=str(pyfile), title=title))
94
+ def_code = lambda_to_python_script(lambda: code(path=str(pyfile), title=title), in_global=False)
95
95
  # print(def_code)
96
96
  python_program = preprogram + "\n\n" + def_code + program
97
97
  pyfile.write_text(python_program, encoding="utf-8")
@@ -8,7 +8,6 @@ import machineconfig.scripts.python.helpers_devops.cli_config as cli_config
8
8
  import machineconfig.scripts.python.helpers_devops.cli_self as cli_self
9
9
  import machineconfig.scripts.python.helpers_devops.cli_data as cli_data
10
10
  import machineconfig.scripts.python.helpers_devops.cli_nw as cli_network
11
- from machineconfig.scripts.python.helpers_devops.cli_utils import get_app as get_app_utils
12
11
 
13
12
 
14
13
  def install(which: Annotated[Optional[str], typer.Argument(..., help="Comma-separated list of program names to install, or group name if --group flag is set.")] = None,
@@ -41,9 +40,6 @@ def get_app():
41
40
  app_nw = cli_network.get_app()
42
41
  app.add_typer(app_nw, name="network")
43
42
  app.add_typer(app_nw, name="n", hidden=True)
44
- app_utils = get_app_utils()
45
- app.add_typer(app_utils, name="utils")
46
- app.add_typer(app_utils, name="u", hidden=True)
47
43
  return app
48
44
 
49
45
 
@@ -42,10 +42,14 @@ def path():
42
42
  from machineconfig.scripts.python import env_manager as navigator
43
43
  from pathlib import Path
44
44
  path = Path(navigator.__file__).resolve().parent.joinpath("path_manager_tui.py")
45
- from machineconfig.utils.code import run_shell_script
46
- if not Path.home().joinpath("code/machineconfig").exists(): executable = """--with "machineconfig>=6.52,textual" """
47
- else: executable = f"""--project "{str(Path.home().joinpath("code/machineconfig"))}" --with textual"""
48
- run_shell_script(f"""uv run {executable} {path}""")
45
+ from machineconfig.utils.code import run_shell_script, get_uv_command_executing_python_script
46
+ uv_with = ["textual"]
47
+ uv_project_dir = None
48
+ if not Path.home().joinpath("code/machineconfig").exists():
49
+ uv_with.append("machineconfig>=6.52")
50
+ else:
51
+ uv_project_dir = str(Path.home().joinpath("code/machineconfig"))
52
+ run_shell_script(get_uv_command_executing_python_script(python_script=path.read_text(encoding="utf-8"), uv_with=uv_with, uv_project_dir=uv_project_dir)[0])
49
53
 
50
54
 
51
55
  def pwsh_theme():
@@ -84,7 +84,7 @@ def merge_pdfs(
84
84
  output: Annotated[Optional[str], typer.Option("--output", "-o", help="Output merged PDF file path.")] = None,
85
85
  compress: Annotated[bool, typer.Option("--compress", "-c", help="Compress the output PDF.")] = False,
86
86
  ) -> None:
87
- def merge_pdfs_internal(pdf1: str, pdf2: str, output: Optional[str], compress: bool) -> None:
87
+ def merge_pdfs_internal(pdf1: str, pdf2: str, output: str | None, compress: bool) -> None:
88
88
  from pypdf import PdfReader, PdfWriter
89
89
  writer = PdfWriter()
90
90
  for pdf_path in [pdf1, pdf2]:
@@ -110,19 +110,8 @@ def merge_pdfs(
110
110
  pass
111
111
  writer.write(output_path)
112
112
  print(f"✅ Merged PDF saved to: {output_path}")
113
- from machineconfig.utils.meta import lambda_to_defstring
114
- code = lambda_to_defstring(lambda : merge_pdfs_internal(pdf1=pdf1, pdf2=pdf2, output=output, compress=compress), in_global=True)
115
- import tempfile
116
- tmp_py_file = Path(tempfile.mkstemp(suffix=".py")[1])
117
- tmp_py_file.write_text(code, encoding="utf-8")
118
- from machineconfig.utils.code import run_shell_script
119
- run_shell_script(f"""uv run --with pypdf {tmp_py_file} """)
120
-
121
-
122
- def get_app() -> typer.Typer:
123
- app = typer.Typer(help="🛠️ [u] utilities operations", no_args_is_help=True, add_help_option=False, add_completion=False)
124
- app.command(name="download", no_args_is_help=True, help="[d] Download a file from a URL and optionally decompress it.")(download)
125
- app.command(name="d", no_args_is_help=True, hidden=True)(download)
126
- app.command(name="merge-pdfs", no_args_is_help=True, help="[m] Merge two PDF files into one.")(merge_pdfs)
127
- app.command(name="m", no_args_is_help=True, hidden=True)(merge_pdfs)
128
- return app
113
+ from machineconfig.utils.meta import lambda_to_python_script
114
+ code = lambda_to_python_script(lambda : merge_pdfs_internal(pdf1=pdf1, pdf2=pdf2, output=output, compress=compress), in_global=True)
115
+ from machineconfig.utils.code import run_shell_script, get_uv_command_executing_python_script
116
+ uv_command, _py_file = get_uv_command_executing_python_script(python_script=code, uv_with=["pypdf"], uv_project_dir=None)
117
+ run_shell_script(uv_command)
@@ -107,12 +107,12 @@ git pull originEnc master
107
107
 
108
108
  # ================================================================================
109
109
  option1 = "Delete remote copy and push local:"
110
- from machineconfig.utils.meta import lambda_to_defstring
110
+ from machineconfig.utils.meta import lambda_to_python_script
111
111
  def func2(remote_repo: str, local_repo: str, cloud: str):
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
- 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
- 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)
114
+ program_1_py = lambda_to_python_script(lambda: func2(remote_repo=str(repo_remote_root), local_repo=str(repo_local_root), cloud=str(cloud_resolved)), in_global=True)
115
+ program1, _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"""
@@ -136,8 +136,8 @@ sudo chmod +x $HOME/dotfiles/scripts/linux -R
136
136
  inspect_repos(repo_local_root=repo_local_root, repo_remote_root=repo_remote_root)
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
- 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
- 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)
139
+ program_3_py = lambda_to_python_script(lambda: func(repo_local_root=str(repo_local_root), repo_remote_root=str(repo_remote_root)), in_global=True)
140
+ program3, _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
- {uv_command_1}
149
+ {program1}
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} 👉 {uv_command_1}")
157
+ print(f"• {option1:75} 👉 {program1}")
158
158
  print(f"• {option2:75} 👉 {shell_file_2}")
159
- print(f"• {option3:75} 👉 {uv_command_3}")
159
+ print(f"• {option3:75} 👉 {program3}")
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 = uv_command_1
169
+ program_content = program1
170
170
  elif choice == option2:
171
171
  program_content = program_2
172
172
  elif choice == option3:
173
- program_content = uv_command_3
173
+ program_content = program3
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 = uv_command_1
179
+ program_content = program1
180
180
  case "overwrite-local":
181
181
  program_content = program_2
182
182
  case "stop-on-conflict":
183
- program_content = uv_command_3
183
+ program_content = program3
184
184
  case "remove-rclone-conflict":
185
185
  program_content = program_4
186
186
  case _:
@@ -0,0 +1,20 @@
1
+
2
+
3
+ from machineconfig.scripts.python.helpers_devops.cli_utils import download, merge_pdfs
4
+ import typer
5
+
6
+
7
+
8
+ def get_app() -> typer.Typer:
9
+ app = typer.Typer(help="🛠️ utilities operations", no_args_is_help=True, add_help_option=False, add_completion=False)
10
+ app.command(name="download", no_args_is_help=True, help="[d] Download a file from a URL and optionally decompress it.")(download)
11
+ app.command(name="d", no_args_is_help=True, hidden=True)(download)
12
+ app.command(name="merge-pdfs", no_args_is_help=True, help="[m] Merge two PDF files into one.")(merge_pdfs)
13
+ app.command(name="m", no_args_is_help=True, hidden=True)(merge_pdfs)
14
+ return app
15
+
16
+
17
+
18
+ def main():
19
+ app = get_app()
20
+ app()
@@ -41,6 +41,7 @@ alias s=sessions
41
41
  alias ff=ftpx
42
42
  alias f=fire
43
43
  alias r=croshell
44
+ alias u=utils
44
45
 
45
46
  # alias gcs='gh copilot suggest -t shell'
46
47
  # alias gcg='gh copilot suggest -t git'
@@ -31,13 +31,15 @@ Add-ToPathIfNotAlready -Directories @(
31
31
 
32
32
  function lsdla { lsd -la }
33
33
  Set-Alias -Name l -Value lsdla -Option AllScope
34
- function d { mcfg devops @args }
35
- function c { mcfg cloud @args }
36
- function a { mcfg agents @args }
37
- function s { mcfg sessions @args }
38
- function ff { mcfg ftpx @args }
39
- function f { mcfg fire @args }
40
- function cs { mcfg croshell @args }
34
+ function d { devops @args }
35
+ function c { cloud @args }
36
+ function a { agents @args }
37
+ function s { sessions @args }
38
+ function ff { ftpx @args }
39
+ function f { fire @args }
40
+ function r { croshell @args }
41
+ function u { utils @args }
42
+
41
43
  try {
42
44
  Set-Alias -Name gcs -Value {gh copilot suggest -t shell}
43
45
  Set-Alias -Name gcg -Value {gh copilot suggest -t git}
@@ -1,7 +1,7 @@
1
1
 
2
2
  import atexit
3
3
  # import platform
4
- from typing import Optional
4
+ from typing import Any, Optional, Callable
5
5
  import subprocess
6
6
  from machineconfig.utils.accessories import randstr
7
7
  from machineconfig.utils.path_extended import PathExtended
@@ -36,13 +36,20 @@ def get_uv_command_executing_python_script(python_script: str, uv_with: Optional
36
36
  uv_project_dir_arg = "--project" + f' "{uv_project_dir}"'
37
37
  else:
38
38
  uv_project_dir_arg = ""
39
- from machineconfig.utils.meta import lambda_to_defstring
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)
39
+ from machineconfig.utils.meta import lambda_to_python_script
40
+ print_code_string = lambda_to_python_script(lambda: print_code(code=python_script, lexer="python", desc="Temporary Python Script", subtitle="Executing via shell script"), in_global=True)
41
41
  python_file.write_text(print_code_string + "\n" + python_script, encoding="utf-8")
42
42
  shell_script = f"""uv run {uv_with_arg} {uv_project_dir_arg} {str(python_file)} """
43
43
  return shell_script, python_file
44
44
 
45
45
 
46
+ def run_lambda_function(lmb: Callable[[], Any], uv_with: Optional[list[str]], uv_project_dir: Optional[str]) -> None:
47
+ from machineconfig.utils.meta import lambda_to_python_script
48
+ code = lambda_to_python_script(lmb, in_global=True)
49
+ uv_command, _py_file = get_uv_command_executing_python_script(python_script=code, uv_with=uv_with, uv_project_dir=uv_project_dir)
50
+ run_shell_script(uv_command)
51
+
52
+
46
53
  def run_shell_script(script: str, display_script: bool = True, clean_env: bool = False):
47
54
  import tempfile
48
55
  import platform
@@ -4,10 +4,11 @@ from collections.abc import Callable
4
4
  from typing import Any
5
5
 
6
6
 
7
- def lambda_to_defstring(lmb: Callable[[], Any], in_global: bool = False) -> str:
7
+ def lambda_to_python_script(lmb: Callable[[], Any], in_global: bool) -> str:
8
8
  """
9
9
  caveats: always use keyword arguments in the lambda call for best results.
10
10
  return statement not allowed in the wrapped function (otherwise it can be put in the global space)
11
+ type hint in kwargs has nothing that is not built in, e.g. Optional will not work as it requires an import.
11
12
 
12
13
  Given a no-arg lambda like `lambda: func(a=var1, b=var2)`,
13
14
  return a string containing the full function definition of `func`
@@ -205,8 +205,8 @@ class SSH:
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:
208
- from machineconfig.utils.meta import lambda_to_defstring
209
- command = lambda_to_defstring(lmb=lambda: func, in_global=True)
208
+ from machineconfig.utils.meta import lambda_to_python_script
209
+ command = lambda_to_python_script(lmb=lambda: func, in_global=True)
210
210
  return self.run_py(python_code=command, uv_with=uv_with, uv_project_dir=uv_project_dir,
211
211
  description=f"run_py_func {func.__name__} on {self.get_remote_repr(add_machine=False)}",
212
212
  verbose_output=True, strict_stderr=True, strict_return_code=True)
@@ -237,11 +237,11 @@ class SSH:
237
237
  json_result_path.write_text(json.dumps(result_path_posix, indent=2), encoding="utf-8")
238
238
  print(json_result_path.as_posix())
239
239
  return result_path_posix
240
- from machineconfig.utils.meta import lambda_to_defstring
240
+ from machineconfig.utils.meta import lambda_to_python_script
241
241
  from machineconfig.utils.accessories import randstr
242
242
  remote_json_output = Path.home().joinpath(f"{DEFAULT_PICKLE_SUBDIR}/return_{randstr()}.json").as_posix()
243
243
  # command = function_to_script(func=create_target_dir, call_with_kwargs={"target_dir_path": Path(target_path).as_posix(), "overwrite": overwrite_existing, "json_output_path": remote_json_output})
244
- command = lambda_to_defstring(lmb=lambda: create_target_dir(target_dir_path=str(target_path), overwrite=overwrite_existing, json_output_path=remote_json_output), in_global=True)
244
+ command = lambda_to_python_script(lmb=lambda: create_target_dir(target_dir_path=str(target_path), overwrite=overwrite_existing, json_output_path=remote_json_output), in_global=True)
245
245
  response = self.run_py(python_code=command, uv_with=[MACHINECONFIG_VERSION], uv_project_dir=None,
246
246
  description=f"Creating target directory `{Path(target_path).parent.as_posix()}` @ {self.get_remote_repr(add_machine=False)}",
247
247
  verbose_output=False, strict_stderr=False, strict_return_code=False)
@@ -325,8 +325,8 @@ class SSH:
325
325
  with zipfile.ZipFile(archive_path, "r") as archive_handle:
326
326
  archive_handle.extractall(extraction_directory)
327
327
  archive_path.unlink()
328
- from machineconfig.utils.meta import lambda_to_defstring
329
- command = lambda_to_defstring(lmb=lambda: unzip_archive(zip_file_path=remotepath.as_posix(), overwrite_flag=overwrite_existing), in_global=True)
328
+ from machineconfig.utils.meta import lambda_to_python_script
329
+ command = lambda_to_python_script(lmb=lambda: unzip_archive(zip_file_path=remotepath.as_posix(), overwrite_flag=overwrite_existing), in_global=True)
330
330
  _resp = self.run_py(python_code=command, uv_with=[MACHINECONFIG_VERSION], uv_project_dir=None, description=f"UNZIPPING {remotepath.as_posix()}", verbose_output=False, strict_stderr=True, strict_return_code=True)
331
331
  source_obj.unlink()
332
332
  return source_obj
@@ -343,10 +343,10 @@ class SSH:
343
343
  print(json_result_path.as_posix())
344
344
  return is_directory
345
345
 
346
- from machineconfig.utils.meta import lambda_to_defstring
346
+ from machineconfig.utils.meta import lambda_to_python_script
347
347
  from machineconfig.utils.accessories import randstr
348
348
  remote_json_output = Path.home().joinpath(f"{DEFAULT_PICKLE_SUBDIR}/return_{randstr()}.json").as_posix()
349
- command = lambda_to_defstring(lmb=lambda: check_is_dir(path_to_check=str(source_path), json_output_path=remote_json_output), in_global=True)
349
+ command = lambda_to_python_script(lmb=lambda: check_is_dir(path_to_check=str(source_path), json_output_path=remote_json_output), in_global=True)
350
350
  response = self.run_py(python_code=command, uv_with=[MACHINECONFIG_VERSION], uv_project_dir=None, description=f"Check if source `{source_path}` is a dir", verbose_output=False, strict_stderr=False, strict_return_code=False)
351
351
  remote_json_path = response.op.strip()
352
352
  if not remote_json_path:
@@ -377,10 +377,10 @@ class SSH:
377
377
  print(json_result_path.as_posix())
378
378
  return expanded_path_posix
379
379
 
380
- from machineconfig.utils.meta import lambda_to_defstring
380
+ from machineconfig.utils.meta import lambda_to_python_script
381
381
  from machineconfig.utils.accessories import randstr
382
382
  remote_json_output = Path.home().joinpath(f"{DEFAULT_PICKLE_SUBDIR}/return_{randstr()}.json").as_posix()
383
- command = lambda_to_defstring(lmb=lambda: expand_source(path_to_expand=str(source_path), json_output_path=remote_json_output), in_global=True)
383
+ command = lambda_to_python_script(lmb=lambda: expand_source(path_to_expand=str(source_path), json_output_path=remote_json_output), in_global=True)
384
384
  response = self.run_py(python_code=command, uv_with=[MACHINECONFIG_VERSION], uv_project_dir=None, description="Resolving source path by expanding user", verbose_output=False, strict_stderr=False, strict_return_code=False)
385
385
  remote_json_path = response.op.strip()
386
386
  if not remote_json_path:
@@ -426,10 +426,10 @@ class SSH:
426
426
  print(json_result_path.as_posix())
427
427
  return file_paths_list
428
428
 
429
- from machineconfig.utils.meta import lambda_to_defstring
429
+ from machineconfig.utils.meta import lambda_to_python_script
430
430
  from machineconfig.utils.accessories import randstr
431
431
  remote_json_output = Path.home().joinpath(f"{DEFAULT_PICKLE_SUBDIR}/return_{randstr()}.json").as_posix()
432
- command = lambda_to_defstring(lmb=lambda: search_files(directory_path=expanded_source, json_output_path=remote_json_output), in_global=True)
432
+ command = lambda_to_python_script(lmb=lambda: search_files(directory_path=expanded_source, json_output_path=remote_json_output), in_global=True)
433
433
  response = self.run_py(python_code=command, uv_with=[MACHINECONFIG_VERSION], uv_project_dir=None, description="Searching for files in source", verbose_output=False, strict_stderr=False, strict_return_code=False)
434
434
  remote_json_path = response.op.strip()
435
435
  if not remote_json_path:
@@ -464,10 +464,10 @@ class SSH:
464
464
  except ValueError:
465
465
  raise RuntimeError(f"Source path must be relative to home directory: {source_absolute_path}")
466
466
 
467
- from machineconfig.utils.meta import lambda_to_defstring
467
+ from machineconfig.utils.meta import lambda_to_python_script
468
468
  from machineconfig.utils.accessories import randstr
469
469
  remote_json_output = Path.home().joinpath(f"{DEFAULT_PICKLE_SUBDIR}/return_{randstr()}.json").as_posix()
470
- command = lambda_to_defstring(lmb=lambda: collapse_to_home_dir(absolute_path=expanded_source, json_output_path=remote_json_output), in_global=True)
470
+ command = lambda_to_python_script(lmb=lambda: collapse_to_home_dir(absolute_path=expanded_source, json_output_path=remote_json_output), in_global=True)
471
471
  response = self.run_py(python_code=command, uv_with=[MACHINECONFIG_VERSION], uv_project_dir=None, description="Finding default target via relative source path", verbose_output=False, strict_stderr=False, strict_return_code=False)
472
472
  remote_json_path_dir = response.op.strip()
473
473
  if not remote_json_path_dir:
@@ -516,10 +516,10 @@ class SSH:
516
516
  print(json_result_path.as_posix())
517
517
  return zip_file_path
518
518
 
519
- from machineconfig.utils.meta import lambda_to_defstring
519
+ from machineconfig.utils.meta import lambda_to_python_script
520
520
  from machineconfig.utils.accessories import randstr
521
521
  remote_json_output = Path.home().joinpath(f"{DEFAULT_PICKLE_SUBDIR}/return_{randstr()}.json").as_posix()
522
- command = lambda_to_defstring(lmb=lambda: zip_source(path_to_zip=expanded_source, json_output_path=remote_json_output), in_global=True)
522
+ command = lambda_to_python_script(lmb=lambda: zip_source(path_to_zip=expanded_source, json_output_path=remote_json_output), in_global=True)
523
523
  response = self.run_py(python_code=command, uv_with=[MACHINECONFIG_VERSION], uv_project_dir=None, description=f"Zipping source file {source}", verbose_output=False, strict_stderr=False, strict_return_code=False)
524
524
  remote_json_path = response.op.strip()
525
525
  if not remote_json_path:
@@ -555,10 +555,10 @@ class SSH:
555
555
  except ValueError:
556
556
  raise RuntimeError(f"Source path must be relative to home directory: {source_absolute_path}")
557
557
 
558
- from machineconfig.utils.meta import lambda_to_defstring
558
+ from machineconfig.utils.meta import lambda_to_python_script
559
559
  from machineconfig.utils.accessories import randstr
560
560
  remote_json_output = Path.home().joinpath(f"{DEFAULT_PICKLE_SUBDIR}/return_{randstr()}.json").as_posix()
561
- command = lambda_to_defstring(lmb=lambda: collapse_to_home(absolute_path=expanded_source, json_output_path=remote_json_output), in_global=True)
561
+ command = lambda_to_python_script(lmb=lambda: collapse_to_home(absolute_path=expanded_source, json_output_path=remote_json_output), in_global=True)
562
562
  response = self.run_py(python_code=command, uv_with=[MACHINECONFIG_VERSION], uv_project_dir=None, description="Finding default target via relative source path", verbose_output=False, strict_stderr=False, strict_return_code=False)
563
563
  remote_json_path = response.op.strip()
564
564
  if not remote_json_path:
@@ -613,8 +613,8 @@ class SSH:
613
613
  else:
614
614
  file_or_dir_path.unlink()
615
615
 
616
- from machineconfig.utils.meta import lambda_to_defstring
617
- command = lambda_to_defstring(lmb=lambda: delete_temp_zip(path_to_delete=expanded_source), in_global=True)
616
+ from machineconfig.utils.meta import lambda_to_python_script
617
+ command = lambda_to_python_script(lmb=lambda: delete_temp_zip(path_to_delete=expanded_source), in_global=True)
618
618
  self.run_py(python_code=command, uv_with=[MACHINECONFIG_VERSION], uv_project_dir=None, description="Cleaning temp zip files @ remote.", verbose_output=False, strict_stderr=True, strict_return_code=True)
619
619
 
620
620
  print("\n")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: machineconfig
3
- Version: 6.54
3
+ Version: 6.56
4
4
  Summary: Dotfiles management package
5
5
  Author-email: Alex Al-Saffar <programmer@usa.com>
6
6
  License: Apache 2.0
@@ -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=GPt1A17LcU7hsrG_OHoy8jmD3HTrzJR5rPFAa70xn60,2102
28
+ machineconfig/cluster/sessions_managers/utils/maker.py,sha256=rEw11vY_EkTOl-l8a7ApieWFeksTT7dhwjWGOXxJRpY,2110
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
@@ -122,14 +122,15 @@ machineconfig/scripts/linux/other/switch_ip,sha256=NQfeKMBSbFY3eP6M-BadD-TQo5qMP
122
122
  machineconfig/scripts/python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
123
123
  machineconfig/scripts/python/agents.py,sha256=gGeeWCI0AN_DyDJ3G5KR9qSsXv8zkUd5dBRRWqz-dQE,10722
124
124
  machineconfig/scripts/python/cloud.py,sha256=yAD6ciKiEtv2CH3g2NScDK5cpCZQi7Vu8yyeehw_cU8,1263
125
- machineconfig/scripts/python/croshell.py,sha256=BCwiH_Wi_2_Y8fr-D2Cn9TpSTnzMPufXF7SF7Ri2fn8,8046
126
- machineconfig/scripts/python/devops.py,sha256=LGra1YiLEQYjaRevNjJB51Bia81IgjrvUQkA6z8wq8I,2440
125
+ machineconfig/scripts/python/croshell.py,sha256=UvQs3so3FvsC0gK3_3bxACsb4UJcNLdmQ0V0eoQ_cYg,8075
126
+ machineconfig/scripts/python/devops.py,sha256=Lv4d-UlyOREj4VTcu_pxswYo54Mawe3XGeKjreGQDYg,2222
127
127
  machineconfig/scripts/python/devops_navigator.py,sha256=5Cm384D4S8_GsvMzTwr0C16D0ktf8_5Mk5bEJncwDO8,237
128
128
  machineconfig/scripts/python/entry.py,sha256=a0Zk_3RnIFTQ55zSQrvOOiKom_SaoxElPMmWQgGy4V0,2221
129
129
  machineconfig/scripts/python/fire_jobs.py,sha256=My7sFn1R2vh21uIHGfNppgX99WTEitCFgJ1MSasBUOQ,13597
130
130
  machineconfig/scripts/python/ftpx.py,sha256=vm4QNJA0z1Vu-85wFliGNoDHMZZ-Yy8zQACL6x7Wo6U,9760
131
131
  machineconfig/scripts/python/interactive.py,sha256=zt3g6nGKR_Y5A57UnR4Y5-JpLzrpnCOSaqU1bnaikK0,11666
132
132
  machineconfig/scripts/python/sessions.py,sha256=UERxO472EDtN7nKHEULbn6G3S5PJIpsDG9Gq3TlByqI,9823
133
+ machineconfig/scripts/python/utils.py,sha256=rlrTomPlvhzaMf2UWzVeyO_kTwNWFj1iASXIF2g9cx8,710
133
134
  machineconfig/scripts/python/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
134
135
  machineconfig/scripts/python/ai/generate_files.py,sha256=VfjKdwgF8O6E4oiRtfWNliibLmmwGe7f9ld6wpOsXTw,14498
135
136
  machineconfig/scripts/python/ai/initai.py,sha256=9SZtWOcRuwk8ZU3wHOfPzjInERD79ZTYFY8tVACgza4,2260
@@ -178,7 +179,7 @@ machineconfig/scripts/python/helpers_croshell/start_slidev.py,sha256=HfJReOusTPh
178
179
  machineconfig/scripts/python/helpers_croshell/viewer.py,sha256=heQNjB9fwn3xxbPgMofhv1Lp6Vtkl76YjjexWWBM0pM,2041
179
180
  machineconfig/scripts/python/helpers_croshell/viewer_template.py,sha256=ve3Q1-iKhCLc0VJijKvAeOYp2xaFOeIOC_XW956GWCc,3944
180
181
  machineconfig/scripts/python/helpers_devops/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
181
- machineconfig/scripts/python/helpers_devops/cli_config.py,sha256=kbIULtkfHecOzfUA3gbRyRKxdIOXjitnoO3BH1HleEg,5654
182
+ machineconfig/scripts/python/helpers_devops/cli_config.py,sha256=BXN4z_O49Ju0IjYVldBYAKL4jE4nW5MdqRwV-oC03e0,5815
182
183
  machineconfig/scripts/python/helpers_devops/cli_config_dotfile.py,sha256=rjTys4FNf9_feP9flWM7Zvq17dxWmetSiGaHPxp25nk,2737
183
184
  machineconfig/scripts/python/helpers_devops/cli_data.py,sha256=79Xvx7YnbueruEnl69hrDg2AhVxf_zCUdlVcKfeMGyQ,1774
184
185
  machineconfig/scripts/python/helpers_devops/cli_nw.py,sha256=B5Xa9pV5MdC4vPo3EmKaHvNMlThsY3c5F92YPE5j3rI,4176
@@ -186,7 +187,7 @@ machineconfig/scripts/python/helpers_devops/cli_repos.py,sha256=Xwkv1adqHZvTfRSP
186
187
  machineconfig/scripts/python/helpers_devops/cli_self.py,sha256=-IyJpuw8Wnttls8y2vcNNkxtI9jUveROMPT-eudOoC4,6171
187
188
  machineconfig/scripts/python/helpers_devops/cli_share_server.py,sha256=q9pFJ6AxPuygMr3onMNOKEuuQHbVE_6Qoyo7xRT5FX0,4196
188
189
  machineconfig/scripts/python/helpers_devops/cli_terminal.py,sha256=k_PzXaiGyE0vXr0Ii1XcJz2A7UvyPJrR31TRWt4RKRI,6019
189
- machineconfig/scripts/python/helpers_devops/cli_utils.py,sha256=FcvC_795dKxZQM7hL4uRzmhysKi9YV-v9qu2Gb_Fun8,5622
190
+ machineconfig/scripts/python/helpers_devops/cli_utils.py,sha256=sCYKR6bXzr6DgVnQrCa_pjKdc7tOOY3T8h1A41UURBU,5066
190
191
  machineconfig/scripts/python/helpers_devops/devops_backup_retrieve.py,sha256=Dn8luB6QJzxKiiFSC-NMqiYddWZoca3A8eOjMYZDzTc,5598
191
192
  machineconfig/scripts/python/helpers_devops/devops_status.py,sha256=PJVPhfhXq8der6Xd-_fjZfnizfM-RGfJApkRGhGBmNo,20525
192
193
  machineconfig/scripts/python/helpers_devops/devops_update_repos.py,sha256=kSln8_-Wn7Qu0NaKdt-QTN_bBVyTIAWHH8xVYKK-vCM,10133
@@ -222,7 +223,7 @@ machineconfig/scripts/python/helpers_navigator/main_app.py,sha256=R1vOBMUKaiFHOg
222
223
  machineconfig/scripts/python/helpers_navigator/search_bar.py,sha256=kDi8Jhxap8wdm7YpDBtfhwcPnSqDPFrV2LqbcSBWMT4,414
223
224
  machineconfig/scripts/python/helpers_repos/action.py,sha256=9AxWy8mB9HFeV5t11-qD_l-KA5jkUmm0pXVKT1L6-Qk,14894
224
225
  machineconfig/scripts/python/helpers_repos/clone.py,sha256=UULEG5xJuXlPGU0nqXH6U45jA9DOFqLw8B4iPytCwOQ,5471
225
- machineconfig/scripts/python/helpers_repos/cloud_repo_sync.py,sha256=Ewl-flfosUO3jL23ixKcysKjR149ySlNe22W_2osmPA,10432
226
+ machineconfig/scripts/python/helpers_repos/cloud_repo_sync.py,sha256=QF01q1d7EhlV4BE5UEbZ6GqikTDgvYg7mImcR7HyFDQ,10408
226
227
  machineconfig/scripts/python/helpers_repos/count_lines.py,sha256=Q5c7b-DxvTlQmljoic7niTuiAVyFlwYvkVQ7uRJHiTo,16009
227
228
  machineconfig/scripts/python/helpers_repos/count_lines_frontend.py,sha256=epbXDwuXe_9jXaX3KA2JlG1sPXybdGq1NX4dRljHpF8,607
228
229
  machineconfig/scripts/python/helpers_repos/entrypoint.py,sha256=WYEFGUJp9HWImlFjbs_hiFZrUqM_KEYm5VvSUjWd04I,2810
@@ -326,7 +327,7 @@ machineconfig/settings/rofi/config.rasi,sha256=nDX5B8wdXQYF1fwiOTBRJUI4l_gQbYaLa
326
327
  machineconfig/settings/rofi/config_default.rasi,sha256=rTfKnC-bZuWX1l-lWQACCUOE1ShhkfykAxtXX9PlQHE,4694
327
328
  machineconfig/settings/shells/alacritty/alacritty.toml,sha256=EbL-2Y4QunW1pvRWB2yuLCw8MMPONheJr5LFoWRieUQ,871
328
329
  machineconfig/settings/shells/alacritty/alacritty.yml,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
329
- machineconfig/settings/shells/bash/init.sh,sha256=CNGdll7P4uaF1ascaMYOwLad2EdUNaHJTMFuMSilsmQ,2265
330
+ machineconfig/settings/shells/bash/init.sh,sha256=c7hB6l72q6ousq5YMoTHfyURtCHRsis7o95vi0_dK4Q,2279
330
331
  machineconfig/settings/shells/hyper/.hyper.js,sha256=h-HqeYlvPvPD4Ee7828Cxo87uVkzbMGJFqXTZIWoegw,8884
331
332
  machineconfig/settings/shells/ipy/profiles/default/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
332
333
  machineconfig/settings/shells/ipy/profiles/default/startup/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -334,7 +335,7 @@ machineconfig/settings/shells/ipy/profiles/default/startup/playext.py,sha256=OJ3
334
335
  machineconfig/settings/shells/kitty/kitty.conf,sha256=lDdx-dUX3jbKGb3BkS2f2TOpmgGiS-CI-_-lFvhD5A4,52870
335
336
  machineconfig/settings/shells/nushell/config.nu,sha256=ug0E0NXNlCzgStScFN6VTsAkUaOTPJZB69P-LS5L2VE,1047
336
337
  machineconfig/settings/shells/nushell/env.nu,sha256=4VmaXb-qP6qnMD5TPzkXMLFNlB5QC4l9HEzCvXZE2GQ,315
337
- machineconfig/settings/shells/pwsh/init.ps1,sha256=NKTMy-8jhlnSi5kZQ9EkGAQqGmjQ1c8vQyb2YBah0NE,1833
338
+ machineconfig/settings/shells/pwsh/init.ps1,sha256=l1m0yhBqgD695P6sycooNIsHYl9uVir7iCQo7sYa7Sw,1825
338
339
  machineconfig/settings/shells/pwsh/profile.ps1,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
339
340
  machineconfig/settings/shells/starship/starship.toml,sha256=5rQTY7ZpKnrnhgu2Y9OJKUYMz5lPLIftO1p1VRuVZwQ,1150
340
341
  machineconfig/settings/shells/vtm/settings.xml,sha256=5TNXd-i0eUGo2w3tuhY9aOkwoJdqih8_HO_U6uL2Dts,18262
@@ -390,11 +391,11 @@ machineconfig/setup_windows/wt_and_pwsh/__init__.py,sha256=47DEQpj8HBSa-_TImW-5J
390
391
  machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py,sha256=ogxJnwpdcpH7N6dFJu95UCNoGYirZKQho_3X0F_hmXs,6791
391
392
  machineconfig/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
392
393
  machineconfig/utils/accessories.py,sha256=W_9dLzjwNTW5JQk_pe3B2ijQ1nA2-8Kdg2r7VBtzgQs,4340
393
- machineconfig/utils/code.py,sha256=jf9RbO0daBkUUuj6jyoTY-0judpBZ4Wfp7i8PZoxzuY,5344
394
+ machineconfig/utils/code.py,sha256=BOswTOV3iGCPJkUZtSPSs92XxfyZQpm4ihiu-ut1q14,5775
394
395
  machineconfig/utils/installer.py,sha256=UzI_DtTcKbgvkAkWkNLAPUtx-RVqITHCpvZyLiCpD9g,10377
395
396
  machineconfig/utils/io.py,sha256=4dSieoqZO8Vvi4vW8lLoITDHBvmFp4dtl3kyeZHQ6Co,2528
396
397
  machineconfig/utils/links.py,sha256=KM6vIn3hag9FYEzLSHP5MAM9tU_RStw2mCq2_OvmmZA,23672
397
- machineconfig/utils/meta.py,sha256=-ki5JxPZoPhg5omM2YChUNExNx5mOoX-a2w0rx51NBE,7453
398
+ machineconfig/utils/meta.py,sha256=JBr32VDXzl5eQs89QgCt9cKfFpqmGVvHXRAdj_uqSQU,7561
398
399
  machineconfig/utils/notifications.py,sha256=tuXIudcip0tEioG-bm8BbLr3FMDve4f6BktlznBhKxM,9013
399
400
  machineconfig/utils/options.py,sha256=vUO4Kej-vDOv64wHr2HNDyu6PATURpjd7xp6N8OOoJg,7083
400
401
  machineconfig/utils/path_extended.py,sha256=WyJwoHnXdvSQQJ-yrxTX78FpqYmgVeKDYpNEB9UsRck,53223
@@ -403,7 +404,7 @@ machineconfig/utils/procs.py,sha256=YPA_vEYQGwPd_o_Lc6nOTBo5BrB1tSs8PJ42XiGpenM,
403
404
  machineconfig/utils/scheduler.py,sha256=44CASABJg3epccxhAwv2CX7TVgZh6zVy3K4vqHKTuf4,14228
404
405
  machineconfig/utils/scheduling.py,sha256=6x5zLA7sY5gohrEtN6zGrXIqNFasMoyBfwLcOjrjiME,11109
405
406
  machineconfig/utils/source_of_truth.py,sha256=ZAnCRltiM07ig--P6g9_6nEAvNFC4X4ERFTVcvpIYsE,764
406
- machineconfig/utils/ssh.py,sha256=eRNatbyhxnMFSzzEEnbuORiVnQVUiAYVhVohIYuEu-Q,39310
407
+ machineconfig/utils/ssh.py,sha256=yihEBMmVI85VRgh-zmc8VcbFl-JPd4CVWGYamsACCeM,39390
407
408
  machineconfig/utils/terminal.py,sha256=IlmOByfQG-vjhaFFxxzU5rWzP5_qUzmalRfuey3PAmc,11801
408
409
  machineconfig/utils/tst.py,sha256=6u1GI49NdcpxH2BYGAusNfY5q9G_ytCGVzFM5b6HYpM,674
409
410
  machineconfig/utils/upgrade_packages.py,sha256=mSFyKvB3JhHte_x1dtmEgrJZCAXgTUQoaJUSx1OXQ3Y,4145
@@ -432,8 +433,8 @@ machineconfig/utils/schemas/installer/installer_types.py,sha256=QClRY61QaduBPJoS
432
433
  machineconfig/utils/schemas/layouts/layout_types.py,sha256=TcqlZdGVoH8htG5fHn1KWXhRdPueAcoyApppZsPAPto,2020
433
434
  machineconfig/utils/schemas/repos/repos_types.py,sha256=ECVr-3IVIo8yjmYmVXX2mnDDN1SLSwvQIhx4KDDQHBQ,405
434
435
  machineconfig/utils/ssh_utils/utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
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,,
436
+ machineconfig-6.56.dist-info/METADATA,sha256=iQfs2KXFpT6O0376JfCDrsj4EBq0jFrjxQ1Z-lOO2a8,2928
437
+ machineconfig-6.56.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
438
+ machineconfig-6.56.dist-info/entry_points.txt,sha256=NTW7hbUlpt5Vx9DdQrONLkYMCuBXpvYh1dt0AtlGxeI,466
439
+ machineconfig-6.56.dist-info/top_level.txt,sha256=porRtB8qms8fOIUJgK-tO83_FeH6Bpe12oUVC670teA,14
440
+ machineconfig-6.56.dist-info/RECORD,,
@@ -7,3 +7,4 @@ fire = machineconfig.scripts.python.fire_jobs:main
7
7
  ftpx = machineconfig.scripts.python.ftpx:main
8
8
  mcfg = machineconfig.scripts.python.entry:main
9
9
  sessions = machineconfig.scripts.python.sessions:main
10
+ utils = machineconfig.scripts.python.utils:main