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

@@ -214,26 +214,37 @@ class SSH: # inferior alternative: https://github.com/fabric/fabric
214
214
  res.print()
215
215
  self.terminal_responses.append(res)
216
216
  return res
217
-
218
217
  def run_py(self, cmd: str, desc: str = "", return_obj: bool = False, verbose: bool = True, strict_err: bool = False, strict_returncode: bool = False) -> Union[Any, Response]:
219
- assert '"' not in cmd, 'Avoid using `"` in your command. I dont know how to handle this when passing is as command to python in pwsh command.'
218
+ from machineconfig.utils.accessories import randstr
219
+ from pathlib import Path
220
+ cmd_path = Path.home().joinpath(f"tmp_results/tmp_scripts/ssh/runpy_{randstr()}.py")
221
+ cmd_path.parent.mkdir(parents=True, exist_ok=True)
220
222
  if not return_obj:
223
+ cmd_path.write_text(cmd, encoding="utf-8")
224
+ self.copy_from_here(source=cmd_path, target=None)
221
225
  return self.run(
222
- cmd=f"""$HOME/.local/bin/devops self run-python -c "{cmd}\n""" + '"',
226
+ cmd=f"""$HOME/.local/bin/uv run --with machineconfig python {cmd_path.relative_to(Path.home())}""" + '"',
223
227
  desc=desc or f"run_py on {self.get_remote_repr()}",
224
228
  verbose=verbose,
225
229
  strict_err=strict_err,
226
230
  strict_returncode=strict_returncode,
227
231
  )
228
232
  assert "obj=" in cmd, "The command sent to run_py must have `obj=` statement if return_obj is set to True"
229
- source_file = self.run_py(f"""{cmd}
230
- import pickle
231
- import tempfile
232
- from pathlib import Path
233
- path = tempfile.emkstemp(suffix=".pkl")[1]
234
- Path(path).write_bytes(pickle.dumps(obj))
235
- print(path)""", desc=desc, verbose=verbose, strict_err=True, strict_returncode=True).op.split("\n")[-1]
236
- res = self.copy_to_here(source=source_file, target=PathExtended.tmpfile(suffix=".pkl"))
233
+ return_path = cmd_path.parent.joinpath(f"return_obj_{randstr()}.pkl")
234
+ def func(pkl_path_rel2_home: str) -> None:
235
+ pickle_path_obj = Path.home().joinpath(pkl_path_rel2_home).expanduser().absolute()
236
+ import pickle
237
+ obj = globals().get("obj", None)
238
+ pickle_path_obj.write_bytes(pickle.dumps(obj))
239
+ from machineconfig.utils.meta import function_to_script
240
+ cmd_complement = function_to_script(func=func, call_with_kwargs={"pkl_path_rel2_home": return_path.relative_to(Path.home()).as_posix()})
241
+ cmd_total = f"""{cmd}
242
+ {cmd_complement}
243
+ """
244
+ cmd_path.write_text(cmd_total, encoding="utf-8")
245
+ self.copy_from_here(source=cmd_path, target=None)
246
+ _resp = self.run(f"""$HOME/.local/bin/uv run --with machineconfig python {cmd_path}""", desc=desc, verbose=verbose, strict_err=True, strict_returncode=True).op.split("\n")[-1]
247
+ res = self.copy_to_here(source=None, target=return_path)
237
248
  import pickle
238
249
  return pickle.loads(res.read_bytes())
239
250
 
