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

Files changed (268) hide show
  1. machineconfig/cluster/cloud_manager.py +22 -29
  2. machineconfig/cluster/data_transfer.py +2 -3
  3. machineconfig/cluster/distribute.py +0 -2
  4. machineconfig/cluster/file_manager.py +4 -5
  5. machineconfig/cluster/job_params.py +1 -4
  6. machineconfig/cluster/loader_runner.py +8 -11
  7. machineconfig/cluster/remote_machine.py +4 -5
  8. machineconfig/cluster/script_execution.py +2 -2
  9. machineconfig/cluster/script_notify_upon_completion.py +0 -1
  10. machineconfig/cluster/sessions_managers/archive/create_zellij_template.py +4 -6
  11. machineconfig/cluster/sessions_managers/archive/session_managers.py +0 -1
  12. machineconfig/cluster/sessions_managers/enhanced_command_runner.py +35 -75
  13. machineconfig/cluster/sessions_managers/wt_local.py +113 -185
  14. machineconfig/cluster/sessions_managers/wt_local_manager.py +127 -197
  15. machineconfig/cluster/sessions_managers/wt_remote.py +60 -67
  16. machineconfig/cluster/sessions_managers/wt_remote_manager.py +110 -149
  17. machineconfig/cluster/sessions_managers/wt_utils/layout_generator.py +61 -64
  18. machineconfig/cluster/sessions_managers/wt_utils/process_monitor.py +72 -172
  19. machineconfig/cluster/sessions_managers/wt_utils/remote_executor.py +27 -60
  20. machineconfig/cluster/sessions_managers/wt_utils/session_manager.py +58 -137
  21. machineconfig/cluster/sessions_managers/wt_utils/status_reporter.py +46 -74
  22. machineconfig/cluster/sessions_managers/zellij_local.py +91 -147
  23. machineconfig/cluster/sessions_managers/zellij_local_manager.py +165 -190
  24. machineconfig/cluster/sessions_managers/zellij_remote.py +51 -58
  25. machineconfig/cluster/sessions_managers/zellij_remote_manager.py +40 -46
  26. machineconfig/cluster/sessions_managers/zellij_utils/example_usage.py +19 -17
  27. machineconfig/cluster/sessions_managers/zellij_utils/layout_generator.py +30 -31
  28. machineconfig/cluster/sessions_managers/zellij_utils/process_monitor.py +64 -134
  29. machineconfig/cluster/sessions_managers/zellij_utils/remote_executor.py +7 -11
  30. machineconfig/cluster/sessions_managers/zellij_utils/session_manager.py +27 -55
  31. machineconfig/cluster/sessions_managers/zellij_utils/status_reporter.py +14 -13
  32. machineconfig/cluster/templates/cli_click.py +0 -1
  33. machineconfig/cluster/templates/cli_gooey.py +0 -2
  34. machineconfig/cluster/templates/cli_trogon.py +0 -1
  35. machineconfig/cluster/templates/run_cloud.py +0 -1
  36. machineconfig/cluster/templates/run_cluster.py +0 -1
  37. machineconfig/cluster/templates/run_remote.py +0 -1
  38. machineconfig/cluster/templates/utils.py +27 -11
  39. machineconfig/jobs/__pycache__/__init__.cpython-313.pyc +0 -0
  40. machineconfig/jobs/linux/msc/cli_agents.sh +16 -0
  41. machineconfig/jobs/python/check_installations.py +9 -9
  42. machineconfig/jobs/python/create_bootable_media.py +0 -2
  43. machineconfig/jobs/python/python_cargo_build_share.py +2 -2
  44. machineconfig/jobs/python/python_ve_symlink.py +9 -11
  45. machineconfig/jobs/python/tasks.py +0 -1
  46. machineconfig/jobs/python/vscode/api.py +5 -5
  47. machineconfig/jobs/python/vscode/link_ve.py +20 -21
  48. machineconfig/jobs/python/vscode/select_interpreter.py +28 -29
  49. machineconfig/jobs/python/vscode/sync_code.py +14 -18
  50. machineconfig/jobs/python_custom_installers/__pycache__/__init__.cpython-313.pyc +0 -0
  51. machineconfig/jobs/python_custom_installers/archive/ngrok.py +15 -15
  52. machineconfig/jobs/python_custom_installers/dev/aider.py +10 -18
  53. machineconfig/jobs/python_custom_installers/dev/alacritty.py +12 -21
  54. machineconfig/jobs/python_custom_installers/dev/brave.py +13 -22
  55. machineconfig/jobs/python_custom_installers/dev/bypass_paywall.py +13 -20
  56. machineconfig/jobs/python_custom_installers/dev/code.py +17 -24
  57. machineconfig/jobs/python_custom_installers/dev/cursor.py +10 -21
  58. machineconfig/jobs/python_custom_installers/dev/docker_desktop.py +12 -11
  59. machineconfig/jobs/python_custom_installers/dev/espanso.py +19 -23
  60. machineconfig/jobs/python_custom_installers/dev/goes.py +9 -16
  61. machineconfig/jobs/python_custom_installers/dev/lvim.py +13 -21
  62. machineconfig/jobs/python_custom_installers/dev/nerdfont.py +15 -22
  63. machineconfig/jobs/python_custom_installers/dev/redis.py +15 -23
  64. machineconfig/jobs/python_custom_installers/dev/wezterm.py +15 -22
  65. machineconfig/jobs/python_custom_installers/dev/winget.py +32 -50
  66. machineconfig/jobs/python_custom_installers/docker.py +15 -24
  67. machineconfig/jobs/python_custom_installers/gh.py +18 -26
  68. machineconfig/jobs/python_custom_installers/hx.py +33 -17
  69. machineconfig/jobs/python_custom_installers/warp-cli.py +15 -23
  70. machineconfig/jobs/python_generic_installers/__pycache__/__init__.cpython-313.pyc +0 -0
  71. machineconfig/jobs/python_generic_installers/config.json +412 -389
  72. machineconfig/jobs/python_linux_installers/__pycache__/__init__.cpython-313.pyc +0 -0
  73. machineconfig/jobs/python_windows_installers/dev/config.json +1 -1
  74. machineconfig/jobs/windows/archive/archive_pygraphviz.ps1 +1 -1
  75. machineconfig/jobs/windows/msc/cli_agents.bat +0 -0
  76. machineconfig/jobs/windows/msc/cli_agents.ps1 +0 -0
  77. machineconfig/jobs/windows/start_terminal.ps1 +1 -1
  78. machineconfig/logger.py +50 -0
  79. machineconfig/profile/create.py +50 -36
  80. machineconfig/profile/create_hardlinks.py +33 -26
  81. machineconfig/profile/shell.py +87 -60
  82. machineconfig/scripts/__pycache__/__init__.cpython-313.pyc +0 -0
  83. machineconfig/scripts/cloud/init.sh +2 -2
  84. machineconfig/scripts/linux/checkout_versions +1 -1
  85. machineconfig/scripts/linux/choose_wezterm_theme +1 -1
  86. machineconfig/scripts/linux/cloud_copy +1 -1
  87. machineconfig/scripts/linux/cloud_manager +1 -1
  88. machineconfig/scripts/linux/cloud_mount +1 -1
  89. machineconfig/scripts/linux/cloud_repo_sync +1 -1
  90. machineconfig/scripts/linux/cloud_sync +1 -1
  91. machineconfig/scripts/linux/croshell +1 -1
  92. machineconfig/scripts/linux/devops +3 -5
  93. machineconfig/scripts/linux/fire +2 -1
  94. machineconfig/scripts/linux/fire_agents +3 -3
  95. machineconfig/scripts/linux/ftpx +1 -1
  96. machineconfig/scripts/linux/gh_models +1 -1
  97. machineconfig/scripts/linux/kill_process +1 -1
  98. machineconfig/scripts/linux/mcinit +2 -2
  99. machineconfig/scripts/linux/repos +1 -1
  100. machineconfig/scripts/linux/scheduler +1 -1
  101. machineconfig/scripts/linux/start_slidev +1 -1
  102. machineconfig/scripts/linux/start_terminals +1 -1
  103. machineconfig/scripts/linux/url2md +1 -1
  104. machineconfig/scripts/linux/warp-cli.sh +122 -0
  105. machineconfig/scripts/linux/wifi_conn +1 -1
  106. machineconfig/scripts/python/__pycache__/__init__.cpython-313.pyc +0 -0
  107. machineconfig/scripts/python/__pycache__/croshell.cpython-313.pyc +0 -0
  108. machineconfig/scripts/python/__pycache__/devops.cpython-313.pyc +0 -0
  109. machineconfig/scripts/python/__pycache__/devops_devapps_install.cpython-313.pyc +0 -0
  110. machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-313.pyc +0 -0
  111. machineconfig/scripts/python/__pycache__/fire_jobs.cpython-313.pyc +0 -0
  112. machineconfig/scripts/python/ai/__init__.py +0 -0
  113. machineconfig/scripts/python/ai/__pycache__/__init__.cpython-313.pyc +0 -0
  114. machineconfig/scripts/python/ai/__pycache__/generate_files.cpython-313.pyc +0 -0
  115. machineconfig/scripts/python/ai/__pycache__/mcinit.cpython-313.pyc +0 -0
  116. machineconfig/scripts/python/ai/chatmodes/Thinking-Beast-Mode.chatmode.md +337 -0
  117. machineconfig/scripts/python/ai/chatmodes/Ultimate-Transparent-Thinking-Beast-Mode.chatmode.md +644 -0
  118. machineconfig/scripts/python/ai/chatmodes/deepResearch.chatmode.md +81 -0
  119. machineconfig/scripts/python/ai/configs/.gemini/settings.json +81 -0
  120. machineconfig/scripts/python/ai/generate_files.py +84 -0
  121. machineconfig/scripts/python/ai/instructions/python/dev.instructions.md +45 -0
  122. machineconfig/scripts/python/ai/mcinit.py +107 -0
  123. machineconfig/scripts/python/ai/prompts/allLintersAndTypeCheckers.prompt.md +5 -0
  124. machineconfig/scripts/python/ai/prompts/research-report-skeleton.prompt.md +38 -0
  125. machineconfig/scripts/python/ai/scripts/lint_and_type_check.sh +52 -0
  126. machineconfig/scripts/python/archive/tmate_conn.py +5 -5
  127. machineconfig/scripts/python/archive/tmate_start.py +3 -3
  128. machineconfig/scripts/python/choose_wezterm_theme.py +2 -2
  129. machineconfig/scripts/python/cloud_copy.py +20 -19
  130. machineconfig/scripts/python/cloud_mount.py +10 -8
  131. machineconfig/scripts/python/cloud_repo_sync.py +15 -15
  132. machineconfig/scripts/python/cloud_sync.py +1 -1
  133. machineconfig/scripts/python/croshell.py +18 -16
  134. machineconfig/scripts/python/devops.py +6 -6
  135. machineconfig/scripts/python/devops_add_identity.py +9 -7
  136. machineconfig/scripts/python/devops_add_ssh_key.py +19 -19
  137. machineconfig/scripts/python/devops_backup_retrieve.py +14 -14
  138. machineconfig/scripts/python/devops_devapps_install.py +3 -3
  139. machineconfig/scripts/python/devops_update_repos.py +141 -53
  140. machineconfig/scripts/python/dotfile.py +3 -3
  141. machineconfig/scripts/python/fire_agents.py +202 -41
  142. machineconfig/scripts/python/fire_jobs.py +20 -21
  143. machineconfig/scripts/python/ftpx.py +4 -3
  144. machineconfig/scripts/python/gh_models.py +94 -94
  145. machineconfig/scripts/python/helpers/__pycache__/__init__.cpython-313.pyc +0 -0
  146. machineconfig/scripts/python/helpers/__pycache__/helpers4.cpython-313.pyc +0 -0
  147. machineconfig/scripts/python/helpers/cloud_helpers.py +3 -3
  148. machineconfig/scripts/python/helpers/helpers2.py +3 -3
  149. machineconfig/scripts/python/helpers/helpers4.py +8 -7
  150. machineconfig/scripts/python/helpers/helpers5.py +7 -7
  151. machineconfig/scripts/python/helpers/repo_sync_helpers.py +2 -2
  152. machineconfig/scripts/python/mount_nfs.py +4 -3
  153. machineconfig/scripts/python/mount_nw_drive.py +4 -4
  154. machineconfig/scripts/python/mount_ssh.py +4 -3
  155. machineconfig/scripts/python/repos.py +9 -9
  156. machineconfig/scripts/python/scheduler.py +1 -1
  157. machineconfig/scripts/python/start_slidev.py +9 -8
  158. machineconfig/scripts/python/start_terminals.py +1 -1
  159. machineconfig/scripts/python/viewer.py +40 -40
  160. machineconfig/scripts/python/wifi_conn.py +65 -66
  161. machineconfig/scripts/python/wsl_windows_transfer.py +2 -2
  162. machineconfig/scripts/windows/checkout_version.ps1 +1 -3
  163. machineconfig/scripts/windows/choose_wezterm_theme.ps1 +1 -3
  164. machineconfig/scripts/windows/cloud_copy.ps1 +2 -6
  165. machineconfig/scripts/windows/cloud_manager.ps1 +1 -1
  166. machineconfig/scripts/windows/cloud_repo_sync.ps1 +1 -2
  167. machineconfig/scripts/windows/cloud_sync.ps1 +2 -2
  168. machineconfig/scripts/windows/croshell.ps1 +2 -2
  169. machineconfig/scripts/windows/devops.ps1 +1 -4
  170. machineconfig/scripts/windows/dotfile.ps1 +1 -3
  171. machineconfig/scripts/windows/fire.ps1 +1 -1
  172. machineconfig/scripts/windows/ftpx.ps1 +2 -2
  173. machineconfig/scripts/windows/gpt.ps1 +1 -1
  174. machineconfig/scripts/windows/kill_process.ps1 +1 -2
  175. machineconfig/scripts/windows/mcinit.ps1 +2 -2
  176. machineconfig/scripts/windows/mount_nfs.ps1 +1 -1
  177. machineconfig/scripts/windows/mount_ssh.ps1 +1 -1
  178. machineconfig/scripts/windows/pomodoro.ps1 +1 -1
  179. machineconfig/scripts/windows/py2exe.ps1 +1 -3
  180. machineconfig/scripts/windows/repos.ps1 +1 -1
  181. machineconfig/scripts/windows/scheduler.ps1 +1 -1
  182. machineconfig/scripts/windows/snapshot.ps1 +2 -2
  183. machineconfig/scripts/windows/start_slidev.ps1 +1 -1
  184. machineconfig/scripts/windows/start_terminals.ps1 +1 -1
  185. machineconfig/scripts/windows/wifi_conn.ps1 +1 -1
  186. machineconfig/scripts/windows/wsl_windows_transfer.ps1 +1 -3
  187. machineconfig/settings/lf/linux/lfrc +1 -1
  188. machineconfig/settings/linters/.ruff.toml +2 -2
  189. machineconfig/settings/linters/.ruff_cache/.gitignore +2 -0
  190. machineconfig/settings/linters/.ruff_cache/CACHEDIR.TAG +1 -0
  191. machineconfig/settings/lvim/windows/archive/config_additional.lua +1 -1
  192. machineconfig/settings/shells/ipy/profiles/default/startup/playext.py +71 -71
  193. machineconfig/settings/shells/wt/settings.json +8 -8
  194. machineconfig/settings/svim/linux/init.toml +1 -1
  195. machineconfig/settings/svim/windows/init.toml +1 -1
  196. machineconfig/setup_linux/web_shortcuts/croshell.sh +0 -54
  197. machineconfig/setup_linux/web_shortcuts/interactive.sh +6 -6
  198. machineconfig/setup_linux/web_shortcuts/tmp.sh +2 -0
  199. machineconfig/setup_windows/web_shortcuts/all.ps1 +2 -2
  200. machineconfig/setup_windows/web_shortcuts/ascii_art.ps1 +1 -1
  201. machineconfig/setup_windows/web_shortcuts/croshell.ps1 +1 -1
  202. machineconfig/setup_windows/web_shortcuts/interactive.ps1 +5 -5
  203. machineconfig/setup_windows/wt_and_pwsh/install_fonts.ps1 +51 -15
  204. machineconfig/setup_windows/wt_and_pwsh/set_pwsh_theme.py +75 -18
  205. machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py +52 -42
  206. machineconfig/utils/ai/browser_user_wrapper.py +5 -5
  207. machineconfig/utils/ai/generate_file_checklist.py +19 -22
  208. machineconfig/utils/ai/url2md.py +5 -3
  209. machineconfig/utils/cloud/onedrive/setup_oauth.py +5 -4
  210. machineconfig/utils/cloud/onedrive/transaction.py +192 -227
  211. machineconfig/utils/code.py +71 -43
  212. machineconfig/utils/installer.py +77 -85
  213. machineconfig/utils/installer_utils/installer_abc.py +29 -17
  214. machineconfig/utils/installer_utils/installer_class.py +188 -83
  215. machineconfig/utils/io_save.py +3 -15
  216. machineconfig/utils/links.py +22 -11
  217. machineconfig/utils/notifications.py +197 -0
  218. machineconfig/utils/options.py +38 -25
  219. machineconfig/utils/path.py +18 -6
  220. machineconfig/utils/path_reduced.py +637 -316
  221. machineconfig/utils/procs.py +69 -63
  222. machineconfig/utils/scheduling.py +11 -13
  223. machineconfig/utils/ssh.py +351 -0
  224. machineconfig/utils/terminal.py +225 -0
  225. machineconfig/utils/utils.py +13 -12
  226. machineconfig/utils/utils2.py +43 -10
  227. machineconfig/utils/utils5.py +242 -46
  228. machineconfig/utils/ve.py +11 -6
  229. {machineconfig-1.97.dist-info → machineconfig-2.1.dist-info}/METADATA +15 -9
  230. {machineconfig-1.97.dist-info → machineconfig-2.1.dist-info}/RECORD +232 -235
  231. machineconfig/cluster/self_ssh.py +0 -57
  232. machineconfig/jobs/__pycache__/__init__.cpython-311.pyc +0 -0
  233. machineconfig/jobs/python/__pycache__/__init__.cpython-311.pyc +0 -0
  234. machineconfig/jobs/python/archive/python_tools.txt +0 -12
  235. machineconfig/jobs/python/vscode/__pycache__/select_interpreter.cpython-311.pyc +0 -0
  236. machineconfig/jobs/python_custom_installers/__pycache__/__init__.cpython-311.pyc +0 -0
  237. machineconfig/jobs/python_generic_installers/__pycache__/__init__.cpython-311.pyc +0 -0
  238. machineconfig/jobs/python_generic_installers/update.py +0 -3
  239. machineconfig/jobs/python_linux_installers/__pycache__/__init__.cpython-311.pyc +0 -0
  240. machineconfig/profile/__pycache__/__init__.cpython-311.pyc +0 -0
  241. machineconfig/profile/__pycache__/create.cpython-311.pyc +0 -0
  242. machineconfig/profile/__pycache__/shell.cpython-311.pyc +0 -0
  243. machineconfig/scripts/__pycache__/__init__.cpython-311.pyc +0 -0
  244. machineconfig/scripts/linux/activate_ve +0 -87
  245. machineconfig/scripts/python/__pycache__/__init__.cpython-311.pyc +0 -0
  246. machineconfig/scripts/python/__pycache__/cloud_copy.cpython-311.pyc +0 -0
  247. machineconfig/scripts/python/__pycache__/cloud_mount.cpython-311.pyc +0 -0
  248. machineconfig/scripts/python/__pycache__/cloud_sync.cpython-311.pyc +0 -0
  249. machineconfig/scripts/python/__pycache__/croshell.cpython-311.pyc +0 -0
  250. machineconfig/scripts/python/__pycache__/devops.cpython-311.pyc +0 -0
  251. machineconfig/scripts/python/__pycache__/devops_backup_retrieve.cpython-311.pyc +0 -0
  252. machineconfig/scripts/python/__pycache__/devops_devapps_install.cpython-311.pyc +0 -0
  253. machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-311.pyc +0 -0
  254. machineconfig/scripts/python/__pycache__/fire_agents.cpython-311.pyc +0 -0
  255. machineconfig/scripts/python/__pycache__/fire_jobs.cpython-311.pyc +0 -0
  256. machineconfig/scripts/python/__pycache__/get_zellij_cmd.cpython-311.pyc +0 -0
  257. machineconfig/scripts/python/__pycache__/repos.cpython-311.pyc +0 -0
  258. machineconfig/scripts/python/ai/__pycache__/init.cpython-311.pyc +0 -0
  259. machineconfig/scripts/python/ai/init.py +0 -56
  260. machineconfig/scripts/python/ai/rules/python/dev.md +0 -31
  261. machineconfig/scripts/python/helpers/__pycache__/__init__.cpython-311.pyc +0 -0
  262. machineconfig/scripts/python/helpers/__pycache__/cloud_helpers.cpython-311.pyc +0 -0
  263. machineconfig/scripts/python/helpers/__pycache__/helpers2.cpython-311.pyc +0 -0
  264. machineconfig/scripts/python/helpers/__pycache__/helpers4.cpython-311.pyc +0 -0
  265. machineconfig/scripts/python/helpers/__pycache__/repo_sync_helpers.cpython-311.pyc +0 -0
  266. machineconfig/scripts/windows/activate_ve.ps1 +0 -54
  267. {machineconfig-1.97.dist-info → machineconfig-2.1.dist-info}/WHEEL +0 -0
  268. {machineconfig-1.97.dist-info → machineconfig-2.1.dist-info}/top_level.txt +0 -0
