machineconfig 8.12__py3-none-any.whl → 8.45__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 (273) hide show
  1. machineconfig/cluster/remote/run_cluster.py +1 -1
  2. machineconfig/cluster/remote/run_remote.py +1 -1
  3. machineconfig/cluster/sessions_managers/utils/maker.py +10 -8
  4. machineconfig/cluster/sessions_managers/wt_local.py +1 -1
  5. machineconfig/cluster/sessions_managers/wt_local_manager.py +1 -1
  6. machineconfig/cluster/sessions_managers/zellij_local.py +1 -1
  7. machineconfig/cluster/sessions_managers/zellij_local_manager.py +1 -1
  8. machineconfig/jobs/installer/checks/check_installations.py +133 -0
  9. machineconfig/jobs/installer/checks/install_utils.py +132 -0
  10. machineconfig/jobs/installer/checks/report_utils.py +39 -0
  11. machineconfig/jobs/installer/checks/vt_utils.py +89 -0
  12. machineconfig/jobs/installer/installer_data.json +225 -140
  13. machineconfig/jobs/installer/linux_scripts/docker.sh +6 -9
  14. machineconfig/jobs/installer/package_groups.py +10 -9
  15. machineconfig/jobs/installer/python_scripts/boxes.py +1 -2
  16. machineconfig/jobs/installer/python_scripts/code.py +10 -8
  17. machineconfig/jobs/installer/python_scripts/hx.py +30 -13
  18. machineconfig/jobs/installer/python_scripts/nerfont_windows_helper.py +6 -5
  19. machineconfig/jobs/installer/python_scripts/sysabc.py +25 -19
  20. machineconfig/jobs/installer/python_scripts/yazi.py +33 -17
  21. machineconfig/jobs/scripts/powershell_scripts/cmatrix.ps1 +52 -0
  22. machineconfig/jobs/scripts/powershell_scripts/mount_ssh.ps1 +1 -1
  23. machineconfig/jobs/scripts_dynamic/a.py +413 -10
  24. machineconfig/profile/create_links.py +77 -20
  25. machineconfig/profile/create_links_export.py +40 -51
  26. machineconfig/profile/mapper_data.toml +30 -0
  27. machineconfig/profile/mapper_dotfiles.toml +253 -0
  28. machineconfig/scripts/python/agents.py +70 -172
  29. machineconfig/scripts/python/ai/initai.py +3 -1
  30. machineconfig/scripts/python/ai/scripts/__init__.py +1 -0
  31. machineconfig/scripts/python/ai/scripts/lint_and_type_check.ps1 +2 -0
  32. machineconfig/scripts/python/ai/scripts/lint_and_type_check.sh +7 -5
  33. machineconfig/scripts/python/ai/solutions/claude/claude.py +1 -1
  34. machineconfig/scripts/python/ai/solutions/cline/cline.py +1 -1
  35. machineconfig/scripts/python/ai/solutions/copilot/github_copilot.py +1 -1
  36. machineconfig/scripts/python/ai/solutions/copilot/instructions/python/dev.instructions.md +29 -0
  37. machineconfig/scripts/python/ai/solutions/crush/crush.py +1 -1
  38. machineconfig/scripts/python/ai/solutions/cursor/cursors.py +1 -1
  39. machineconfig/scripts/python/ai/solutions/gemini/gemini.py +1 -1
  40. machineconfig/scripts/python/ai/solutions/gemini/settings.json +3 -0
  41. machineconfig/scripts/python/ai/{solutions → utils}/generic.py +2 -15
  42. machineconfig/scripts/python/ai/utils/vscode_tasks.py +6 -3
  43. machineconfig/scripts/python/cloud.py +58 -11
  44. machineconfig/scripts/python/croshell.py +4 -156
  45. machineconfig/scripts/python/devops.py +57 -40
  46. machineconfig/scripts/python/devops_navigator.py +17 -3
  47. machineconfig/scripts/python/fire_jobs.py +8 -207
  48. machineconfig/scripts/python/ftpx.py +5 -225
  49. machineconfig/scripts/python/graph/cli_graph.json +8743 -0
  50. machineconfig/scripts/python/{env_manager → helper_env}/path_manager_tui.py +2 -2
  51. machineconfig/scripts/python/{env_manager → helpers/helper_env}/env_manager_tui.py +1 -1
  52. machineconfig/scripts/python/helpers/helper_env/path_manager_tui.py +228 -0
  53. machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_crush.py +1 -1
  54. machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_cursor_agents.py +1 -1
  55. machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_gemini.py +1 -1
  56. machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_qwen.py +1 -1
  57. machineconfig/scripts/python/helpers/helpers_agents/agents_impl.py +168 -0
  58. machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/fire_agents_help_launch.py +5 -5
  59. machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/cloud_copy.py +6 -6
  60. machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/cloud_mount.py +10 -5
  61. machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/cloud_sync.py +3 -3
  62. machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/helpers2.py +1 -1
  63. machineconfig/scripts/python/helpers/helpers_croshell/croshell_impl.py +225 -0
  64. machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/scheduler.py +4 -4
  65. machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/start_slidev.py +7 -6
  66. machineconfig/scripts/python/helpers/helpers_devops/backup_config.py +149 -0
  67. machineconfig/scripts/python/helpers/helpers_devops/cli_backup_retrieve.py +267 -0
  68. machineconfig/scripts/python/helpers/helpers_devops/cli_config.py +98 -0
  69. machineconfig/scripts/python/helpers/helpers_devops/cli_config_dotfile.py +274 -0
  70. machineconfig/scripts/python/helpers/helpers_devops/cli_data.py +76 -0
  71. machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_nw.py +52 -72
  72. machineconfig/scripts/python/helpers/helpers_devops/cli_repos.py +265 -0
  73. machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_self.py +45 -21
  74. machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_share_file.py +44 -30
  75. machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_share_server.py +26 -43
  76. machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_share_terminal.py +12 -6
  77. machineconfig/scripts/python/helpers/helpers_devops/cli_ssh.py +167 -0
  78. machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/devops_status.py +12 -6
  79. machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/devops_update_repos.py +1 -1
  80. machineconfig/scripts/python/{interactive.py → helpers/helpers_devops/interactive.py} +69 -45
  81. machineconfig/scripts/python/helpers/helpers_devops/run_script.py +197 -0
  82. machineconfig/scripts/python/helpers/helpers_devops/themes/choose_starship_theme.ps1 +41 -0
  83. machineconfig/scripts/python/helpers/helpers_devops/themes/choose_starship_theme.sh +48 -0
  84. machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/themes/choose_wezterm_theme.py +3 -3
  85. machineconfig/scripts/python/helpers/helpers_fire_command/fire_jobs_impl.py +233 -0
  86. machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/fire_jobs_route_helper.py +3 -3
  87. machineconfig/scripts/python/helpers/helpers_msearch/msearch_impl.py +248 -0
  88. machineconfig/scripts/python/{helpers_msearch → helpers/helpers_msearch}/scripts_linux/fzfg +4 -3
  89. machineconfig/scripts/python/helpers/helpers_msearch/scripts_linux/search_with_context.sh +48 -0
  90. machineconfig/scripts/python/{helpers_msearch → helpers/helpers_msearch}/scripts_windows/fzfg.ps1 +1 -1
  91. machineconfig/scripts/python/helpers/helpers_navigator/__init__.py +20 -0
  92. machineconfig/scripts/python/helpers/helpers_navigator/cli_graph_loader.py +234 -0
  93. machineconfig/scripts/python/{helpers_navigator → helpers/helpers_navigator}/command_builder.py +61 -13
  94. machineconfig/scripts/python/helpers/helpers_navigator/command_detail.py +153 -0
  95. machineconfig/scripts/python/helpers/helpers_navigator/command_tree.py +45 -0
  96. machineconfig/scripts/python/{helpers_navigator → helpers/helpers_navigator}/data_models.py +18 -11
  97. machineconfig/scripts/python/{helpers_navigator → helpers/helpers_navigator}/main_app.py +5 -5
  98. machineconfig/scripts/python/helpers/helpers_network/__init__.py +0 -0
  99. machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/address.py +15 -17
  100. machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/address_switch.py +1 -1
  101. machineconfig/scripts/python/helpers/helpers_network/ftpx_impl.py +276 -0
  102. machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/mount_ssh.py +2 -2
  103. machineconfig/scripts/python/helpers/helpers_network/ssh_add_identity.py +73 -0
  104. machineconfig/scripts/python/helpers/helpers_network/ssh_add_ssh_key.py +175 -0
  105. machineconfig/scripts/python/helpers/helpers_network/ssh_debug_linux.py +319 -0
  106. machineconfig/scripts/python/helpers/helpers_network/ssh_debug_windows.py +275 -0
  107. machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/action.py +3 -3
  108. machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/action_helper.py +3 -3
  109. machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/cloud_repo_sync.py +116 -33
  110. machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/grource.py +3 -2
  111. machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/record.py +33 -13
  112. machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/repo_analyzer_2.py +63 -19
  113. machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/update.py +0 -6
  114. machineconfig/scripts/python/helpers/helpers_search/script_help.py +81 -0
  115. machineconfig/scripts/python/helpers/helpers_sessions/__init__.py +0 -0
  116. machineconfig/scripts/python/helpers/helpers_sessions/sessions_impl.py +177 -0
  117. machineconfig/scripts/python/{helpers_sessions → helpers/helpers_sessions}/sessions_multiprocess.py +1 -1
  118. machineconfig/scripts/python/helpers/helpers_terminal/__init__.py +0 -0
  119. machineconfig/scripts/python/helpers/helpers_terminal/terminal_impl.py +96 -0
  120. machineconfig/scripts/python/{helpers_utils → helpers/helpers_utils}/download.py +1 -1
  121. machineconfig/scripts/python/{helpers_utils → helpers/helpers_utils}/python.py +49 -29
  122. machineconfig/scripts/python/helpers/helpers_utils/specs.py +246 -0
  123. machineconfig/scripts/python/mcfg_entry.py +133 -48
  124. machineconfig/scripts/python/msearch.py +15 -61
  125. machineconfig/scripts/python/sessions.py +59 -194
  126. machineconfig/scripts/python/terminal.py +18 -96
  127. machineconfig/scripts/python/utils.py +101 -20
  128. machineconfig/settings/atuin/config.toml +294 -0
  129. machineconfig/settings/atuin/themes/catppuccin-mocha-mauve.toml +12 -0
  130. machineconfig/settings/linters/.ruff.toml +1 -0
  131. machineconfig/settings/mprocs/windows/mprocs.yaml +2 -2
  132. machineconfig/settings/shells/bash/init.sh +6 -3
  133. machineconfig/settings/shells/pwsh/init.ps1 +69 -1
  134. machineconfig/settings/shells/pwsh/search_pwsh_history.ps1 +99 -0
  135. machineconfig/settings/shells/wezterm/wezterm.lua +4 -1
  136. machineconfig/settings/shells/wt/settings.json +20 -7
  137. machineconfig/settings/shells/zsh/init.sh +34 -4
  138. machineconfig/settings/television/cable_unix/bash-history.toml +1 -1
  139. machineconfig/settings/television/cable_windows/pwsh-history.toml +1 -1
  140. machineconfig/settings/tv/config.toml +234 -0
  141. machineconfig/settings/tv/themes/catppuccin-mocha-sky.toml +22 -0
  142. machineconfig/settings/wsl/.wslconfig +5 -30
  143. machineconfig/settings/yazi/yazi_linux.toml +18 -8
  144. machineconfig/settings/zellij/layouts/st.kdl +2 -2
  145. machineconfig/settings/zellij/layouts/st2.kdl +1 -1
  146. machineconfig/setup_linux/web_shortcuts/interactive.sh +10 -10
  147. machineconfig/setup_linux/web_shortcuts/live_from_github.sh +3 -0
  148. machineconfig/setup_mac/__init__.py +0 -2
  149. machineconfig/setup_windows/__init__.py +0 -1
  150. machineconfig/setup_windows/web_shortcuts/interactive.ps1 +14 -13
  151. machineconfig/setup_windows/web_shortcuts/live_from_github.ps1 +4 -3
  152. machineconfig/setup_windows/web_shortcuts/quick_init.ps1 +3 -3
  153. machineconfig/type_hinting/sql/__init__.py +1 -0
  154. machineconfig/type_hinting/sql/base.py +216 -0
  155. machineconfig/type_hinting/sql/core_schema.py +64 -0
  156. machineconfig/type_hinting/sql/core_schema_typeddict.py +41 -0
  157. machineconfig/type_hinting/sql/typeddict_codegen.py +222 -0
  158. machineconfig/type_hinting/typedict/__init__.py +1 -0
  159. machineconfig/type_hinting/typedict/ast_utils.py +130 -0
  160. machineconfig/type_hinting/typedict/generator_helpers.py +319 -0
  161. machineconfig/type_hinting/typedict/generators.py +231 -0
  162. machineconfig/type_hinting/typedict/polars_schema.py +24 -0
  163. machineconfig/type_hinting/typedict/polars_schema_typeddict.py +63 -0
  164. machineconfig/utils/accessories.py +24 -0
  165. machineconfig/utils/code.py +79 -37
  166. machineconfig/utils/files/ascii_art.py +10 -14
  167. machineconfig/utils/files/headers.py +3 -5
  168. machineconfig/utils/files/read.py +8 -1
  169. machineconfig/utils/installer_utils/github_release_bulk.py +1 -0
  170. machineconfig/utils/installer_utils/install_from_url.py +1 -1
  171. machineconfig/utils/installer_utils/installer_class.py +12 -4
  172. machineconfig/utils/installer_utils/installer_cli.py +1 -15
  173. machineconfig/utils/installer_utils/installer_helper.py +2 -2
  174. machineconfig/utils/installer_utils/installer_locator_utils.py +13 -13
  175. machineconfig/utils/installer_utils/installer_runner.py +4 -4
  176. machineconfig/utils/meta.py +6 -4
  177. machineconfig/utils/options.py +49 -19
  178. machineconfig/utils/options_utils/__init__.py +0 -0
  179. machineconfig/utils/options_utils/options_tv_linux.py +211 -0
  180. machineconfig/utils/options_utils/options_tv_windows.py +88 -0
  181. machineconfig/utils/options_utils/tv_options.py +37 -0
  182. machineconfig/utils/path_extended.py +6 -6
  183. machineconfig/utils/scheduler.py +8 -2
  184. machineconfig/utils/schemas/fire_agents/fire_agents_input.py +1 -1
  185. machineconfig/utils/source_of_truth.py +6 -1
  186. machineconfig/utils/ssh.py +73 -22
  187. machineconfig/utils/ssh_utils/abc.py +1 -1
  188. machineconfig/utils/ssh_utils/copy_from_here.py +2 -2
  189. machineconfig/utils/ssh_utils/utils.py +2 -2
  190. machineconfig/utils/ssh_utils/wsl.py +107 -170
  191. machineconfig/utils/ssh_utils/wsl_helper.py +217 -0
  192. machineconfig/utils/upgrade_packages.py +4 -8
  193. {machineconfig-8.12.dist-info → machineconfig-8.45.dist-info}/METADATA +29 -22
  194. {machineconfig-8.12.dist-info → machineconfig-8.45.dist-info}/RECORD +249 -211
  195. machineconfig/jobs/installer/check_installations.py +0 -248
  196. machineconfig/jobs/scripts/bash_scripts/mint_keyboard_shortcuts.sh +0 -30
  197. machineconfig/profile/backup.toml +0 -49
  198. machineconfig/profile/mapper.toml +0 -263
  199. machineconfig/scripts/python/helpers_devops/cli_config.py +0 -105
  200. machineconfig/scripts/python/helpers_devops/cli_config_dotfile.py +0 -89
  201. machineconfig/scripts/python/helpers_devops/cli_data.py +0 -25
  202. machineconfig/scripts/python/helpers_devops/cli_repos.py +0 -208
  203. machineconfig/scripts/python/helpers_devops/devops_backup_retrieve.py +0 -80
  204. machineconfig/scripts/python/helpers_devops/run_script.py +0 -168
  205. machineconfig/scripts/python/helpers_devops/themes/choose_starship_theme.bash +0 -3
  206. machineconfig/scripts/python/helpers_navigator/__init__.py +0 -20
  207. machineconfig/scripts/python/helpers_navigator/command_detail.py +0 -44
  208. machineconfig/scripts/python/helpers_navigator/command_tree.py +0 -620
  209. machineconfig/scripts/python/helpers_network/ssh_add_identity.py +0 -116
  210. machineconfig/scripts/python/helpers_network/ssh_add_ssh_key.py +0 -153
  211. machineconfig/scripts/python/helpers_network/ssh_debug_linux.py +0 -391
  212. machineconfig/scripts/python/helpers_network/ssh_debug_windows.py +0 -338
  213. machineconfig/scripts/python/helpers_repos/entrypoint.py +0 -77
  214. machineconfig/setup_mac/ssh/openssh_setup.sh +0 -114
  215. machineconfig/setup_windows/ssh/add-sshkey.ps1 +0 -29
  216. machineconfig/setup_windows/ssh/openssh-server.ps1 +0 -37
  217. machineconfig/utils/options_tv.py +0 -119
  218. machineconfig/utils/tst.py +0 -20
  219. /machineconfig/{scripts/python/helpers_agents → jobs/installer/checks}/__init__.py +0 -0
  220. /machineconfig/scripts/python/ai/{solutions/_shared.py → utils/shared.py} +0 -0
  221. /machineconfig/scripts/python/{helpers_agents/agentic_frameworks → graph}/__init__.py +0 -0
  222. /machineconfig/scripts/python/{helpers_cloud → helpers}/__init__.py +0 -0
  223. /machineconfig/scripts/python/{env_manager → helpers/helper_env}/__init__.py +0 -0
  224. /machineconfig/scripts/python/{env_manager → helpers/helper_env}/path_manager_backend.py +0 -0
  225. /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_agents}/__init__.py +0 -0
  226. /machineconfig/scripts/python/{helpers_devops → helpers/helpers_agents/agentic_frameworks}/__init__.py +0 -0
  227. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_crush.json +0 -0
  228. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/fire_agents_help_search.py +0 -0
  229. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/fire_agents_helper_types.py +0 -0
  230. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/fire_agents_load_balancer.py +0 -0
  231. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/aichat/config.yaml +0 -0
  232. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/aider/.aider.conf.yml +0 -0
  233. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/copilot/config.yml +0 -0
  234. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/crush/crush.json +0 -0
  235. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/gemini/settings.json +0 -0
  236. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/privacy.py +0 -0
  237. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/templates/prompt.txt +0 -0
  238. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/templates/template.ps1 +0 -0
  239. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/templates/template.sh +0 -0
  240. /machineconfig/scripts/python/{helpers_devops/themes → helpers/helpers_cloud}/__init__.py +0 -0
  241. /machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/cloud_helpers.py +0 -0
  242. /machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/helpers5.py +0 -0
  243. /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_croshell}/__init__.py +0 -0
  244. /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/crosh.py +0 -0
  245. /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/pomodoro.py +0 -0
  246. /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/viewer.py +0 -0
  247. /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/viewer_template.py +0 -0
  248. /machineconfig/scripts/python/{helpers_network → helpers/helpers_devops}/__init__.py +0 -0
  249. /machineconfig/scripts/python/{helpers_sessions → helpers/helpers_devops/themes}/__init__.py +0 -0
  250. /machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/themes/choose_pwsh_theme.ps1 +0 -0
  251. /machineconfig/scripts/python/{helpers_devops/themes/choose_starship_theme.ps1 → helpers/helpers_fire_command/__init__.py} +0 -0
  252. /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/cloud_manager.py +0 -0
  253. /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/f.py +0 -0
  254. /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/file_wrangler.py +0 -0
  255. /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/fire_jobs_args_helper.py +0 -0
  256. /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/fire_jobs_streamlit_helper.py +0 -0
  257. /machineconfig/scripts/python/{helpers_msearch → helpers/helpers_msearch}/__init__.py +0 -0
  258. /machineconfig/scripts/python/{helpers_navigator → helpers/helpers_navigator}/search_bar.py +0 -0
  259. /machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/mount_nfs.py +0 -0
  260. /machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/mount_nw_drive.py +0 -0
  261. /machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/onetimeshare.py +0 -0
  262. /machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/wifi_conn.py +0 -0
  263. /machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/clone.py +0 -0
  264. /machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/repo_analyzer_1.py +0 -0
  265. /machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/sync.py +0 -0
  266. /machineconfig/scripts/python/helpers/{ast_search.py → helpers_search/ast_search.py} +0 -0
  267. /machineconfig/scripts/python/helpers/{qr_code.py → helpers_search/qr_code.py} +0 -0
  268. /machineconfig/scripts/python/helpers/{repo_rag.py → helpers_search/repo_rag.py} +0 -0
  269. /machineconfig/scripts/python/helpers/{symantic_search.py → helpers_search/symantic_search.py} +0 -0
  270. /machineconfig/scripts/python/{helpers_utils → helpers/helpers_utils}/pdf.py +0 -0
  271. {machineconfig-8.12.dist-info → machineconfig-8.45.dist-info}/WHEEL +0 -0
  272. {machineconfig-8.12.dist-info → machineconfig-8.45.dist-info}/entry_points.txt +0 -0
  273. {machineconfig-8.12.dist-info → machineconfig-8.45.dist-info}/top_level.txt +0 -0