@@ -252,18 +263,16 @@ print(path)""", desc=desc, verbose=verbose, strict_err=True, strict_returncode=T
252
263
  if r is False:
253
264
  raise RuntimeError(f"Meta.SSH Error: source `{source_obj}` is a directory! either set `r=True` for recursive sending or raise `z=True` flag to zip it first.")
254
265
  source_list: list[PathExtended] = source_obj.search("*", folders=False, files=True, r=True)
255
- remote_root = (
256
- self.run_py(
257
- f"""
258
- from machineconfig.utils.path_extended import PathExtended as P
259
- path=P(r'{PathExtended(target).as_posix()}').expanduser()
260
- {'path.delete(sure=True)' if overwrite else ''}
261
- print(path.create())""",
266
+ def func(item: PathExtended, overwrite: bool) -> None:
267
+ from machineconfig.utils.path_extended import PathExtended as P
268
+ path=P(r'{PathExtended(target).as_posix()}').expanduser()
269
+ if overwrite: path.delete(sure=True)
270
+ path.parent.mkdir(parents=True, exist_ok=True)
271
+ from machineconfig.utils.meta import function_to_script
272
+ command = function_to_script(func=func, call_with_kwargs={"item": PathExtended(target).as_posix(), "overwrite": overwrite})
273
+ remote_root = (self.run_py(command,
262
274
  desc=f"Creating Target directory `{PathExtended(target).as_posix()}` @ {self.get_remote_repr()}",
263
- verbose=False,
264
- ).op
265
- or ""
266
- )
275
+ verbose=False,).op or "")
267
276
  for idx, item in enumerate(source_list):
268
277
  print(f" {idx + 1:03d}. {item}")
269
278
  for item in source_list:
@@ -347,28 +356,30 @@ obj=P(r'{source}').search(folders=False, r=True).collapseuser(strict=False)
347
356
  print("\n")
348
357
  return target_obj
349
358
 
350
- def receieve(self, source: PLike, target: OPLike = None, z: bool = False, r: bool = False) -> PathExtended:
351
- scout = self.run_py(cmd=f"obj=scout(r'{source}', z={z}, r={r})", desc=f"Scouting source `{source}` path on remote", return_obj=True, verbose=False)
352
- assert isinstance(scout, Scout)
353
- if not z and scout.is_dir and scout.files is not None:
354
- if r:
355
- tmp: list[PathExtended] = [self.receieve(source=file.as_posix(), target=PathExtended(target).joinpath(PathExtended(file).relative_to(source)) if target else None, r=False) for file in scout.files]
356
- return tmp[0]
357
- else:
358
- print("Source is a directory! either set `r=True` for recursive sending or raise `zip_first=True` flag.")
359
- if target:
360
- target = PathExtended(target).expanduser().absolute()
361
- else:
362
- target = scout.source_rel2home.expanduser().absolute()
363
- target.parent.mkdir(parents=True, exist_ok=True)
364
- if z and ".zip" not in target.suffix:
365
- target += ".zip"
366
- source = scout.source_full
367
- with self.tqdm_wrap(ascii=True, unit="b", unit_scale=True) as pbar:
368
- self.sftp.get(remotepath=source.as_posix(), localpath=target.as_posix(), callback=pbar.view_bar) # type: ignore # pylint: disable=E1129
369
- if z:
370
- target = target.unzip(inplace=True, content=True)
371
- self.run_py(f"""
372
- from machineconfig.utils.path_extended import PathExtended as P; P(r'{source.as_posix()}').delete(sure=True)""", desc="Cleaning temp zip files @ remote.", strict_returncode=True, strict_err=True)
373
- print("\n")
374
- return target
359
+ # def receieve(self, source: PLike, target: OPLike = None, z: bool = False, r: bool = False) -> PathExtended:
360
+ # scout = self.run_py(cmd=f"obj=scout(r'{source}', z={z}, r={r})", desc=f"Scouting source `{source}` path on remote", return_obj=True, verbose=False)
361
+ # assert isinstance(scout, Scout)
362
+ # if not z and scout.is_dir and scout.files is not None:
363
+ # if r:
364
+ # tmp: list[PathExtended] = [self.receieve(source=file.as_posix(), target=PathExtended(target).joinpath(PathExtended(file).relative_to(source)) if target else None, r=False) for file in scout.files]
365
+ # return tmp[0]
366
+ # else:
367
+ # print("Source is a directory! either set `r=True` for recursive sending or raise `zip_first=True` flag.")
368
+ # if target:
369
+ # target = PathExtended(target).expanduser().absolute()
370
+ # else:
371
+ # target = scout.source_rel2home.expanduser().absolute()
372
+ # target.parent.mkdir(parents=True, exist_ok=True)
373
+ # if z and ".zip" not in target.suffix:
374
+ # target += ".zip"
375
+ # source = scout.source_full
376
+ # with self.tqdm_wrap(ascii=True, unit="b", unit_scale=True) as pbar:
377
+ # self.sftp.get(remotepath=source.as_posix(), localpath=target.as_posix(), callback=pbar.view_bar) # type: ignore # pylint: disable=E1129
378
+ # if z:
379
+ # target = target.unzip(inplace=True, content=True)
380
+ # self.run_py(f"""
381
+ # from machineconfig.utils.path_extended import PathExtended as P;
382
+ # P(r'{source.as_posix()}').delete(sure=True)
383
+ # """, desc="Cleaning temp zip files @ remote.", strict_returncode=True, strict_err=True)
384
+ # print("\n")
385
+ # return target
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: machineconfig
3
- Version: 5.58
3
+ Version: 5.60
4
4
  Summary: Dotfiles management package