@@ -14,7 +14,7 @@ from machineconfig.scripts.python.helpers.helpers4 import parse_pyfile
14
14
  from machineconfig.scripts.python.helpers.helpers4 import get_import_module_code
15
15
  from machineconfig.utils.ve import get_repo_root, get_ve_activate_line, get_ve_path_and_ipython_profile
16
16
  from machineconfig.utils.utils import display_options, choose_one_option, PROGRAM_PATH, match_file_name, sanitize_path
17
- from machineconfig.utils.path_reduced import P as PathExtended
17
+ from machineconfig.utils.path_reduced import PathExtended as PathExtended
18
18
  from machineconfig.utils.io_save import save_toml
19
19
  from machineconfig.utils.utils2 import randstr, read_toml
20
20
  import platform
@@ -30,8 +30,6 @@ def main() -> None:
30
30
  parser = argparse.ArgumentParser()
31
31
  parser.add_argument("path", nargs='?', type=str, help="The directory containing the jobs", default=".")
32
32
  parser.add_argument("function", nargs='?', type=str, help="Fuction to run", default=None)
33
-
34
- parser.add_argument("--init", "-I", type=str, help="init this repo", default="")
35
33
  parser.add_argument("--ve", "-v", type=str, help="virtual enviroment name", default="")
36
34
  parser.add_argument("--cmd", "-B", action="store_true", help="Create a cmd fire command to launch the the job asynchronously.")