@@ -1,9 +1,6 @@
1
1
  #!/usr/bin/env -S uv run --no-dev --project
2
2
 
3
- """
4
- croshell
5
-
6
- """
3
+ """croshell - Cross-shell command execution."""
7
4
 
8
5
  from typing import Annotated, Optional
9
6
  import typer
@@ -17,156 +14,12 @@ def croshell(
17
14
  jupyter: Annotated[bool, typer.Option("--jupyter", "-j", help="run in jupyter interactive console")] = False,
18
15
  vscode: Annotated[bool, typer.Option("--vscode", "-c", help="open the script in vscode")] = False,
19
16
  visidata: Annotated[bool, typer.Option("--visidata", "-v", help="open data file in visidata")] = False,
20
- # streamlit_viewer: Annotated[bool, typer.Option("--streamlit", "-s", help="view in streamlit app")] = False,
21
17
  python: Annotated[bool, typer.Option("--python", "-P", help="flag to use python over IPython.")] = False,
22
18
  profile: Annotated[Optional[str], typer.Option("--profile", "-r", help="ipython profile to use, defaults to default profile.")] = None,
23
-
24
19
  ) -> None:
25
- if uv_with is not None: user_uv_with_line = f"--with {uv_with} "
26
- else: user_uv_with_line = ""
27
-
28
- if project_path is not None:
29
- uv_project_line = f'--project {project_path}'
30
- uv_python_line = ""
31
- else:
32
- uv_project_line = ""
33
- uv_python_line = "--python 3.14"
34
-
35
- from machineconfig.scripts.python.helpers_croshell.crosh import get_read_python_file_pycode, get_read_data_pycode
36
- from machineconfig.utils.meta import lambda_to_python_script
37
- from pathlib import Path
38
- from machineconfig.utils.accessories import randstr
39
- from machineconfig.utils.ve import get_ve_path_and_ipython_profile
40
- import json
41
- from rich.console import Console
42
- from rich.panel import Panel
43
- console = Console()
44
-
45
-
46
- # ==================================================================================
47
- # flags processing
48
- interactivity = "-i"
49
- interpreter = "python" if python else "ipython"
50
- ipython_profile: Optional[str] = profile
51
- file_obj = Path.cwd() # initialization value, could be modified according to args.
52
- if path is not None:
53
- from machineconfig.utils.path_helper import get_choice_file
54
- choice_file = get_choice_file(path=path, suffixes={".*"})
55
- if project_path is None:
56
- ve_path, _ = get_ve_path_and_ipython_profile(choice_file)
57
- if ve_path is not None:
58
- ve_path_obj = Path(ve_path)
59
- uv_project_line = f'--project {ve_path_obj.parent}'
60
- uv_python_line = ""
61
- if choice_file.suffix == ".py":
62
- program = choice_file.read_text(encoding="utf-8")
63
- text = f"📄 Selected file: {choice_file.name}"
64
- console.print(Panel(text, title="[bold blue]Info[/bold blue]"))
65
- else:
66
- program = lambda_to_python_script(lambda: get_read_data_pycode(path=str(choice_file)),
67
- in_global=True, import_module=False)
68
- text = f"📄 Reading data from: {file_obj.name}"
69
- console.print(Panel(text, title="[bold blue]Info[/bold blue]"))
70
- else: # if nothing is specified, then run in interactive mode.
71
- program = ""
72
-
73
- if Path.home().joinpath("code/machineconfig").exists() and uv_project_line == "":
74
- uv_project_line = f'--project "{str(Path.home().joinpath("code/machineconfig"))}"'
75
-
76
- preprogram = """
77
- #%%
78
- """
79
- def preprogram_func():
80
- from machineconfig.utils.files.headers import print_header, print_logo
81
- print_header()
82
- print_logo("Machineconfig")
83
- from pathlib import Path
84
- from machineconfig.utils.path_extended import PathExtended
85
- _ = Path, PathExtended # avoid unused import warnings
86
- import inspect
87
- import textwrap
88
- from types import FunctionType
89
- def get_body_simple_function_no_args(f: FunctionType):
90
- return textwrap.dedent("\n".join(inspect.getsource(f).splitlines()[1:]))
91
- preprogram += get_body_simple_function_no_args(preprogram_func)
92
-
93
- from pathlib import Path
94
- pyfile = Path.home().joinpath(f"tmp_results/tmp_scripts/python/croshell/{randstr()}/script.py")
95
- pyfile.parent.mkdir(parents=True, exist_ok=True)
96
- title = "Reading Data"
97
- def_code = lambda_to_python_script(lambda: get_read_python_file_pycode(path=str(pyfile), title=title),
98
- in_global=False, import_module=False)
99
- # print(def_code)
100
- python_program = preprogram + "\n\n" + def_code + program
101
- pyfile.write_text(python_program, encoding="utf-8")
102
- # ve_root_from_file, ipython_profile = get_ve_path_and_ipython_profile(PathExtended(file))
103
- ipython_profile = ipython_profile if ipython_profile is not None else "default"
104
- # ve_activateion_line = get_ve_activate_line(ve_name=args.ve or ve_profile_suggested, a_path=str(PathExtended.cwd()))
105
-
106
- # prepare notebook target path (avoid relying on locals())
107
- nb_target = pyfile.with_suffix(".ipynb")
108
- if jupyter:
109
- try:
110
- nb_path = pyfile.with_suffix(".ipynb")
111
- nb_content = {
112
- "cells": [
113
- {
114
- "cell_type": "code",
115
- "metadata": {"language": "python"},
116
- "source": [python_program],
117
- "outputs": [],
118
- "execution_count": None,
119
- }
120
- ],
121
- "metadata": {},
122
- "nbformat": 4,
123
- "nbformat_minor": 5,
124
- }
125
- nb_path.write_text(json.dumps(nb_content), encoding="utf-8")
126
- nb_target = nb_path
127
- except Exception:
128
- # if writing fails, fall back to the default nb_target already set
129
- pass
130
- if visidata:
131
- if file_obj.suffix == ".json":
132
- fire_line = f"uv run {uv_python_line} {user_uv_with_line} {uv_project_line} --with visidata vd {str(file_obj)}"
133
- else:
134
- fire_line = f"uv run {uv_python_line} {user_uv_with_line} {uv_project_line} --with visidata,pyarrow vd {str(file_obj)}"
135
- elif marimo:
136
- if Path.home().joinpath("code/machineconfig").exists():
137
- requirements = f"""{user_uv_with_line} {uv_project_line} --with marimo """
138
- else: requirements = f"""{uv_python_line} {user_uv_with_line} {uv_project_line} --with "marimo,cowsay,machineconfig[plot]>=8.12" """
139
- fire_line = f"""
140
- cd {str(pyfile.parent)}
141
- uv run {uv_python_line} --with "marimo" marimo convert {pyfile.name} -o marimo_nb.py
142
- uv run {requirements} marimo edit --host 0.0.0.0 marimo_nb.py
143
- """
144
- elif jupyter:
145
- if Path.home().joinpath("code/machineconfig").exists():
146
- requirements = f"""{user_uv_with_line} {uv_project_line} --with jupyterlab """
147
- else: requirements = f"""{user_uv_with_line} {uv_project_line} --with "cowsay,machineconfig[plot]>=8.12" """
148
- fire_line = f"uv run {requirements} {uv_project_line} jupyter-lab {str(nb_target)}"
149
- elif vscode:
150
- user_uv_add = f"uv add {uv_with}" if uv_with is not None else ""
151
- fire_line = f"""
152
- cd {str(pyfile.parent)}
153
- uv init {uv_python_line}
154
- uv venv
155
- uv add "cowsay,machineconfig[plot]>=8.12"
156
- uv add {user_uv_add}
157
- # code serve-web
158
- code --new-window {str(pyfile)}
159
- """
160
- else:
161
- if interpreter == "ipython": profile = f" --profile {ipython_profile} --no-banner"
162
- else: profile = ""
163
- if Path.home().joinpath("code/machineconfig").exists():
164
- ve_line = f"""{user_uv_with_line} {uv_project_line} """
165
- else: ve_line = f"""{uv_python_line} {user_uv_with_line} {uv_project_line} --with "cowsay,machineconfig[plot]>=8.12" """
166
- fire_line = f"uv run {ve_line} {interpreter} {interactivity} {profile} {str(pyfile)}"
167
-
168
- from machineconfig.utils.code import exit_then_run_shell_script
169
- exit_then_run_shell_script(fire_line, strict=False)
20
+ """Cross-shell command execution."""
21
+ from machineconfig.scripts.python.helpers.helpers_croshell.croshell_impl import croshell as impl
22
+ impl(path=path, project_path=project_path, uv_with=uv_with, marimo=marimo, jupyter=jupyter, vscode=vscode, visidata=visidata, python=python, profile=profile)
170
23
 