5
5
  Author-email: Alex Al-Saffar <programmer@usa.com>
6
6
  License: Apache 2.0
@@ -27,6 +27,7 @@ Requires-Dist: pyjson5>=1.6.9
27
27
  Requires-Dist: questionary>=2.1.1
28
28
  Requires-Dist: typer-slim>=0.19.2
29
29
  Requires-Dist: typer>=0.19.2
30
+ Requires-Dist: textual>=6.2.1
30
31
  Provides-Extra: windows
31
32
  Requires-Dist: pywin32; extra == "windows"
32
33
  Provides-Extra: plot
@@ -125,7 +125,6 @@ machineconfig/scripts/python/cloud.py,sha256=kRH9Pt1yEkASFskIVEgRmkidrksdkgv2-bB
125
125
  machineconfig/scripts/python/croshell.py,sha256=GfqDkXdHCGDLCoHIHyJV2sqMrqhCWaOWB2FXKy2T0cw,7184
126
126
  machineconfig/scripts/python/devops.py,sha256=UERDj4hEDW2b6CW6w5BPpgZ6UyDCOvOcfjpW1YKP_QE,1481
127
127
  machineconfig/scripts/python/devops_navigator.py,sha256=_PlZrFrxbNHC1tRTx2n57pteUFdkszH9GtKq2JxEm4E,34940
128
- machineconfig/scripts/python/devops_navigator.py.backup,sha256=_PlZrFrxbNHC1tRTx2n57pteUFdkszH9GtKq2JxEm4E,34940
129
128
  machineconfig/scripts/python/fire_jobs.py,sha256=l2qByVK2rxWDUGFliU3HYwrtAI1XsUvOtcGLX4DUA5U,13689
130
129
  machineconfig/scripts/python/ftpx.py,sha256=IoopsHQavcvLqVEDjaDnmfVJHtYgJaEX-B6r84VIO-Y,9445
131
130
  machineconfig/scripts/python/interactive.py,sha256=IRveYja_9omEEhRyM1M6_SlljPY2Eo_GGoK9tTi1nsk,11778
@@ -171,12 +170,12 @@ machineconfig/scripts/python/croshell_helpers/start_slidev.py,sha256=HfJReOusTPh
171
170
  machineconfig/scripts/python/croshell_helpers/viewer.py,sha256=heQNjB9fwn3xxbPgMofhv1Lp6Vtkl76YjjexWWBM0pM,2041
172
171
  machineconfig/scripts/python/croshell_helpers/viewer_template.py,sha256=ve3Q1-iKhCLc0VJijKvAeOYp2xaFOeIOC_XW956GWCc,3944
173
172
  machineconfig/scripts/python/devops_helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