37
35
  parser.add_argument("--interactive", "-i", action="store_true", help="Whether to run the job interactively using IPython")
@@ -58,18 +56,15 @@ def main() -> None:
58
56
  print(f"āŒ Failed to parse arguments: {ex}")
59
57
  parser.print_help()
60
58
  raise ex
61
- path_obj = sanitize_path(PathExtended.cwd())
62
-
63
- if args.init != "":
64
- from machineconfig.scripts.python.ai.init import add_ai_configs
65
- add_ai_configs(repo_root=path_obj)
66
-
59
+ path_obj = sanitize_path(args.path)
60
+ # print(f"Passed path sanitied to {path_obj}")
67
61
  if not path_obj.exists():
68
62
  path_obj = match_file_name(sub_string=args.path, search_root=PathExtended.cwd())
69
63
  else: pass
70
64
  if path_obj.is_dir():
71
65
  print(f"šŸ” Searching recursively for Python, PowerShell and Shell scripts in directory `{path_obj}`")
72
66
  files = search_for_files_of_interest(path_obj)
67
+ print(f"šŸ” Got #{len(files)} results.")
73
68
  choice_file = choose_one_option(options=files, fzf=True)
74
69
  choice_file = PathExtended(choice_file)
75
70
  else:
@@ -79,7 +74,7 @@ def main() -> None:
79
74
 