171
24
 
172
25
  def main() -> None:
@@ -174,9 +27,4 @@ def main() -> None:
174
27
 
175
28
 
176
29
  if __name__ == "__main__":
177
- # def func(flag: Annotated[bool, typer.Option("--flag/-nf", help="dummy flag for debugging", flag_value=False, is_flag=True)]=True):
178
- # console.print(f"flag: {flag}")
179
- # app = typer.Typer()
180
- # app.command()(func)
181
- # app()
182
30
  main()
@@ -1,14 +1,8 @@
1
- """devops with emojis"""
1
+ """devops with emojis - lazy loading subcommands."""
2
2
 
3
3
  import typer
4
- from typing import Optional, Annotated
4
+ from typing import Optional, Annotated, Literal
5
5
 
6
- import machineconfig.scripts.python.helpers_devops.cli_repos as cli_repos
7
- import machineconfig.scripts.python.helpers_devops.cli_config as cli_config
8
- import machineconfig.scripts.python.helpers_devops.cli_self as cli_self
9
- import machineconfig.scripts.python.helpers_devops.cli_data as cli_data
10
- import machineconfig.scripts.python.helpers_devops.cli_nw as cli_network
11
- import machineconfig.scripts.python.helpers_devops.run_script as run_py_script_module
12
6
 