174
- machineconfig/scripts/python/devops_helpers/cli_config.py,sha256=lIEKz0v3ANvTHOrcQzHD5Th8gXbgOTShgnnUvPZG5GA,3534
173
+ machineconfig/scripts/python/devops_helpers/cli_config.py,sha256=966fT3Of0-5ptEQQ1qIvctY1Nx1HFiLBMPPN2E0ef-E,3956
175
174
  machineconfig/scripts/python/devops_helpers/cli_config_dotfile.py,sha256=rjTys4FNf9_feP9flWM7Zvq17dxWmetSiGaHPxp25nk,2737
176
175
  machineconfig/scripts/python/devops_helpers/cli_data.py,sha256=f_2espL92n6SoNb5sFVMvrK7LA29HzfrFAKhxKaud1M,510
177
176
  machineconfig/scripts/python/devops_helpers/cli_nw.py,sha256=4Ko4dA8YXqiRJvuOuwZv3YOvnSJQ7-A11ezJ8EztDis,2068
178
177
  machineconfig/scripts/python/devops_helpers/cli_repos.py,sha256=GQJaCSnvNbIo_CmpYBDZOUyi0kPgn8VCr3a5Dnfy0_w,9681
179
- machineconfig/scripts/python/devops_helpers/cli_self.py,sha256=esK2eWB7GKa0_TphWhsw9UZ3z4H4qt3HpW0VVkaGebI,2262
178
+ machineconfig/scripts/python/devops_helpers/cli_self.py,sha256=ZBUisvjdowT0dH9uM1cvObFk4AwUp72TGy-3ulRNDvo,2279
180
179
  machineconfig/scripts/python/devops_helpers/cli_share_server.py,sha256=285OzxttCx7YsrpOkaapMKP1eVGHmG5TkkaSQnY7i3c,3976
181
180
  machineconfig/scripts/python/devops_helpers/cli_terminal.py,sha256=k_PzXaiGyE0vXr0Ii1XcJz2A7UvyPJrR31TRWt4RKRI,6019
182
181
  machineconfig/scripts/python/devops_helpers/devops_add_identity.py,sha256=wvjNgqsLmqD2SxbNCW_usqfp0LI-TDvcJJKGOWt2oFw,3775
@@ -187,6 +186,9 @@ machineconfig/scripts/python/devops_helpers/devops_update_repos.py,sha256=tvD81G
187
186
  machineconfig/scripts/python/devops_helpers/themes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
188
187
  machineconfig/scripts/python/devops_helpers/themes/choose_pwsh_theme.ps1,sha256=58gFOeynADHLTdk8zqEnndBtyNGrln0jvpo76O0UWTw,3136
189
188
  machineconfig/scripts/python/devops_helpers/themes/choose_wezterm_theme.py,sha256=pRXAGe2IpysYshsaF8CKEwHI8EGPtLcM8PtiAqM7vmM,3425
189
+ machineconfig/scripts/python/env_manager/__init__.py,sha256=E4LAHbU1wo2dLjE36ntv8U7QNTe8TasujUAYK9SLvWk,6
190
+ machineconfig/scripts/python/env_manager/path_manager_backend.py,sha256=ZVGlGJALhg7zNABDdwXxL7MFbL2BXPebObipXSLGbic,1552
191
+ machineconfig/scripts/python/env_manager/path_manager_tui.py,sha256=YAZb1KOVpkfTzwApk-KYPplwvDELeU62OIDdg82m-eQ,6748
190
192
  machineconfig/scripts/python/helpers_fire/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
191
193
  machineconfig/scripts/python/helpers_fire/fire_agents_help_launch.py,sha256=vgJMzSyLRTik2lnKYZsNzwoAF-z8Tp1aVi4wMvIJzPs,5627
192
194
  machineconfig/scripts/python/helpers_fire/fire_agents_help_search.py,sha256=qIfSS_su2YJ1Gb0_lu4cbjlJlYMBw0v52NTGiSrGjk8,2991