80
75
  ve_root_from_file, ipy_profile = get_ve_path_and_ipython_profile(choice_file)
81
76
  if ipy_profile is None: ipy_profile = "default"
82
- activate_ve_line = get_ve_activate_line(ve_root=args.ve or ve_root_from_file or "$HOME/venvs/ve")
77
+ activate_ve_line = get_ve_activate_line(ve_root=args.ve or ve_root_from_file or "$HOME/code/machineconfig/.venv")
83
78
 
84
79
  # Convert args.kw to dictionary
85
80
  if choice_file.suffix == ".py":
@@ -113,13 +108,15 @@ def main() -> None:
113
108
  kwargs[item.name] = input(f"Please enter a value for argument `{item.name}` (type = {item.type}) (default = {item.default}) : ") or item.default
114
109
  elif choice_file.suffix == ".sh": # in this case, we choos lines.
115
110
  options = []
116
- for line in choice_file.read_text().splitlines():
111
+ for line in choice_file.read_text(encoding="utf-8").splitlines():
117
112
  if line.startswith("#"): continue
118
113
  if line == "": continue
119
114
  if line.startswith("echo"): continue
120
115
  options.append(line)
121
116
  chosen_lines = display_options(msg="Choose a line to run", options=options, fzf=True, multi=True)
122
- choice_file = PathExtended.tmpfile(suffix=".sh").write_text("\n".join(chosen_lines))
117
+ choice_file = PathExtended.tmpfile(suffix=".sh")
118
+ choice_file.parent.mkdir(parents=True, exist_ok=True)
119
+ choice_file.write_text("\n".join(chosen_lines), encoding="utf-8")
123
120
  choice_function = None
124
121
  else:
125
122
  choice_function = args.function
@@ -163,7 +160,7 @@ def main() -> None:
163
160
  secrets_template["auth"]["redirect_uri"] = host_url
164
161
  secrets_template["auth"]["cookie_secret"] = randstr(35)
165
162
  secrets_template["auth"]["auth0"]["redirect_uri"] = host_url
166
- save_toml(obj=secrets_template, path=secrets_path)
163
+ save_toml(obj=secrets_template, path=secrets_path)
167
164
  except Exception as ex:
168
165
  print(ex)
169
166
  raise ex
@@ -175,7 +172,7 @@ def main() -> None:
175
172
  # exe = f"cd '{choice_file.parent}'; " + exe
176
173
  elif args.interactive is False: exe = "python"
177
174
  elif args.jupyter: exe = "jupyter-lab"
178
- else:
175
+ else:
179
176
  exe = f"ipython -i --no-banner --profile {ipy_profile} "
180
177
  elif choice_file.suffix == ".ps1" or choice_file.suffix == ".sh":
181
178
  exe = "."