13
7
  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,
14
8
  group: Annotated[bool, typer.Option(..., "--group", "-g", help="Treat 'which' as a group name. A group is bundle of apps.")] = False,
@@ -19,46 +13,69 @@ def install(which: Annotated[Optional[str], typer.Argument(..., help="Comma-sepa
19
13
  installer_entry_point.main_installer_cli(which=which, group=group, interactive=interactive)
20
14
 
21
15
 
16
+ def repos(ctx: typer.Context) -> None:
17
+ """📁 [r] Manage development repositories"""
18
+ import machineconfig.scripts.python.helpers.helpers_devops.cli_repos as cli_repos
19
+ cli_repos.get_app()(ctx.args, standalone_mode=False)
22
20
 
23
- # def get_app():
24
- # app = typer.Typer(add_completion=False, no_args_is_help=True)
25
- # app.command(name="scripts", help="define all scripts", no_args_is_help=False)(define_scripts)
26
- # return app
27
21
 
28
- # def main():
29
- # # return app
30
- # app = get_app()
31
- # app()
22
+ def config(ctx: typer.Context) -> None:
23
+ """⚙️ [c] Configuration management"""
24
+ import machineconfig.scripts.python.helpers.helpers_devops.cli_config as cli_config
25
+ cli_config.get_app()(ctx.args, standalone_mode=False)
32
26
 
33
- # define_app = get_define_app()
34
27
 
28
+ def data(ctx: typer.Context) -> None:
29
+ """💾 [d] Data management"""
30
+ import machineconfig.scripts.python.helpers.helpers_devops.cli_data as cli_data
31
+ cli_data.get_app()(ctx.args, standalone_mode=False)
35
32
 
36
- def get_app():
37
33
 
38
- cli_app = typer.Typer(help="🛠️ DevOps operations", no_args_is_help=True, add_help_option=False, add_completion=False)
39
- cli_app.command("install", no_args_is_help=True, help=install.__doc__, short_help="🛠️ [i] Install essential packages")(install)
34
+ def self_cmd(ctx: typer.Context) -> None:
35
+ """🔧 [s] Self management"""
36
+ import machineconfig.scripts.python.helpers.helpers_devops.cli_self as cli_self
37
+ cli_self.get_app()(ctx.args, standalone_mode=False)
38
+
39
+
40
+ def network(ctx: typer.Context) -> None:
41
+ """🌐 [n] Network management"""
42
+ import machineconfig.scripts.python.helpers.helpers_devops.cli_nw as cli_network
43
+ cli_network.get_app()(ctx.args, standalone_mode=False)
44
+
45
+
46
+ def execute(
47
+ ctx: typer.Context,
48
+ name: Annotated[str, typer.Argument(help="Name of script to run, e.g., 'a' for a.py, or command to execute")] = "",
49
+ where: Annotated[Literal["all", "a", "private", "p", "public", "b", "library", "l", "dynamic", "d", "custom", "c"], typer.Option("--where", "-w", help="Where to look for the script")] = "all",
50
+ interactive: Annotated[bool, typer.Option(..., "--interactive", "-i", help="Interactive selection of scripts to run")] = False,
51
+ command: Annotated[Optional[bool], typer.Option(..., "--command", "-c", help="Run as command")] = False,
52
+ list_scripts: Annotated[bool, typer.Option(..., "--list", "-l", help="List available scripts in all locations")] = False,
53
+ ) -> None:
54
+ """🚀 Execute python/shell scripts from pre-defined directories or as command."""
55
+ import machineconfig.scripts.python.helpers.helpers_devops.run_script as run_py_script_module
56
+ run_py_script_module.run_py_script(ctx=ctx, name=name, where=where, interactive=interactive, command=command, list_scripts=list_scripts)
57
+
58
+
59
+ def get_app() -> typer.Typer:
60
+ cli_app = typer.Typer(help="🛠️ DevOps operations", no_args_is_help=True, add_help_option=True, add_completion=False)
61
+ ctx_settings: dict[str, object] = {"allow_extra_args": True, "allow_interspersed_args": True, "ignore_unknown_options": True, "help_option_names": []}
62
+
63
+ cli_app.command("install", no_args_is_help=True, help=install.__doc__, short_help="🛠️ [i] Install essential packages")(install)
40
64
  cli_app.command("i", no_args_is_help=True, help=install.__doc__, hidden=True)(install)
41
65
 
42
- app_repos = cli_repos.get_app()
43
- cli_app.add_typer(app_repos, name="repos")
44
- cli_app.add_typer(app_repos, name="r", hidden=True)
45
- app_config = cli_config.get_app()
46
- cli_app.add_typer(app_config, name="config")
47
- cli_app.add_typer(app_config, name="c", hidden=True)
48
- app_data = cli_data.get_app()
49
- cli_app.add_typer(app_data, name="data")
50
- cli_app.add_typer(app_data, name="d", hidden=True)
51
- app_self = cli_self.get_app()
52
- cli_app.add_typer(app_self, name="self")
53
- cli_app.add_typer(app_self, name="s", hidden=True)
54
- app_nw = cli_network.get_app()
55
- cli_app.add_typer(app_nw, name="network")
56
- cli_app.add_typer(app_nw, name="n", hidden=True)
57
-
58
- cli_app.command("execute", no_args_is_help=True, help=run_py_script_module.__doc__,
59
- short_help="▶️ [e] Execute python/shell scripts from pre-defined directories or as command",
60
- context_settings={"show_help_on_error": True})(run_py_script_module.run_py_script)
61
- cli_app.command("e", no_args_is_help=True, help=run_py_script_module.__doc__, hidden=True)(run_py_script_module.run_py_script)
66
+ cli_app.command("repos", help="📁 [r] Manage development repositories", context_settings=ctx_settings)(repos)
67
+ cli_app.command("r", hidden=True, context_settings=ctx_settings)(repos)
68
+ cli_app.command("config", help="🔩 [c] Configuration management", context_settings=ctx_settings)(config)
69
+ cli_app.command("c", hidden=True, context_settings=ctx_settings)(config)
70
+ cli_app.command("data", help="💾 [d] Data management", context_settings=ctx_settings)(data)
71
+ cli_app.command("d", hidden=True, context_settings=ctx_settings)(data)
72
+ cli_app.command("self", help="🔧 [s] Self management", context_settings=ctx_settings)(self_cmd)
73
+ cli_app.command("s", hidden=True, context_settings=ctx_settings)(self_cmd)
74
+ cli_app.command("network", help="🌐 [n] Network management", context_settings=ctx_settings)(network)
75
+ cli_app.command("n", hidden=True, context_settings=ctx_settings)(network)
76
+
77
+ cli_app.command("execute", no_args_is_help=True, short_help="🚀 [e] Execute python/shell scripts from pre-defined directories or as command")(execute)
78
+ cli_app.command("e", no_args_is_help=True, hidden=True)(execute)
62
79
 
63
80
  return cli_app
64
81
 
@@ -1,6 +1,20 @@
1
- from machineconfig.scripts.python.helpers_navigator import CommandNavigatorApp
1
+ #!/usr/bin/env -S uv run --script
2
+ # /// script
3
+ # requires-python = ">=3.13"
4
+ # dependencies = [
5
+ # "machineconfig>=8.45",
6
+ # "textual",
7
+ # ]
8
+ # ///
9
+
10
+ """Textual TUI for navigating `machineconfig` command structure."""
11
+
12
+
13
+ def main() -> None:
14
+ from machineconfig.scripts.python.helpers.helpers_navigator.main_app import CommandNavigatorApp
15
+
16
+ CommandNavigatorApp().run()
2
17
 
3
18
 
4
19
  if __name__ == "__main__":
5
- app = CommandNavigatorApp()
6
- app.run()
20
+ main()
@@ -1,201 +1,9 @@
1
- """
2
- fire
3
-
4
- # https://github.com/pallets/click combine with fire. Consider
5
- # https://github.com/ceccopierangiolieugenio/pyTermTk for choose_from_options build TUI
6
- # https://github.com/chriskiehl/Gooey build commandline interface
7
-
8
- """
1
+ """fire - Fire and manage jobs."""
9
2
 
10
3
  from typing import Optional, Annotated
11
4
  import typer
12
5
 
13
6
 
14
- def route(args: "FireJobArgs", fire_args: str = "") -> None:
15
- from pathlib import Path
16
- from machineconfig.utils.path_helper import get_choice_file
17
- from machineconfig.utils.accessories import get_repo_root, randstr
18
- choice_file = get_choice_file(args.path, suffixes=None)
19
- repo_root = get_repo_root(choice_file)
20
- print(f"💾 Selected file: {choice_file}.\nRepo root: {repo_root}")
21
- if args.marimo:
22
- print(f"🧽 Preparing to launch Marimo notebook for `{choice_file}`...")
23
- tmp_dir = Path.home().joinpath(f"tmp_results/tmp_scripts/marimo/{choice_file.stem}_{randstr()}")
24
- tmp_dir.mkdir(parents=True, exist_ok=True)
25
- script = f"""
26
- cd {tmp_dir}
27
- uv run --python 3.14 --with marimo marimo convert {choice_file} -o marimo_nb.py
28
- uv run --project {repo_root} --with marimo marimo edit --host 0.0.0.0 marimo_nb.py
29
- """
30
- from machineconfig.utils.code import exit_then_run_shell_script
31
- print(f"🚀 Launching Marimo notebook for `{choice_file}`...")
32
- exit_then_run_shell_script(script)
33
- return
34
-
35
- # ========================= preparing kwargs_dict
36
- if choice_file.suffix == ".py":
37
- from machineconfig.scripts.python.helpers_fire_command.fire_jobs_args_helper import extract_kwargs
38
- kwargs_dict = extract_kwargs(args) # This now returns empty dict, but kept for compatibility
39
- else:
40
- kwargs_dict = {}
41
-
42
- # ========================= choosing function to run
43
- choice_function: Optional[str] = None # Initialize to avoid unbound variable
44
- if args.choose_function:
45
- from machineconfig.scripts.python.helpers_fire_command.fire_jobs_route_helper import choose_function_or_lines
46
-
47
- choice_function, choice_file, kwargs_dict = choose_function_or_lines(choice_file, kwargs_dict)
48
- else:
49
- choice_function = args.function
50
-
51
- if choice_file.suffix == ".py":
52
- module_line = "-m" if args.module else ""
53
- with_project = f"--project {repo_root} " if repo_root is not None else ""
54
- interactive_line = "-i" if args.interactive else ""
55
- if args.interactive:
56
- from machineconfig.utils.ve import get_ve_path_and_ipython_profile
57
- _ve_root_from_file, ipy_profile = get_ve_path_and_ipython_profile(init_path=choice_file)
58
- if ipy_profile is None:
59
- ipy_profile = "default"
60
- ipython_line = f"--no-banner --profile {ipy_profile} "
61
- else:
62
- ipython_line = ""
63
-
64
- if args.streamlit:
65
- from machineconfig.scripts.python.helpers_fire_command.fire_jobs_route_helper import get_command_streamlit
66
- interpreter_line = get_command_streamlit(choice_file=choice_file, environment=args.environment, repo_root=repo_root)
67
- elif args.jupyter:
68
- interpreter_line = "jupyter-lab"
69
- else:
70
- interpreter_line = "python" if not args.interactive else "ipython"
71
-
72
- exe_line = f"uv run {with_project} {interpreter_line} {interactive_line} {module_line} {ipython_line}"
73
-
74
-
75
- elif choice_file.suffix == ".ps1" or choice_file.suffix == ".sh":
76
- exe_line = "."
77
- elif choice_file.suffix == "":
78
- exe_line = ""
79
- else:
80
- raise NotImplementedError(f"File type {choice_file.suffix} not supported, in the sense that I don't know how to fire it.")
81
-
82
- if args.module and choice_file.suffix == ".py":
83
- if repo_root is not None:
84
- choice_file_adjusted = ".".join(Path(choice_file).relative_to(repo_root).parts).replace(".py", "")
85
- else:
86
- choice_file_adjusted = ".".join(Path(choice_file).relative_to(Path.cwd()).parts).replace(".py", "")
87
- else:
88
- choice_file_adjusted = str(choice_file)
89
-
90
- if args.script or (args.debug and args.choose_function):
91
- # because debugging tools do not support choosing functions and don't interplay with fire module. So the only way to have debugging and choose function options is to import the file as a module into a new script and run the function of interest there and debug the new script.
92
- assert choice_file.suffix == ".py", f"File must be a python file to be imported as a module. Got {choice_file}"
93
- from machineconfig.scripts.python.helpers_fire_command.file_wrangler import get_import_module_code, wrap_import_in_try_except
94
- from machineconfig.utils.meta import lambda_to_python_script
95
- from machineconfig.utils.code import print_code
96
-
97
- import_code = get_import_module_code(str(choice_file))
98
- import_code_robust = lambda_to_python_script(
99
- lambda: wrap_import_in_try_except(
100
- import_line=import_code, pyfile=str(choice_file), repo_root=str(repo_root) if repo_root is not None else None
101
- ),
102
- in_global=True,
103
- import_module=False,
104
- )
105
- # print(f"🧩 Preparing import code for module import:\n{import_code}")
106
- code_printing = lambda_to_python_script(
107
- lambda: print_code(code=import_code_robust, lexer="python", desc="import as module code"),
108
- in_global=True, import_module=False
109
- )
110
- print(f"🧩 Preparing import code for module import:\n{import_code}")
111
- if choice_function is not None:
112
- calling = f"""res = {choice_function}({("**" + str(kwargs_dict)) if kwargs_dict else ""})"""
113
- else:
114
- calling = """# No function selected to call. You can add your code here."""
115
- choice_file = Path.home().joinpath(f"tmp_results/tmp_scripts/python/{Path(choice_file).parent.name}_{Path(choice_file).stem}_{randstr()}.py")
116
- choice_file.parent.mkdir(parents=True, exist_ok=True)
117
- choice_file.write_text(import_code_robust + "\n" + code_printing + "\n" + calling, encoding="utf-8")
118
-
119
- if args.debug:
120
- import platform
121
- if platform.system() == "Windows":
122
- command = f"{exe_line} -m ipdb {choice_file_adjusted} " # pudb is not available on windows machines, use poor man's debugger instead.
123
- elif platform.system() in ["Linux", "Darwin"]:
124
- command = f"{exe_line} -m pudb {choice_file_adjusted} " # TODO: functions not supported yet in debug mode.
125
- else:
126
- raise NotImplementedError(f"Platform {platform.system()} not supported.")
127
- elif args.module:
128
- # both selected function and kwargs are mentioned in the made up script, therefore no need for fire module.
129
- command = f"{exe_line} {choice_file_adjusted} "
130
- elif choice_function is not None and choice_file.suffix == ".py":
131
- command = f"{exe_line} -m fire {choice_file_adjusted} {choice_function} {fire_args}"
132
- elif args.streamlit:
133
- # for .streamlit config to work, it needs to be in the current directory.
134
- if args.holdDirectory:
135
- command = f"{exe_line} {choice_file}"
136
- else:
137
- command = f"cd {choice_file.parent}\n{exe_line} {choice_file.name}\ncd {Path.cwd()}"
138
- elif args.cmd:
139
- command = rf""" cd /d {choice_file.parent} & {exe_line} {choice_file.name} """
140
- else:
141
- if choice_file.suffix == "":
142
- command = f"{exe_line} {choice_file} {fire_args}"
143
- else:
144
- command = f"{exe_line} {choice_file} "
145
-
146
- if not args.cmd:
147
- pass
148
- else:
149
- new_line = "\n"
150
- command = rf"""start cmd -Argument "/k {command.replace(new_line, " & ")} " """ # this works from powershell
151
- if args.submit_to_cloud:
152
- command = f"""uv run python -m machineconfig.cluster.templates.cli_click --file {choice_file} """
153
- if choice_function is not None:
154
- command += f"--function {choice_function} "
155
-
156
- if args.optimized:
157
- command = command.replace("python ", "python -OO ")
158
-
159
- from rich.panel import Panel
160
- from rich.console import Console
161
- from rich.syntax import Syntax
162
-
163
- console = Console()
164
- if args.zellij_tab is not None:
165
- comman_path__ = Path.home().joinpath(f"tmp_results/tmp_scripts/zellij_commands/{choice_file.stem}_{randstr()}.sh")
166
- comman_path__.parent.mkdir(parents=True, exist_ok=True)
167
- comman_path__.write_text(command, encoding="utf-8")
168
- console.print(Panel(Syntax(command, lexer="shell"), title=f"🔥 fire command @ {comman_path__}: "), style="bold red")
169
- import subprocess
170
-
171
- existing_tab_names = subprocess.run(["zellij", "action", "query-tab-names"], capture_output=True, text=True, check=True).stdout.splitlines()
172
- if args.zellij_tab in existing_tab_names:
173
- print(f"⚠️ Tab name `{args.zellij_tab}` already exists. Please choose a different name.")
174
- args.zellij_tab += f"_{randstr(3)}"
175
- from machineconfig.cluster.sessions_managers.zellij_local import run_command_in_zellij_tab
176
-
177
- command = run_command_in_zellij_tab(command=str(comman_path__), tab_name=args.zellij_tab, cwd=None)
178
- if args.watch:
179
- command = "watchexec --restart --exts py,sh,ps1 " + command
180
- if args.git_pull:
181
- command = f"\ngit -C {choice_file.parent} pull\n" + command
182
- if args.PathExport:
183
- from machineconfig.scripts.python.helpers_fire_command.file_wrangler import add_to_path
184
-
185
- export_line = add_to_path(path_variable="PYTHONPATH", directory=str(repo_root))
186
- command = export_line + "\n" + command
187
- if args.loop:
188
- import platform
189
- if platform.system() in ["Linux", "Darwin"]:
190
- command = command + "\nsleep 0.5"
191
- elif platform.system() == "Windows":
192
- command = "$ErrorActionPreference = 'SilentlyContinue';\n" + command + "\nStart-Sleep -Seconds 0.5"
193
- else:
194
- raise NotImplementedError(f"Platform {platform.system()} not supported.")
195
- from machineconfig.utils.code import exit_then_run_shell_script
196
- exit_then_run_shell_script(script=command, strict=False)
197
-
198
-
199
7
  def fire(
200
8
  ctx: typer.Context,
201
9
  path: Annotated[str, typer.Argument(help="Path to the Python file to run")] = ".",
@@ -216,17 +24,15 @@ def fire(
216
24
  remote: Annotated[bool, typer.Option("--remote", "-r", help="Launch on a remote machine")] = False,
217
25
  streamlit: Annotated[bool, typer.Option("--streamlit", "-S", help="Run as streamlit app")] = False,
218
26
  environment: Annotated[str, typer.Option("--environment", "-E", help="Choose ip, localhost, hostname or arbitrary url")] = "",
219
- holdDirectory: Annotated[
220
- bool, typer.Option("--holdDirectory", "-D", help="Hold current directory and avoid cd'ing to the script directory")
221
- ] = False,
27
+ holdDirectory: Annotated[bool, typer.Option("--holdDirectory", "-D", help="Hold current directory and avoid cd'ing to the script directory")] = False,
222
28
  PathExport: Annotated[bool, typer.Option("--PathExport", "-P", help="Augment the PYTHONPATH with repo root")] = False,
223
29
  git_pull: Annotated[bool, typer.Option("--git-pull", "-g", help="Start by pulling the git repo")] = False,
224
30
  watch: Annotated[bool, typer.Option("--watch", "-w", help="Watch the file for changes")] = False,
225
31
  ) -> None:
226
32
  """Main function to process fire jobs arguments."""
33
+ from machineconfig.scripts.python.helpers.helpers_fire_command.fire_jobs_args_helper import FireJobArgs, parse_fire_args_from_context
34
+ from machineconfig.scripts.python.helpers.helpers_fire_command.fire_jobs_impl import route
227
35
 
228
- # Get Fire arguments from context
229
- from machineconfig.scripts.python.helpers_fire_command.fire_jobs_args_helper import FireJobArgs, parse_fire_args_from_context
230
36
  fire_args = parse_fire_args_from_context(ctx)
231
37
 
232
38
  args = FireJobArgs(
@@ -256,28 +62,23 @@ def fire(
256
62
  try:
257
63
  route(args, fire_args)
258
64
  except SystemExit:
259
- # Re-raise SystemExit to preserve exit codes and allow clean exits
260
65
  raise
261
66
  except Exception as e:
262
- # For other exceptions, print clean error message and exit
263
67
  import sys
264
-
265
68
  print(f"❌ Error: {e}", file=sys.stderr)
266
69
  sys.exit(1)
267
70
 
268
71
 
269
- def get_app():
270
- from typer import Typer
271
-
272
- app = Typer(add_completion=False)
72
+ def get_app() -> typer.Typer:
73
+ app = typer.Typer(add_completion=False)
273
74
  app.command(context_settings={"allow_extra_args": True, "allow_interspersed_args": False})(fire)
274
75
  return app
275
76
 
276
77
 
277
- def main():
78
+ def main() -> None:
278
79
  app = get_app()
279
80
  app()
280
81
 
281
82
 
282
83
  if __name__ == "__main__":
283
- from machineconfig.scripts.python.helpers_fire_command.fire_jobs_args_helper import FireJobArgs
84
+ pass