@@ -208,7 +210,7 @@ machineconfig/scripts/python/helpers_fire_command/fire_jobs_args_helper.py,sha25
208
210
  machineconfig/scripts/python/helpers_fire_command/fire_jobs_route_helper.py,sha256=4MrlCVijbx7GQyAN9s5LDh-7heSjMXYrXdqiP6uC3ug,5378
209
211
  machineconfig/scripts/python/helpers_fire_command/fire_jobs_streamlit_helper.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
210
212
  machineconfig/scripts/python/helpers_repos/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
211
- machineconfig/scripts/python/helpers_repos/cloud_repo_sync.py,sha256=_zLmBJQnEcqjdUJK-Oo3CPnwDtj8ygFCvP5lRdxkUTQ,9064
213
+ machineconfig/scripts/python/helpers_repos/cloud_repo_sync.py,sha256=V_gSNiPqyvoAnZcJAHATqXqQ6RSgC002ayxhJuhP6M4,9559
212
214
  machineconfig/scripts/python/helpers_repos/grource.py,sha256=IywQ1NDPcLXM5Tr9xhmq4tHfYspLRs3pF20LP2TlgIQ,14595
213
215
  machineconfig/scripts/python/helpers_repos/secure_repo.py,sha256=G_quiKOLNkWD5UG8ekexgh9xbpW4Od-J1pLJbLLWnpg,993
214
216
  machineconfig/scripts/python/nw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -363,15 +365,16 @@ machineconfig/setup_windows/others/power_options.ps1,sha256=c7Hn94jBD5GWF29CxMhm
363
365
  machineconfig/setup_windows/ssh/add-sshkey.ps1,sha256=qfPdqCpd9KP3VhH4ifsUm1Xvec7c0QVl4Wt8JIAm9HQ,1653
364
366
  machineconfig/setup_windows/ssh/add_identity.ps1,sha256=b8ZXpmNUSw3IMYvqSY7ClpdWPG39FS7MefoWnRhWN2U,506
365
367
  machineconfig/setup_windows/ssh/openssh-server.ps1,sha256=OMlYQdvuJQNxF5EILLPizB6BZAT3jAmDsv1WcVVxpFQ,2529
366
- machineconfig/setup_windows/web_shortcuts/interactive.ps1,sha256=syyqtK1OiqOrhgNgvR8FlLVA05-iypm8v7uxbaV3X2k,863
368
+ machineconfig/setup_windows/web_shortcuts/interactive.ps1,sha256=4mZx9YSRD6pyk17dtxBikg1CDZs83FVZgZ2BLpPhHd0,863
367
369
  machineconfig/setup_windows/wt_and_pwsh/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
368
370
  machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py,sha256=ogxJnwpdcpH7N6dFJu95UCNoGYirZKQho_3X0F_hmXs,6791
369
371
  machineconfig/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
370
372
  machineconfig/utils/accessories.py,sha256=W_9dLzjwNTW5JQk_pe3B2ijQ1nA2-8Kdg2r7VBtzgQs,4340
371
- machineconfig/utils/code.py,sha256=mbP3bk7-4p__yfzXYaNLuoJ2AjBT2RWiZxqHmzyTLhY,6503
373
+ machineconfig/utils/code.py,sha256=yUoRzw7jTL-f3I0liyxguyzpki8d1h1ieJmG6dHzkDQ,6300
372
374
  machineconfig/utils/installer.py,sha256=ZnhW_gRmGlq5uXwzNvIn-x1vXuOJxkzVqjNu188f37s,10465
373
375
  machineconfig/utils/io.py,sha256=rzEwAnq-gyT29Y4CDHHGxAA6ddIIFOCxrqZ6dn0ALa4,2255
374
376
  machineconfig/utils/links.py,sha256=KM6vIn3hag9FYEzLSHP5MAM9tU_RStw2mCq2_OvmmZA,23672
377
+ machineconfig/utils/meta.py,sha256=fDn7cpq6iqAPzX2eKLSK9DZb0870rluR7eLDx5NgNaw,5994
375
378
  machineconfig/utils/notifications.py,sha256=tuXIudcip0tEioG-bm8BbLr3FMDve4f6BktlznBhKxM,9013