@@ -220,7 +217,7 @@ except ImportError as _ex:
220
217
  """ + txt
221
218
  choice_file = PathExtended.tmp().joinpath(f'tmp_scripts/python/{PathExtended(choice_file).parent.name}_{PathExtended(choice_file).stem}_{randstr()}.py')
222
219
  choice_file.parent.mkdir(parents=True, exist_ok=True)
223
- choice_file.write_text(txt)
220
+ choice_file.write_text(txt, encoding="utf-8")
224
221
 
225
222
  # ========================= determining basic command structure: putting together exe & choice_file & choice_function & pdb
226
223
  if args.debug:
@@ -261,7 +258,6 @@ except ImportError as _ex:
261
258
  if "pudb" in command: command = f"pip install pudb & {command}"
262
259
  new_line = "\n"
263
260
  command = fr"""start cmd -Argument "/k {activate_ve_line.replace(".ps1", ".bat").replace(". ", "")} & {command.replace(new_line, " & ")} " """ # this works from powershell
264
- # this works from cmd # command = fr""" start cmd /k "%USERPROFILE%\venvs\{args.ve}\Scripts\activate.bat & {command} " """ # because start in cmd is different from start in powershell (in powershell it is short for Start-Process)
265
261
 
266
262
  if args.submit_to_cloud:
267
263
  command = f"""
@@ -277,13 +273,13 @@ python -m machineconfig.cluster.templates.cli_click --file {choice_file} """
277
273
  # sub_command = f"{command} --idx={an_arg} --idx_max={args.Nprocess}"
278
274
  # if args.optimized:
279
275
  # sub_command = sub_command.replace("python ", "python -OO ")
280
- # sub_command_path = PathExtended.tmpfile(suffix=".sh").write_text(sub_command)
276
+ # sub_command_path = PathExtended.tmpfile(suffix=".sh").write_text(sub_command, encoding="utf-8")
281
277
  # lines.append(f"""zellij action new-pane -- bash {sub_command_path} """)
282
278
  # lines.append("sleep 5") # python tends to freeze if you launch instances within 1 microsecond of each other
283
279
  # command = "\n".join(lines)
284
280
  tab_config = {}
285
281
  for an_arg in range(args.Nprocess):
286
- tab_config[f"tab{an_arg}"] = (str(PathExtended.cwd()), f"uv run python -m fire {choice_file} {choice_function} --idx={an_arg} --idx_max={args.Nprocess}")
282
+ tab_config[f"tab{an_arg}"] = (str(PathExtended.cwd()), f"uv run -m fire {choice_file} {choice_function} --idx={an_arg} --idx_max={args.Nprocess}")
287
283
  from machineconfig.cluster.sessions_managers.zellij_local import run_zellij_layout
288
284
  run_zellij_layout(tab_config=tab_config, session_name=None)
289
285
  return None
@@ -300,7 +296,9 @@ python -m machineconfig.cluster.templates.cli_click --file {choice_file} """
300
296
  console = Console()
301
297
 
302
298
  if args.zellij_tab is not None:
303
- comman_path__ = PathExtended.tmpfile(suffix=".sh").write_text(command)
299
+ comman_path__ = PathExtended.tmpfile(suffix=".sh")
300
+ comman_path__.parent.mkdir(parents=True, exist_ok=True)
301
+ comman_path__.write_text(command, encoding="utf-8")
304
302
  console.print(Panel(Syntax(command, lexer="shell"), title=f"šŸ”„ fire command @ {comman_path__}: "), style="bold red")
305
303
  import subprocess
306
304
  existing_tab_names = subprocess.run(["zellij", "action", "query-tab-names"], capture_output=True, text=True, check=True).stdout.splitlines()
@@ -335,9 +333,10 @@ python -m machineconfig.cluster.templates.cli_click --file {choice_file} """
335
333
  raise NotImplementedError(f"Platform {platform.system()} not supported.")
336
334
  command = command + f"\n. {program_path}"
337
335
  console.print(Panel(Syntax(command, lexer="shell"), title=f"šŸ”„ fire command @ {program_path}: "), style="bold red")
338
- program_path.write_text(command)
336
+ program_path.parent.mkdir(parents=True, exist_ok=True)
337
+ program_path.write_text(command, encoding="utf-8")
339
338
 
340
339
 
341
340
  if __name__ == '__main__':
342
- # options, func_args = parse_pyfile(file_path="C:/Users/aalsaf01/code/crocodile/myresources/crocodile/core.py")
341
+ # options, func_args = parse_pyfile(file_path="C:/Users/aalsaf01/code/machineconfig/myresources/crocodile/core.py")
343
342
  main()
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env -S uv run --project /home/alex/code/machineconfig --script
1
2
  """Sx & Rx
2
3
 
3
4
  TODO: add support for cases in which source or target has non 22 default port number and is defineda as user@host:port:path which makes 2 colons in the string.
@@ -6,8 +7,8 @@ Currently, the only way to work around this is to predifine the host in ~/.ssh/c
6
7
  """
7
8
 
8
9
  import argparse
9
- from crocodile.meta import SSH
10
- from machineconfig.utils.path_reduced import P as PathExtended
10
+ from machineconfig.utils.ssh import SSH
11
+ from machineconfig.utils.path_reduced import PathExtended as PathExtended
11
12
  from machineconfig.scripts.python.helpers.helpers2 import ES
12
13
  from machineconfig.utils.utils2 import pprint
13
14
 
@@ -86,7 +87,7 @@ def main():
86
87
  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€
87
88
  │ šŸ”‘ Authentication Failed
88
89
  │ Trying manual authentication...
89
- │
90
+ │
90
91
  │ āš ļø Caution: Ensure that username is passed appropriately
91
92
  │ This exception only handles password authentication
92
93
  └────────────────────────────────────────────────────────────────""")
@@ -1,104 +1,104 @@
1
- # as per https://github.com/marketplace/models/azure-openai/o1-preview
2
- from openai import OpenAI
3
- from machineconfig.utils.path_reduced import P as PathExtended
4
- from machineconfig.utils.utils2 import read_ini
5
- from rich import print as rprint
6
- from rich.panel import Panel
7
- from typing import Any
1
+ # # as per https://github.com/marketplace/models/azure-openai/o1-preview
2
+ # from openai import OpenAI
3
+ # from machineconfig.utils.path_reduced import P as PathExtended
4
+ # from machineconfig.utils.utils2 import read_ini
5
+ # from rich import print as rprint
6
+ # from rich.panel import Panel
7
+ # from typing import Any
8
8
 
9
9
 
10
- gh_token = read_ini(PathExtended.home().joinpath("dotfiles/creds/git/git_host_tokens.ini"))['thisismygitrepo']['newLongterm']
11
- endpoint = "https://models.inference.ai.azure.com"
12
- model_name_preferences = ["o3-mini", "o1-preview", "o1-mini", "GPT-4o", "GPT-4-o-mini"]
13
- client__ = OpenAI(
14
- base_url=endpoint,
15
- api_key=gh_token,
16
- )
10
+ # gh_token = read_ini(PathExtended.home().joinpath("dotfiles/creds/git/git_host_tokens.ini"))['thisismygitrepo']['newLongterm']
11
+ # endpoint = "https://models.inference.ai.azure.com"
12
+ # model_name_preferences = ["o3-mini", "o1-preview", "o1-mini", "GPT-4o", "GPT-4-o-mini"]
13
+ # client__ = OpenAI(
14
+ # base_url=endpoint,
15
+ # api_key=gh_token,
16
+ # )
17
17
 
18
18
 
19
- def get_response(client: Any, model_name: str, messages: list[dict[str, str]]):
20
- print(f"""
21
- ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€
22
- │ šŸ¤– Querying Model: {model_name}
23
- │ Sending request to API...
24
- └────────────────────────────────────────────────────────────────""")
25
- try:
26
- response = client.chat.completions.create(
27
- messages=messages,
28
- model=model_name
29
- )
30
- return response.choices
31
- except Exception as e:
32
- print(f"""
33
- ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”
34
- ā”ƒ āŒ API Error with model {model_name}
35
- ā”ƒ {str(e)}
36
- ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━""")
37
- return None
19
+ # def get_response(client: Any, model_name: str, messages: list[dict[str, str]]):
20
+ # print(f"""
21
+ # ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€
22
+ # │ šŸ¤– Querying Model: {model_name}
23
+ # │ Sending request to API...
24
+ # └────────────────────────────────────────────────────────────────""")
25
+ # try:
26
+ # response = client.chat.completions.create(
27
+ # messages=messages,
28
+ # model=model_name
29
+ # )
30
+ # return response.choices
31
+ # except Exception as e:
32
+ # print(f"""
33
+ # ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”
34
+ # ā”ƒ āŒ API Error with model {model_name}
35
+ # ā”ƒ {str(e)}
36
+ # ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━""")
37
+ # return None
38
38
 
39
39
 
40
- def interactive_chat():
41
- conversation_history = []
42
- model_index = 0
43
- model_name = model_name_preferences[model_index]
44
-
45
- print("""
46
- ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”
47
- ā”ƒ šŸš€ Interactive Chat Started
48
- ā”ƒ Type your message and press Enter to chat
49
- ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━""")
50
-
51
- while True:
52
- header = f" šŸ¤– Using Model: {model_name} "
53
- print(f"\n{header.center(80, '═')}\n")
54
-
55
- while True:
56
- try:
57
- user_input = input("šŸ’¬ You: ")
58
- conversation_history.append({"role": "user", "content": user_input})
40
+ # def interactive_chat():
41
+ # conversation_history = []
42
+ # model_index = 0
43
+ # model_name = model_name_preferences[model_index]
59
44
 
60
- while True:
61
- choices = get_response(client__, model_name, conversation_history)
62
- if choices is None:
63
- model_index += 1
64
- model_name = model_name_preferences[model_index % len(model_name_preferences)]
65
- print(f"""
66
- ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€
67
- │ šŸ”„ Model Switch
68
- │ Now using: {model_name}
69
- └────────────────────────────────────────────────────────────────""")
70
- continue
71
- else:
72
- break
45
+ # print("""
46
+ # ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”
47
+ # ā”ƒ šŸš€ Interactive Chat Started
48
+ # ā”ƒ Type your message and press Enter to chat
49
+ # ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━""")
73
50
 
74
- for a_choice in choices:
75
- response_content = a_choice.message.content
76
- print("\n" * 2)
77
- try:
78
- rprint(Panel(
79
- f"{response_content}",
80
- title=f"šŸ¤– AI ({model_name})",
81
- border_style="blue"
82
- ))
83
- except Exception:
84
- # Fallback if rich formatting fails
85
- print(f"""
86
- ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€
87
- │ šŸ¤– AI ({model_name}):
88
- │
89
- {response_content}
90
- └────────────────────────────────────────────────────────────────""")
91
-
92
- conversation_history.append({"role": "assistant", "content": response_content})
93
- print("\n")
94
- except KeyboardInterrupt:
95
- print("""
96
- ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”
97
- ā”ƒ šŸ‘‹ Chat Session Ended
98
- ā”ƒ Thank you for using the interactive chat!
99
- ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━""")
100
- return
51
+ # while True:
52
+ # header = f" šŸ¤– Using Model: {model_name} "
53
+ # print(f"\n{header.center(80, '═')}\n")
101
54
 
55
+ # while True:
56
+ # try:
57
+ # user_input = input("šŸ’¬ You: ")
58
+ # conversation_history.append({"role": "user", "content": user_input})
102
59
 
103
- if __name__ == "__main__":
104
- interactive_chat()
60
+ # while True:
61
+ # choices = get_response(client__, model_name, conversation_history)
62
+ # if choices is None:
63
+ # model_index += 1
64
+ # model_name = model_name_preferences[model_index % len(model_name_preferences)]
65
+ # print(f"""
66
+ # ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€
67
+ # │ šŸ”„ Model Switch
68
+ # │ Now using: {model_name}
69
+ # └────────────────────────────────────────────────────────────────""")
70
+ # continue
71
+ # else:
72
+ # break
73
+
74
+ # for a_choice in choices:
75
+ # response_content = a_choice.message.content
76
+ # print("\n" * 2)
77
+ # try:
78
+ # rprint(Panel(
79
+ # f"{response_content}",
80
+ # title=f"šŸ¤– AI ({model_name})",
81
+ # border_style="blue"
82
+ # ))
83
+ # except Exception:
84
+ # # Fallback if rich formatting fails
85
+ # print(f"""
86
+ # ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€
87
+ # │ šŸ¤– AI ({model_name}):
88
+ # │
89
+ # {response_content}
90
+ # └────────────────────────────────────────────────────────────────""")
91
+
92
+ # conversation_history.append({"role": "assistant", "content": response_content})
93
+ # print("\n")
94
+ # except KeyboardInterrupt:
95
+ # print("""
96
+ # ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”
97
+ # ā”ƒ šŸ‘‹ Chat Session Ended
98
+ # ā”ƒ Thank you for using the interactive chat!
99
+ # ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━""")
100
+ # return
101
+
102
+
103
+ # if __name__ == "__main__":
104
+ # interactive_chat()
@@ -79,7 +79,7 @@ def absolute(path: str) -> Path:
79
79
  def get_secure_share_cloud_config(interactive: bool, cloud: Optional[str]) -> Args:
80
80
  console = Console()
81
81
  console.print(Panel("šŸ” Secure Share Cloud Configuration", expand=False))
82
-
82
+
83
83
  if cloud is None:
84
84
  if os.environ.get("CLOUD_CONFIG_NAME") is not None:
85
85
  default_cloud = os.environ.get("CLOUD_CONFIG_NAME")
@@ -100,7 +100,7 @@ def get_secure_share_cloud_config(interactive: bool, cloud: Optional[str]) -> Ar
100
100
 