376
379
  machineconfig/utils/options.py,sha256=vUO4Kej-vDOv64wHr2HNDyu6PATURpjd7xp6N8OOoJg,7083
377
380
  machineconfig/utils/path_extended.py,sha256=Xjdn2AVnB8p1jfNMNe2kJutVa5zGnFFJVGZbw-Bp_hg,53200
@@ -380,7 +383,7 @@ machineconfig/utils/procs.py,sha256=w75oGKfR7FpT1pGTGd2XscnEOO0IHBWxohLbi69hLqg,
380
383
  machineconfig/utils/scheduler.py,sha256=jZ_1yghqA3-aINPRmE_76gboqJc0UElroR7urNOfXKs,14940
381
384
  machineconfig/utils/scheduling.py,sha256=RF1iXJpqf4Dg18jdZWtBixz97KAHC6VKYqTFSpdLWuc,11188
382
385
  machineconfig/utils/source_of_truth.py,sha256=ZAnCRltiM07ig--P6g9_6nEAvNFC4X4ERFTVcvpIYsE,764
383
- machineconfig/utils/ssh.py,sha256=XOxZGi7j9VCDWgrVpXnM_u3qjpQwZcLigB6SFKBvIJ4,21083
386
+ machineconfig/utils/ssh.py,sha256=fIMF73C4S2G6QvKk6cC3z_noXIHe0q5kZJNgQELuXGM,22233
384
387
  machineconfig/utils/terminal.py,sha256=IlmOByfQG-vjhaFFxxzU5rWzP5_qUzmalRfuey3PAmc,11801
385
388
  machineconfig/utils/upgrade_packages.py,sha256=H96zVJEWXJW07nh5vhjuSCrPtXGqoUb7xeJsFYYdmCI,3330
386
389
  machineconfig/utils/ve.py,sha256=L-6PBXnQGXThiwWgheJMQoisAZOZA6SVCbGw2J-GFnI,2414
@@ -404,8 +407,8 @@ machineconfig/utils/schemas/fire_agents/fire_agents_input.py,sha256=Xbi59rU35AzR
404
407
  machineconfig/utils/schemas/installer/installer_types.py,sha256=QClRY61QaduBPJoSpdmTIdgS9LS-RvE-QZ-D260tD3o,1214
405
408
  machineconfig/utils/schemas/layouts/layout_types.py,sha256=TcqlZdGVoH8htG5fHn1KWXhRdPueAcoyApppZsPAPto,2020
406
409
  machineconfig/utils/schemas/repos/repos_types.py,sha256=ECVr-3IVIo8yjmYmVXX2mnDDN1SLSwvQIhx4KDDQHBQ,405
407
- machineconfig-5.58.dist-info/METADATA,sha256=X48S6FOAqCkiyheUDfHFb8aZK41ePKejj6zv6dnqXGo,3103
408
- machineconfig-5.58.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
409
- machineconfig-5.58.dist-info/entry_points.txt,sha256=0zMBUFkDgYw5mB3ASxpONEjTFMAXAkTFHHfAr5c1SKg,423
410
- machineconfig-5.58.dist-info/top_level.txt,sha256=porRtB8qms8fOIUJgK-tO83_FeH6Bpe12oUVC670teA,14
411
- machineconfig-5.58.dist-info/RECORD,,
410
+ machineconfig-5.60.dist-info/METADATA,sha256=MyPbosxLDOkM4rrESgjCui2LO8NlvwrAIlaBKmiBIrc,3133
411
+ machineconfig-5.60.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
412
+ machineconfig-5.60.dist-info/entry_points.txt,sha256=0zMBUFkDgYw5mB3ASxpONEjTFMAXAkTFHHfAr5c1SKg,423
413
+ machineconfig-5.60.dist-info/top_level.txt,sha256=porRtB8qms8fOIUJgK-tO83_FeH6Bpe12oUVC670teA,14
414
+ machineconfig-5.60.dist-info/RECORD,,