101
101
  default_password_path = Path.home().joinpath("dotfiles/creds/passwords/quick_password")
102
102
  if default_password_path.exists():
103
- pwd = default_password_path.read_text().strip()
103
+ pwd = default_password_path.read_text(encoding="utf-8").strip()
104
104
  default_message = "defaults to quick_password"
105
105
  else:
106
106
  pwd = ""
@@ -110,7 +110,7 @@ def get_secure_share_cloud_config(interactive: bool, cloud: Optional[str]) -> Ar
110
110
  pwd=pwd, encrypt=True,
111
111
  zip=True, overwrite=True, share=True,
112
112
  rel2home=True, root="myshare", os_specific=False,)
113
-
113
+
114
114
  display_success("Using SecureShare cloud config")
115
115
  pprint(res.__dict__, "SecureShare Config")
116
116
  return res
@@ -48,7 +48,7 @@ def parse_cloud_source_target(args: Args, source: str, target: str) -> tuple[str
48
48
  # consider activating it by a flag, and also not not overriding explicitly passed args options.
49
49
  assert ES not in target, "Not Implemented here yet."
50
50
  path = absolute(target)
51
- if maybe_config is None:
51
+ if maybe_config is None:
52
52
  tmp_maybe_config: Optional[Args] = find_cloud_config(path=path)
53
53
  maybe_config = tmp_maybe_config
54
54
 
@@ -96,7 +96,7 @@ def parse_cloud_source_target(args: Args, source: str, target: str) -> tuple[str
96
96
  if len(source_parts) > 1 and source_parts[1] == ES: # the source path is to be inferred from target.
97
97
  assert ES not in target, f"You can't use expand symbol `{ES}` in both source and target. Cyclical inference dependency arised."
98
98
  target_obj = absolute(target)
99
- from machineconfig.utils.path_reduced import P as PathExtended
99
+ from machineconfig.utils.path_reduced import PathExtended as PathExtended
100
100
  remote_path = PathExtended(target_obj).get_remote_path(os_specific=os_specific, root=root, rel2home=rel2home, strict=False)
101
101
  source = f"{cloud}:{remote_path.as_posix()}"
102
102
  else: # source path is mentioned, target? maybe.
@@ -115,7 +115,7 @@ def parse_cloud_source_target(args: Args, source: str, target: str) -> tuple[str
115
115
  if len(target_parts) > 1 and target_parts[1] == ES: # the target path is to be inferred from source.
116
116
  assert ES not in source, "You can't use $ in both source and target. Cyclical inference dependency arised."
117
117
  source_obj = absolute(source)
118
- from machineconfig.utils.path_reduced import P as PathExtended
118
+ from machineconfig.utils.path_reduced import PathExtended as PathExtended
119
119
  remote_path = PathExtended(source_obj).get_remote_path(os_specific=os_specific, root=root, rel2home=rel2home, strict=False)
120
120
  target = f"{cloud}:{remote_path.as_posix()}"
121
121
  else: # target path is mentioned, source? maybe.
@@ -3,21 +3,22 @@ from typing import Any, Callable, Optional
3
3
  import inspect
4
4
  import os
5
5
  # import argparse
6
- from crocodile.core import Display
7
- from machineconfig.utils.path_reduced import P as PathExtended
6
+ from machineconfig.utils.path_reduced import PathExtended as PathExtended
8
7
  # from machineconfig.utils.utils import choose_ssh_host
9
8
 
10
9
 
11
10
  def search_for_files_of_interest(path_obj: PathExtended):
12
11
  if path_obj.joinpath(".venv").exists():
13
- path_objects = path_obj.search("*", not_in=[".venv"]).list
12
+ path_objects = path_obj.search("*", not_in=[".venv"])
14
13
  files: list[PathExtended] = []
15
14
  for a_path_obj in path_objects:
16
15
  files += search_for_files_of_interest(path_obj=a_path_obj)
17
16
  return files
18
- py_files = path_obj.search(pattern="*.py", not_in=["__init__.py"], r=True).list
19
- ps_files = path_obj.search(pattern="*.ps1", r=True).list
20
- sh_files = path_obj.search(pattern="*.sh", r=True).list
17
+ if path_obj.is_file():
18
+ return [path_obj]
19
+ py_files = path_obj.search(pattern="*.py", not_in=["__init__.py"], r=True)
20
+ ps_files = path_obj.search(pattern="*.ps1", r=True)
21
+ sh_files = path_obj.search(pattern="*.sh", r=True)
21
22
  files = py_files + ps_files + sh_files
22
23
  return files
23
24
 
@@ -50,7 +51,7 @@ def parse_pyfile(file_path: str):
50
51
  if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef))
51
52
  ]
52
53
  module__doc__ = ast.get_docstring(parsed_ast)
53
- main_option = f"RUN AS MAIN -- {Display.get_repr(module__doc__, limit=150) if module__doc__ is not None else 'NoDocs'}"
54
+ main_option = f"RUN AS MAIN -- {module__doc__ if module__doc__ is not None else 'NoDocs'}"
54
55
  options = [main_option]
55
56
  for function in functions:
56
57
  if function.name.startswith('__') and function.name.endswith('__'): continue
@@ -41,10 +41,10 @@ def get_jupyter_notebook(python_code: str):
41
41
  return template
42
42
 
43
43
 
44
- def create_jupyter_notebook(py_script: str) -> None:
45
- import nbformat as nbf
46
- from nbformat.notebooknode import NotebookNode
47
- nb: NotebookNode = nbf.v4.new_notebook()
48
- nb.cells.append(nbf.v4.new_code_cell(py_script))
49
- with open("new_notebook.ipynb", mode="w", encoding="utf-8") as f:
50
- nbf.write(nb,f)
44
+ # def create_jupyter_notebook(py_script: str) -> None:
45
+ # import nbformat as nbf
46
+ # from nbformat.notebooknode import NotebookNode
47
+ # nb: NotebookNode = nbf.v4.new_notebook()
48
+ # nb.cells.append(nbf.v4.new_code_cell(py_script))
49
+ # with open("new_notebook.ipynb", mode="w", encoding="utf-8") as f:
50
+ # nbf.write(nb,f)
@@ -1,5 +1,5 @@
1
- from machineconfig.utils.path_reduced import P as PathExtended
2
- from crocodile.meta import Terminal
1
+ from machineconfig.utils.path_reduced import PathExtended as PathExtended
2
+ from machineconfig.utils.terminal import Terminal
3
3
  from machineconfig.scripts.python.get_zellij_cmd import get_zellij_cmd
4
4
  from machineconfig.utils.utils import CONFIG_PATH, DEFAULTS_PATH
5
5
  from machineconfig.utils.utils2 import read_ini
@@ -1,8 +1,9 @@
1
1
  """NFS mounting script
2
2
  """
3
3
 
4
- from machineconfig.utils.path_reduced import P as PathExtended
5
- from crocodile.meta import SSH, Terminal
4
+ from machineconfig.utils.path_reduced import PathExtended as PathExtended
5
+ from machineconfig.utils.ssh import SSH
6
+ from machineconfig.utils.terminal import Terminal
6
7
  from machineconfig.utils.utils import display_options, PROGRAM_PATH, choose_ssh_host
7
8
  import platform
8
9
 
@@ -73,7 +74,7 @@ $driveLetter = "{driver_letter}"
73
74
 
74
75
  print("\nšŸ“„ Configuration File Content:")
75
76
  print("-" * 50)
76
- print(PROGRAM_PATH.read_text())
77
+ print(PROGRAM_PATH.read_text(encoding="utf-8"))
77
78
  print("-" * 50 + "\n")
78
79
 
79
80
  print("šŸŽ‰ NFS Mounting Process Completed Successfully!\n")
@@ -10,11 +10,11 @@ def main():
10
10
  drive_location = input("šŸ”— Enter the network drive location (e.g., //192.168.1.100/Share): ")
11
11
  machine_name = drive_location.split("//")[1].split("/")[0]
12
12
 
13
- mount_point = input(f"šŸ“‚ Enter the mount point directory (e.g., /mnt/network) [Default: ~/data/mount_nw/{machine_name}]: ")
14
- if mount_point == "":
13
+ mount_point_input = input(f"šŸ“‚ Enter the mount point directory (e.g., /mnt/network) [Default: ~/data/mount_nw/{machine_name}]: ")
14
+ if mount_point_input == "":
15
15
  mount_point = Path.home().joinpath(fr"data/mount_nw/{machine_name}")
16
16
  else:
17
- mount_point = Path(mount_point).expanduser()
17
+ mount_point = Path(mount_point_input).expanduser()
18
18
 
19
19
  print(f"\n🌐 Network Drive Location: {drive_location}")
20
20
  print(f"šŸ“ Mount Point: {mount_point}\n")
@@ -30,7 +30,7 @@ mount_point='{mount_point}'
30
30
  username='{username}'
31
31
  password='{password}'
32
32
 
33
- """)
33
+ """, encoding="utf-8")
34
34
  print("āœ… Configuration saved successfully!\n")
35
35
 
36
36
  elif platform.system() == "Windows":
@@ -2,8 +2,9 @@
2
2
  """
3
3
 
4
4
  from platform import system
5
- from crocodile.meta import SSH, Terminal
6
- from machineconfig.utils.path_reduced import P as PathExtended
5
+ from machineconfig.utils.ssh import SSH
6
+ from machineconfig.utils.terminal import Terminal
7
+ from machineconfig.utils.path_reduced import PathExtended as PathExtended
7
8
  from machineconfig.utils.utils import PROGRAM_PATH, choose_ssh_host
8
9
 
9
10
  def main():
@@ -50,7 +51,7 @@ fusermount -u /mnt/dbhdd
50
51
  else:
51
52
  raise ValueError(f"āŒ Not implemented for this system: {system()}")
52
53
 
53
- PROGRAM_PATH.write_text(txt)
54
+ PROGRAM_PATH.write_text(txt, encoding="utf-8")
54
55
  print("āœ… Configuration saved successfully!\n")
55
56
 
56
57
  print("šŸŽ‰ SSHFS Mounting Process Completed!\n")
@@ -7,7 +7,7 @@ in the event that username@github.com is not mentioned in the remote url.
7
7
 
8
8
  from rich import print as pprint
9
9
  from machineconfig.utils.utils import write_shell_script_to_default_program_path, CONFIG_PATH, DEFAULTS_PATH
10
- from machineconfig.utils.path_reduced import P as PathExtended
10
+ from machineconfig.utils.path_reduced import PathExtended as PathExtended
11
11
  from machineconfig.utils.io_save import save_json
12
12
  from machineconfig.utils.utils2 import randstr, read_json, read_ini
13
13
  import argparse
@@ -172,7 +172,7 @@ def install_repos(specs_path: str, clone: bool=True, checkout_to_recorded_commit
172
172
  for repo in repos:
173
173
  parent_dir = PathExtended(repo["parent_dir"]).expanduser().absolute()
174
174
  parent_dir.mkdir(parents=True, exist_ok=True)
175
-
175
+
176
176
  # Handle cloning and remote setup
177
177
  if clone:
178
178
  # Select the remote to use for cloning
@@ -185,30 +185,30 @@ def install_repos(specs_path: str, clone: bool=True, checkout_to_recorded_commit
185
185
  remote_url = repo["remotes"][preferred_remote]
186
186
  elif preferred_remote is not None:
187
187
  print(f"āš ļø `{preferred_remote=}` not found in {repo['remotes']}.")
188
-
188
+
189
189
  # Clone with the selected remote
190
190
  program += f"\ncd {parent_dir.collapseuser().as_posix()}; git clone {remote_url} --origin {remote_name} --depth 2"
191
191
  program += f"\ncd {parent_dir.collapseuser().as_posix()}/{repo['name']}; git remote set-url {remote_name} {remote_url}"
192
-
192
+
193
193
  # Add any additional remotes
194
194
  for other_remote_name, other_remote_url in repo["remotes"].items():
195
195
  if other_remote_name != remote_name:
196
196
  program += f"\ncd {parent_dir.collapseuser().as_posix()}/{repo['name']}; git remote add {other_remote_name} {other_remote_url}"
197
-
197
+
198
198
  # Handle checkout operations (after all remotes are set up)
199
199
  if checkout_to_recorded_commit:
200
200
  commit = repo['version']['commit']
201
- if isinstance(commit, str):
201
+ if isinstance(commit, str):
202
202
  program += f"\ncd {parent_dir.collapseuser().as_posix()}/{repo['name']}; git checkout {commit}"
203
- else:
203
+ else:
204
204
  print(f"Skipping {repo['parent_dir']} because it doesn't have a commit recorded. Found {commit}")
205
205
  elif checkout_to_branch:
206
206
  program += f"\ncd {parent_dir.collapseuser().as_posix()}/{repo['name']}; git checkout {repo['current_branch']}"
207
-
207
+
208
208
  # Handle editable install
209
209
  if editable_install:
210
210
  program += f"\ncd {parent_dir.collapseuser().as_posix()}/{repo['name']}; uv pip install -e ."
211
-
211
+
212
212
  program += "\n"
213
213
  pprint(program)
214
214
  return program
@@ -30,7 +30,7 @@
30
30
  # if args.report:
31
31
  # print("šŸ“Š Generating report...")
32
32
  # reports: list[Report] = [Report.from_path(read_task_from_dir(x).report_path) for x in PathExtended(root).search("*").filter(lambda path: path.joinpath("task.py").exists())]
33
-
33
+
34
34
  # # Format as markdown table
35
35
  # report_data = [r.__dict__ for r in reports]
36
36
  # if report_data: