machineconfig 2.1__py3-none-any.whl โ†’ 2.3__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 (127) hide show
  1. machineconfig/cluster/sessions_managers/enhanced_command_runner.py +0 -2
  2. machineconfig/cluster/sessions_managers/layout_types.py +29 -0
  3. machineconfig/cluster/sessions_managers/wt_local.py +68 -62
  4. machineconfig/cluster/sessions_managers/wt_local_manager.py +51 -22
  5. machineconfig/cluster/sessions_managers/wt_remote.py +30 -108
  6. machineconfig/cluster/sessions_managers/wt_remote_manager.py +14 -11
  7. machineconfig/cluster/sessions_managers/wt_utils/layout_generator.py +33 -37
  8. machineconfig/cluster/sessions_managers/wt_utils/process_monitor.py +22 -17
  9. machineconfig/cluster/sessions_managers/wt_utils/session_manager.py +59 -10
  10. machineconfig/cluster/sessions_managers/wt_utils/status_reporter.py +16 -14
  11. machineconfig/cluster/sessions_managers/zellij_local.py +75 -57
  12. machineconfig/cluster/sessions_managers/zellij_local_manager.py +51 -23
  13. machineconfig/cluster/sessions_managers/zellij_remote.py +47 -27
  14. machineconfig/cluster/sessions_managers/zellij_remote_manager.py +13 -12
  15. machineconfig/cluster/sessions_managers/zellij_utils/example_usage.py +14 -10
  16. machineconfig/cluster/sessions_managers/zellij_utils/layout_generator.py +31 -15
  17. machineconfig/cluster/sessions_managers/zellij_utils/process_monitor.py +47 -21
  18. machineconfig/cluster/sessions_managers/zellij_utils/session_manager.py +1 -1
  19. machineconfig/cluster/sessions_managers/zellij_utils/status_reporter.py +8 -7
  20. machineconfig/cluster/templates/utils.py +0 -35
  21. machineconfig/jobs/python/check_installations.py +1 -1
  22. machineconfig/jobs/python_custom_installers/dev/code.py +0 -13
  23. machineconfig/jobs/python_generic_installers/config.json +1 -1
  24. machineconfig/profile/create.py +13 -4
  25. machineconfig/profile/create_hardlinks.py +3 -1
  26. machineconfig/profile/shell.py +8 -7
  27. machineconfig/scripts/__init__.py +0 -2
  28. machineconfig/scripts/linux/devops +6 -4
  29. machineconfig/scripts/python/ai/generate_files.py +14 -15
  30. machineconfig/scripts/python/ai/mcinit.py +8 -5
  31. machineconfig/scripts/python/archive/tmate_conn.py +5 -5
  32. machineconfig/scripts/python/archive/tmate_start.py +7 -7
  33. machineconfig/scripts/python/choose_wezterm_theme.py +35 -32
  34. machineconfig/scripts/python/cloud_copy.py +22 -13
  35. machineconfig/scripts/python/cloud_mount.py +35 -23
  36. machineconfig/scripts/python/cloud_repo_sync.py +38 -25
  37. machineconfig/scripts/python/cloud_sync.py +4 -4
  38. machineconfig/scripts/python/croshell.py +37 -28
  39. machineconfig/scripts/python/devops.py +46 -27
  40. machineconfig/scripts/python/devops_add_identity.py +15 -25
  41. machineconfig/scripts/python/devops_add_ssh_key.py +7 -7
  42. machineconfig/scripts/python/devops_backup_retrieve.py +17 -15
  43. machineconfig/scripts/python/devops_devapps_install.py +26 -20
  44. machineconfig/scripts/python/devops_update_repos.py +142 -57
  45. machineconfig/scripts/python/dotfile.py +16 -14
  46. machineconfig/scripts/python/fire_agents.py +30 -23
  47. machineconfig/scripts/python/fire_jobs.py +86 -98
  48. machineconfig/scripts/python/fire_jobs_args_helper.py +84 -0
  49. machineconfig/scripts/python/fire_jobs_layout_helper.py +66 -0
  50. machineconfig/scripts/python/ftpx.py +24 -14
  51. machineconfig/scripts/python/get_zellij_cmd.py +8 -7
  52. machineconfig/scripts/python/helpers/cloud_helpers.py +33 -28
  53. machineconfig/scripts/python/helpers/helpers2.py +25 -14
  54. machineconfig/scripts/python/helpers/helpers4.py +44 -31
  55. machineconfig/scripts/python/helpers/helpers5.py +1 -1
  56. machineconfig/scripts/python/helpers/repo_sync_helpers.py +31 -9
  57. machineconfig/scripts/python/mount_nfs.py +8 -15
  58. machineconfig/scripts/python/mount_nw_drive.py +10 -5
  59. machineconfig/scripts/python/mount_ssh.py +8 -6
  60. machineconfig/scripts/python/repos.py +215 -57
  61. machineconfig/scripts/python/snapshot.py +0 -1
  62. machineconfig/scripts/python/start_slidev.py +10 -5
  63. machineconfig/scripts/python/start_terminals.py +22 -16
  64. machineconfig/scripts/python/viewer_template.py +0 -1
  65. machineconfig/scripts/python/wifi_conn.py +49 -76
  66. machineconfig/scripts/python/wsl_windows_transfer.py +8 -6
  67. machineconfig/settings/lf/linux/lfrc +1 -0
  68. machineconfig/setup_linux/web_shortcuts/croshell.sh +5 -0
  69. machineconfig/setup_linux/web_shortcuts/interactive.sh +1 -1
  70. machineconfig/setup_linux/web_shortcuts/ssh.sh +0 -4
  71. machineconfig/setup_windows/wt_and_pwsh/set_pwsh_theme.py +3 -12
  72. machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py +1 -1
  73. machineconfig/utils/code.py +2 -3
  74. machineconfig/utils/installer.py +2 -2
  75. machineconfig/utils/installer_utils/installer_abc.py +2 -4
  76. machineconfig/utils/installer_utils/installer_class.py +6 -4
  77. machineconfig/utils/links.py +103 -33
  78. machineconfig/utils/notifications.py +52 -38
  79. machineconfig/utils/options.py +14 -21
  80. machineconfig/utils/path.py +12 -12
  81. machineconfig/utils/path_reduced.py +239 -200
  82. machineconfig/utils/procs.py +1 -1
  83. machineconfig/utils/source_of_truth.py +27 -0
  84. machineconfig/utils/ssh.py +9 -19
  85. machineconfig/utils/terminal.py +4 -2
  86. machineconfig/utils/upgrade_packages.py +91 -0
  87. machineconfig/utils/utils2.py +1 -2
  88. machineconfig/utils/utils5.py +23 -11
  89. machineconfig/utils/ve.py +4 -1
  90. {machineconfig-2.1.dist-info โ†’ machineconfig-2.3.dist-info}/METADATA +13 -13
  91. {machineconfig-2.1.dist-info โ†’ machineconfig-2.3.dist-info}/RECORD +105 -121
  92. machineconfig-2.3.dist-info/entry_points.txt +2 -0
  93. machineconfig/cluster/sessions_managers/archive/create_zellij_template.py +0 -59
  94. machineconfig/cluster/sessions_managers/archive/session_managers.py +0 -183
  95. machineconfig/cluster/sessions_managers/demo_rich_zellij.py +0 -0
  96. machineconfig/jobs/__pycache__/__init__.cpython-313.pyc +0 -0
  97. machineconfig/jobs/python_custom_installers/__pycache__/__init__.cpython-313.pyc +0 -0
  98. machineconfig/jobs/python_generic_installers/__pycache__/__init__.cpython-313.pyc +0 -0
  99. machineconfig/jobs/python_linux_installers/__pycache__/__init__.cpython-313.pyc +0 -0
  100. machineconfig/scripts/__pycache__/__init__.cpython-313.pyc +0 -0
  101. machineconfig/scripts/python/__pycache__/__init__.cpython-313.pyc +0 -0
  102. machineconfig/scripts/python/__pycache__/croshell.cpython-313.pyc +0 -0
  103. machineconfig/scripts/python/__pycache__/devops.cpython-313.pyc +0 -0
  104. machineconfig/scripts/python/__pycache__/devops_devapps_install.cpython-313.pyc +0 -0
  105. machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-313.pyc +0 -0
  106. machineconfig/scripts/python/__pycache__/fire_jobs.cpython-313.pyc +0 -0
  107. machineconfig/scripts/python/ai/__pycache__/__init__.cpython-313.pyc +0 -0
  108. machineconfig/scripts/python/ai/__pycache__/generate_files.cpython-313.pyc +0 -0
  109. machineconfig/scripts/python/ai/__pycache__/mcinit.cpython-313.pyc +0 -0
  110. machineconfig/scripts/python/helpers/__pycache__/__init__.cpython-313.pyc +0 -0
  111. machineconfig/scripts/python/helpers/__pycache__/helpers4.cpython-313.pyc +0 -0
  112. machineconfig/setup_linux/web_shortcuts/all.sh +0 -48
  113. machineconfig/setup_linux/web_shortcuts/update_system.sh +0 -48
  114. machineconfig/utils/utils.py +0 -97
  115. /machineconfig/cluster/{cloud_manager.py โ†’ remote/cloud_manager.py} +0 -0
  116. /machineconfig/cluster/{data_transfer.py โ†’ remote/data_transfer.py} +0 -0
  117. /machineconfig/cluster/{distribute.py โ†’ remote/distribute.py} +0 -0
  118. /machineconfig/cluster/{file_manager.py โ†’ remote/file_manager.py} +0 -0
  119. /machineconfig/cluster/{job_params.py โ†’ remote/job_params.py} +0 -0
  120. /machineconfig/cluster/{loader_runner.py โ†’ remote/loader_runner.py} +0 -0
  121. /machineconfig/cluster/{remote_machine.py โ†’ remote/remote_machine.py} +0 -0
  122. /machineconfig/cluster/{script_execution.py โ†’ remote/script_execution.py} +0 -0
  123. /machineconfig/cluster/{script_notify_upon_completion.py โ†’ remote/script_notify_upon_completion.py} +0 -0
  124. /machineconfig/{cluster/sessions_managers/archive/__init__.py โ†’ scripts/python/fire_jobs_streamlit_helper.py} +0 -0
  125. /machineconfig/setup_linux/web_shortcuts/{tmp.sh โ†’ android.sh} +0 -0
  126. {machineconfig-2.1.dist-info โ†’ machineconfig-2.3.dist-info}/WHEEL +0 -0
  127. {machineconfig-2.1.dist-info โ†’ machineconfig-2.3.dist-info}/top_level.txt +0 -0
@@ -1,8 +1,7 @@
1
- """Script to start terminals on windows and wsl
2
- """
1
+ """Script to start terminals on windows and wsl"""
3
2
 
4
- from machineconfig.utils.utils import PROGRAM_PATH, display_options
5
- from machineconfig.utils.options import get_ssh_hosts
3
+ from machineconfig.utils.source_of_truth import PROGRAM_PATH
4
+ from machineconfig.utils.options import display_options, get_ssh_hosts
6
5
  import platform
7
6
  from itertools import cycle
8
7
  from typing import Literal
@@ -23,15 +22,15 @@ THIS_MACHINE_HOSTNAME = platform.node()
23
22
  THIS_MACHINE_HOSTNAME_WSL = f"{THIS_MACHINE_HOSTNAME}wsl"
24
23
 
25
24
 
26
- def main_windows_and_wsl(window: int, hosts: list[str], orientation: ORIENTATION_TYPE = "vertical", mprocs: bool=False):
25
+ def main_windows_and_wsl(window: int, hosts: list[str], orientation: ORIENTATION_TYPE = "vertical", mprocs: bool = False):
27
26
  print("\n๐Ÿ”ง Configuring terminal layout for Windows and WSL...")
28
27
  orientation_oposite = "horizontal" if orientation == "vertical" else "vertical"
29
- orientation_swap = "up" if orientation == "horizontal" else "left"
28
+ orientation_swap = "up" if orientation == "horizontal" else "left"
30
29
  orientation_opposite_move_focus = "up" if orientation_oposite == "horizontal" else "left"
31
30
  orientation_opposite_move_focus_other = "down" if orientation_oposite == "horizontal" else "right"
32
31
  sleep = 3
33
32
  sep = f"\nsleep {sleep}; wt --window {window}" # or '`;'
34
- ssh_cmd = "-t 'mprocs'" if mprocs else '' # 'wsl_ssh_windows_port_forwarding.ps1'
33
+ ssh_cmd = "-t 'mprocs'" if mprocs else "" # 'wsl_ssh_windows_port_forwarding.ps1'
35
34
  split_per_machine = 1 / len(hosts)
36
35
  size = 0.3
37
36
  known_hosts = get_ssh_hosts()
@@ -48,26 +47,33 @@ wt --window {window} --title {hosts[0]} powershell -Command "ssh {host_linux} {s
48
47
 
49
48
  elif len(hosts) > 1:
50
49
  print("๐Ÿ–ฅ๏ธ Multiple hosts detected. Configuring layout...")
51
- pane_cmd = f'powershell -Command "ssh {hosts[0]} {ssh_cmd}" ' if hosts[0] != THIS_MACHINE else ''
50
+ pane_cmd = f'powershell -Command "ssh {hosts[0]} {ssh_cmd}" ' if hosts[0] != THIS_MACHINE else ""
52
51
  cmd = f"""wt --window {window} --title {hosts[0]} {pane_cmd} """
53
52
  for a_host in hosts[1:]:
54
- if a_host != THIS_MACHINE: pane_cmd = f'powershell -Command "ssh {a_host} {ssh_cmd}" '
55
- else: pane_cmd = 'powershell'
53
+ if a_host != THIS_MACHINE:
54
+ pane_cmd = f'powershell -Command "ssh {a_host} {ssh_cmd}" '
55
+ else:
56
+ pane_cmd = "powershell"
56
57
  cmd += f"""{sep} split-pane --{orientation_oposite} --title {a_host}Windows --size {split_per_machine} {pane_cmd} """
57
58
  for idx, a_host in enumerate(hosts[::-1]):
58
- if f"{a_host}wsl" not in known_hosts and a_host != THIS_MACHINE: continue
59
- pane_cmd = f'powershell -Command "ssh {a_host}wsl"' if a_host != THIS_MACHINE else 'wsl'
60
- if idx == 0: tmp = ''
61
- else: tmp = f"move-focus {orientation_opposite_move_focus}" if idx % 2 == 1 else f"move-focus {orientation_opposite_move_focus_other}"
59
+ if f"{a_host}wsl" not in known_hosts and a_host != THIS_MACHINE:
60
+ continue
61
+ pane_cmd = f'powershell -Command "ssh {a_host}wsl"' if a_host != THIS_MACHINE else "wsl"
62
+ if idx == 0:
63
+ tmp = ""
64
+ else:
65
+ tmp = f"move-focus {orientation_opposite_move_focus}" if idx % 2 == 1 else f"move-focus {orientation_opposite_move_focus_other}"
62
66
  cmd += f"""{sep} {tmp} split-pane --{orientation} --title {a_host}wsl --size {size} {pane_cmd} """
63
67
  cmd += f"""{sep} swap-pane {orientation_swap} """
64
- else: raise NotImplementedError(f"โŒ len(hosts) = {len(hosts)}. Only 1 or 2 hosts are supported.")
68
+ else:
69
+ raise NotImplementedError(f"โŒ len(hosts) = {len(hosts)}. Only 1 or 2 hosts are supported.")
65
70
  print("โœ… Terminal layout configured successfully!\n")
66
71
  return cmd
67
72
 
68
73
 
69
74
  def main():
70
75
  import argparse
76
+
71
77
  print("\n" + "=" * 50)
72
78
  print("๐Ÿ–ฅ๏ธ Welcome to the Terminal Starter Tool")
73
79
  print("=" * 50 + "\n")
@@ -109,5 +115,5 @@ def main():
109
115
  print("โœ… Command saved successfully!\n")
110
116
 
111
117
 
112
- if __name__ == '__main__':
118
+ if __name__ == "__main__":
113
119
  main()
@@ -1,4 +1,3 @@
1
-
2
1
  # import streamlit as st
3
2
  # import plotly.express as px
4
3
  # import plotly.graph_objects as go
@@ -43,59 +43,45 @@ from rich.table import Table
43
43
 
44
44
  console = Console()
45
45
 
46
+
46
47
  def get_available_networks() -> List[Dict[str, str]]:
47
48
  """Get list of available WiFi networks"""
48
49
  networks = []
49
50
 
50
51
  try:
51
52
  if platform.system() == "Windows":
52
- result = subprocess.run(
53
- ["netsh", "wlan", "show", "profiles"],
54
- capture_output=True, text=True, check=True
55
- )
56
-
57
- for line in result.stdout.split('\n'):
58
- if 'All User Profile' in line:
59
- ssid = line.split(':')[1].strip()
53
+ result = subprocess.run(["netsh", "wlan", "show", "profiles"], capture_output=True, text=True, check=True)
54
+
55
+ for line in result.stdout.split("\n"):
56
+ if "All User Profile" in line:
57
+ ssid = line.split(":")[1].strip()
60
58
  networks.append({"ssid": ssid, "signal": "Unknown"})
61
59
 
62
60
  # Also get available networks
63
- result = subprocess.run(
64
- ["netsh", "wlan", "show", "networks"],
65
- capture_output=True, text=True, check=True
66
- )
61
+ result = subprocess.run(["netsh", "wlan", "show", "networks"], capture_output=True, text=True, check=True)
67
62
 
68
63
  current_ssid = None
69
- for line in result.stdout.split('\n'):
70
- if 'SSID' in line and 'BSSID' not in line:
71
- current_ssid = line.split(':')[1].strip()
72
- elif 'Signal' in line and current_ssid:
73
- signal = line.split(':')[1].strip()
64
+ for line in result.stdout.split("\n"):
65
+ if "SSID" in line and "BSSID" not in line:
66
+ current_ssid = line.split(":")[1].strip()
67
+ elif "Signal" in line and current_ssid:
68
+ signal = line.split(":")[1].strip()
74
69
  # Avoid duplicates
75
- if not any(net['ssid'] == current_ssid for net in networks):
70
+ if not any(net["ssid"] == current_ssid for net in networks):
76
71
  networks.append({"ssid": current_ssid, "signal": signal})
77
72
  current_ssid = None
78
73
 
79
74
  elif platform.system() in ["Linux", "Darwin"]:
80
75
  if platform.system() == "Linux":
81
- result = subprocess.run(
82
- ["nmcli", "-t", "-f", "SSID,SIGNAL", "device", "wifi", "list"],
83
- capture_output=True, text=True, check=True
84
- )
76
+ result = subprocess.run(["nmcli", "-t", "-f", "SSID,SIGNAL", "device", "wifi", "list"], capture_output=True, text=True, check=True)
85
77
  else: # Darwin/macOS - using airport command
86
- result = subprocess.run(
87
- ["/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport", "-s"],
88
- capture_output=True, text=True, check=True
89
- )
90
-
91
- for line in result.stdout.strip().split('\n'):
92
- if line and ':' in line:
93
- parts = line.split(':')
78
+ result = subprocess.run(["/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport", "-s"], capture_output=True, text=True, check=True)
79
+
80
+ for line in result.stdout.strip().split("\n"):
81
+ if line and ":" in line:
82
+ parts = line.split(":")
94
83
  if len(parts) >= 2 and parts[0].strip():
95
- networks.append({
96
- "ssid": parts[0].strip(),
97
- "signal": f"{parts[1].strip()}%"
98
- })
84
+ networks.append({"ssid": parts[0].strip(), "signal": f"{parts[1].strip()}%"})
99
85
 
100
86
  except subprocess.CalledProcessError as e:
101
87
  console.print(f"[red]โŒ Error scanning networks: {e}[/red]")
@@ -106,13 +92,14 @@ def get_available_networks() -> List[Dict[str, str]]:
106
92
  seen = set()
107
93
  unique_networks = []
108
94
  for net in networks:
109
- ssid = net['ssid']
95
+ ssid = net["ssid"]
110
96
  if ssid and ssid not in seen:
111
97
  seen.add(ssid)
112
98
  unique_networks.append(net)
113
99
 
114
100
  return unique_networks
115
101
 
102
+
116
103
  def display_and_select_network() -> Optional[Dict[str, str]]:
117
104
  """Display available networks and let user select one"""
118
105
  console.print("\n[blue]๐Ÿ“ก Scanning for available WiFi networks...[/blue]")
@@ -130,18 +117,15 @@ def display_and_select_network() -> Optional[Dict[str, str]]:
130
117
  table.add_column("Signal Strength", style="yellow")
131
118
 
132
119
  for i, network in enumerate(networks, 1):
133
- table.add_row(str(i), network['ssid'], network['signal'])
120
+ table.add_row(str(i), network["ssid"], network["signal"])
134
121
 
135
122
  console.print(table)
136
123
 
137
124
  # Let user select
138
125
  try:
139
- choice = Prompt.ask(
140
- "\n[blue]Select network number (or 'q' to quit)[/blue]",
141
- default="q"
142
- )
126
+ choice = Prompt.ask("\n[blue]Select network number (or 'q' to quit)[/blue]", default="q")
143
127
 
144
- if choice.lower() == 'q':
128
+ if choice.lower() == "q":
145
129
  return None
146
130
 
147
131
  index = int(choice) - 1
@@ -154,16 +138,15 @@ def display_and_select_network() -> Optional[Dict[str, str]]:
154
138
  except ValueError:
155
139
  console.print("[red]โŒ Invalid input. Please enter a number.[/red]")
156
140
  return None
141
+
142
+
157
143
  def connect(name: str, ssid: str):
158
144
  """Connect to a WiFi network"""
159
145
  console.print(f"\n[blue]๐ŸŒ Connecting to network: {name} (SSID: {ssid})[/blue]")
160
146
 
161
147
  try:
162
148
  if platform.system() == "Windows":
163
- subprocess.run(
164
- ["netsh", "wlan", "connect", f"name={name}", f"ssid={ssid}", "interface=Wi-Fi"],
165
- capture_output=True, text=True, check=True
166
- )
149
+ subprocess.run(["netsh", "wlan", "connect", f"name={name}", f"ssid={ssid}", "interface=Wi-Fi"], capture_output=True, text=True, check=True)
167
150
  elif platform.system() == "Linux":
168
151
  subprocess.run(f"nmcli connection up '{name}'", shell=True, check=True)
169
152
 
@@ -176,6 +159,7 @@ def connect(name: str, ssid: str):
176
159
  console.print(f"[red]โŒ Unexpected error: {e}[/red]")
177
160
  raise
178
161
 
162
+
179
163
  def connect_to_new_network(ssid: str, password: str):
180
164
  """Connect to a new network with SSID and password"""
181
165
  try:
@@ -199,10 +183,10 @@ def connect_to_new_network(ssid: str, password: str):
199
183
  console.print(f"[red]โŒ Failed to connect to {ssid}: {e}[/red]")
200
184
  raise
201
185
 
186
+
202
187
  def display_available_networks():
203
188
  """Display available networks (legacy function for compatibility)"""
204
189
  console.print("\n[blue]๐Ÿ“ก Scanning for available networks...[/blue]")
205
-
206
190
  try:
207
191
  if platform.system() == "Windows":
208
192
  subprocess.run(["netsh", "wlan", "show", "networks", "interface=Wi-Fi"], check=True)
@@ -216,14 +200,11 @@ def display_available_networks():
216
200
  except Exception as e:
217
201
  console.print(f"[red]โŒ Unexpected error: {e}[/red]")
218
202
 
203
+
219
204
  def try_config_connection(config_ssid: str) -> bool:
220
205
  """Try to connect using configuration file"""
221
206
  try:
222
- config_paths = [
223
- Path.home() / 'dotfiles/machineconfig/setup/wifi.ini',
224
- Path.home() / '.config/wifi.ini',
225
- Path.cwd() / 'wifi.ini'
226
- ]
207
+ config_paths = [Path.home() / "dotfiles/machineconfig/setup/wifi.ini", Path.home() / ".config/wifi.ini", Path.cwd() / "wifi.ini"]
227
208
 
228
209
  creds = configparser.ConfigParser()
229
210
  config_found = False
@@ -245,8 +226,8 @@ def try_config_connection(config_ssid: str) -> bool:
245
226
  console.print(f"[blue]Available configured networks: {', '.join(available_ssids)}[/blue]")
246
227
  return False
247
228
 
248
- ssid = creds[config_ssid]['SSID']
249
- password = creds[config_ssid]['pwd']
229
+ ssid = creds[config_ssid]["SSID"]
230
+ password = creds[config_ssid]["pwd"]
250
231
 
251
232
  console.print(f"[green]โœ… Found configuration for {config_ssid}[/green]")
252
233
  connect_to_new_network(ssid, password)
@@ -256,6 +237,7 @@ def try_config_connection(config_ssid: str) -> bool:
256
237
  console.print(f"[red]โŒ Error reading configuration: {e}[/red]")
257
238
  return False
258
239
 
240
+
259
241
  def manual_network_selection() -> bool:
260
242
  """Manual network selection and connection"""
261
243
  network = display_and_select_network()
@@ -263,7 +245,7 @@ def manual_network_selection() -> bool:
263
245
  if not network:
264
246
  return False
265
247
 
266
- ssid = network['ssid']
248
+ ssid = network["ssid"]
267
249
  console.print(f"\n[blue]Selected network: {ssid}[/blue]")
268
250
 
269
251
  # Get password from user
@@ -279,18 +261,15 @@ def manual_network_selection() -> bool:
279
261
  except Exception:
280
262
  return False
281
263
 
264
+
282
265
  def main():
283
266
  """Main function with fallback network selection"""
284
- console.print(Panel(
285
- "๐Ÿ“ถ Welcome to the WiFi Connector Tool",
286
- title="[bold blue]WiFi Connection[/bold blue]",
287
- border_style="blue"
288
- ))
267
+ console.print(Panel("๐Ÿ“ถ Welcome to the WiFi Connector Tool", title="[bold blue]WiFi Connection[/bold blue]", border_style="blue"))
289
268
 
290
- parser = argparse.ArgumentParser(description='WiFi Connector')
291
- parser.add_argument('-n', "--ssid", help="๐Ÿ”— SSID of WiFi (from config)", default='MyPhoneHotSpot')
292
- parser.add_argument('-m', "--manual", action='store_true', help="๐Ÿ” Manual network selection mode")
293
- parser.add_argument('-l', "--list", action='store_true', help="๐Ÿ“ก List available networks only")
269
+ parser = argparse.ArgumentParser(description="WiFi Connector")
270
+ parser.add_argument("-n", "--ssid", help="๐Ÿ”— SSID of WiFi (from config)", default="MyPhoneHotSpot")
271
+ parser.add_argument("-m", "--manual", action="store_true", help="๐Ÿ” Manual network selection mode")
272
+ parser.add_argument("-l", "--list", action="store_true", help="๐Ÿ“ก List available networks only")
294
273
 
295
274
  args = parser.parse_args()
296
275
 
@@ -326,16 +305,14 @@ def main():
326
305
  else:
327
306
  console.print("[blue]๐Ÿ‘‹ Goodbye![/blue]")
328
307
 
308
+
329
309
  def get_current_wifi_name() -> str:
330
310
  """Get the name of the currently connected WiFi network"""
331
311
  console.print("\n[blue]๐Ÿ” Checking current WiFi connection...[/blue]")
332
312
 
333
313
  try:
334
314
  if platform.system() == "Windows":
335
- result = subprocess.run(
336
- ["netsh", "wlan", "show", "interface"],
337
- capture_output=True, text=True, check=True
338
- )
315
+ result = subprocess.run(["netsh", "wlan", "show", "interface"], capture_output=True, text=True, check=True)
339
316
 
340
317
  for line in result.stdout.split("\n"):
341
318
  if "SSID" in line and "BSSID" not in line:
@@ -348,10 +325,7 @@ def get_current_wifi_name() -> str:
348
325
  return "Not connected to WiFi"
349
326
 
350
327
  elif platform.system() == "Linux":
351
- result = subprocess.run(
352
- ["iwgetid", "-r"],
353
- capture_output=True, text=True, check=True
354
- )
328
+ result = subprocess.run(["iwgetid", "-r"], capture_output=True, text=True, check=True)
355
329
 
356
330
  wifi_name = result.stdout.strip()
357
331
  if wifi_name:
@@ -371,6 +345,7 @@ def get_current_wifi_name() -> str:
371
345
  console.print("[yellow]โš ๏ธ System not supported[/yellow]\n")
372
346
  return "System not supported"
373
347
 
348
+
374
349
  def create_new_connection(name: str, ssid: str, password: str):
375
350
  """Create a new WiFi connection profile"""
376
351
  console.print(f"\n[blue]๐Ÿ”ง Creating new connection: {name} (SSID: {ssid})[/blue]")
@@ -407,10 +382,7 @@ def create_new_connection(name: str, ssid: str, password: str):
407
382
  profile_path = f"{name}.xml"
408
383
  Path(profile_path).write_text(xml_config, encoding="utf-8")
409
384
 
410
- subprocess.run(
411
- ["netsh", "wlan", "add", "profile", f"filename={profile_path}", "interface=Wi-Fi"],
412
- capture_output=True, text=True, check=True
413
- )
385
+ subprocess.run(["netsh", "wlan", "add", "profile", f"filename={profile_path}", "interface=Wi-Fi"], capture_output=True, text=True, check=True)
414
386
 
415
387
  # Clean up the XML file
416
388
  try:
@@ -439,5 +411,6 @@ def create_new_connection(name: str, ssid: str, password: str):
439
411
  console.print(f"[red]โŒ Unexpected error: {e}[/red]")
440
412
  raise
441
413
 
442
- if __name__ == '__main__':
414
+
415
+ if __name__ == "__main__":
443
416
  main()
@@ -1,5 +1,4 @@
1
- """TWSL
2
- """
1
+ """TWSL"""
3
2
 
4
3
  from machineconfig.utils.path_reduced import PathExtended as PathExtended
5
4
  import argparse
@@ -9,7 +8,7 @@ from pathlib import Path
9
8
 
10
9
  system = platform.system() # e.g. "Windows", "Linux", "Darwin" (macOS)
11
10
  # HostName = platform.node() # e.g. "MY-SURFACE", os.env["COMPUTERNAME") only works for windows.
12
- UserName = getpass.getuser() # e.g: username, os.env["USERNAME") only works for windows.
11
+ UserName = getpass.getuser() # e.g: username, os.env["USERNAME") only works for windows.
13
12
  # UserDomain = os.environ["USERDOMAIN"] # e.g. HAD OR MY-SURFACE
14
13
  # UserDomainRoaming = PathExtended(os.environ["USERDOMAIN_ROAMINGPROFILE"]) # e.g. SURFACE
15
14
  # LogonServer = os.environ["LOGONSERVER"] # e.g. "\\MY-SURFACE"
@@ -26,9 +25,11 @@ def main():
26
25
  print("๐Ÿ”„ Welcome to the WSL-Windows File Transfer Tool")
27
26
  print("=" * 50 + "\n")
28
27
 
29
- parser = argparse.ArgumentParser(description="""๐Ÿ“‚ Move and copy files across WSL & Windows.
28
+ parser = argparse.ArgumentParser(
29
+ description="""๐Ÿ“‚ Move and copy files across WSL & Windows.
30
30
  The direction is automatically determined by sensing the execution environment.
31
- Otherwise, a flag must be raised to indicate the direction.""")
31
+ Otherwise, a flag must be raised to indicate the direction."""
32
+ )
32
33
 
33
34
  # positional argument
34
35
  parser.add_argument("path", help="๐Ÿ“ Path of file/folder to transfer over.")
@@ -57,6 +58,7 @@ Otherwise, a flag must be raised to indicate the direction.""")
57
58
  else:
58
59
  from machineconfig.utils.ssh import SSH
59
60
  import platform
61
+
60
62
  port = int(args.port) if args.port else (2222 if system == "Windows" else 22)
61
63
  username = UserName
62
64
  hostname = platform.node()
@@ -66,5 +68,5 @@ Otherwise, a flag must be raised to indicate the direction.""")
66
68
  print("โœ… SSH transfer completed successfully!\n")
67
69
 
68
70
 
69
- if __name__ == '__main__':
71
+ if __name__ == "__main__":
70
72
  main()
@@ -89,6 +89,7 @@ map wr $~/scripts/croshell
89
89
  map i !~/code/machineconfig/src/machineconfig/settings/lf/linux/exe/previewer.sh $f
90
90
  map I !cat $f | gum pager
91
91
  map R $~/scripts/croshell -r $f
92
+ map O $~/scripts/croshell -rj $f
92
93
 
93
94
 
94
95
  # o file/folder Operations
@@ -2,5 +2,10 @@
2
2
 
3
3
  curl bit.ly/cfgvelinux -L | bash
4
4
  curl bit.ly/cfgreposlinux -L | bash
5
+
6
+ cd $HOME/code/machineconfig
7
+ $HOME/.local/bin/uv sync --no-dev
8
+ $HOME/.local/bin/uv pip install -e ../crocodile
9
+
5
10
  source $HOME/code/machineconfig/src/machineconfig/setup_linux/symlinks.sh
6
11
  . ~/.bashrc
@@ -137,10 +137,10 @@ choice=${choice:-y}
137
137
  if [[ "$choice" == "y" || "$choice" == "Y" ]]; then
138
138
  echo """ ๐Ÿ”ง Installing development tools...
139
139
  """
140
- . $HOME/code/machineconfig/.venv/bin/activate
141
140
  (curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh) || true
142
141
  sudo nala install libssl-dev -y
143
142
  sudo nala install ffmpeg -y
143
+ . $HOME/code/machineconfig/.venv/bin/activate
144
144
  python -m fire machineconfig.scripts.python.devops_devapps_install main --which=wezterm,brave,code
145
145
  else
146
146
  echo """ โญ๏ธ Skipping development tools installation
@@ -1,8 +1,4 @@
1
1
  #!/usr/bin/bash
2
- #=======================================================================
3
- # ๐Ÿ”’ SSH SERVER SETUP SCRIPT
4
- #=======================================================================
5
- # This script sets up SSH server with public key authentication
6
2
 
7
3
  echo """#=======================================================================
8
4
  ๐Ÿ”‘ SSH KEY SETUP | Configuring SSH public key authentication
@@ -5,7 +5,7 @@ https://glitchbone.github.io/vscode-base16-term/#/3024
5
5
  """
6
6
 
7
7
  from machineconfig.utils.path_reduced import PathExtended as PathExtended
8
- from machineconfig.utils.utils import LIBRARY_ROOT
8
+ from machineconfig.utils.source_of_truth import LIBRARY_ROOT
9
9
  from machineconfig.utils.installer_utils.installer_class import Installer
10
10
  import subprocess
11
11
  from typing import Iterable
@@ -23,10 +23,7 @@ nerd_fonts = {
23
23
 
24
24
  # Patterns to match any installed variant (NF, Nerd Font, Mono, Propo, style weights) of Cascadia/Caskaydia
25
25
  # We'll compile them at runtime for flexibility. Keep them simple to avoid false positives.
26
- REQUIRED_FONT_PATTERNS: tuple[str, ...] = (
27
- r"caskaydiacove.*(nf|nerd ?font)",
28
- r"cascadiacode.*(nf|nerd ?font)",
29
- )
26
+ REQUIRED_FONT_PATTERNS: tuple[str, ...] = (r"caskaydiacove.*(nf|nerd ?font)", r"cascadiacode.*(nf|nerd ?font)")
30
27
 
31
28
 
32
29
  def _list_installed_fonts() -> list[str]:
@@ -37,13 +34,7 @@ def _list_installed_fonts() -> list[str]:
37
34
  """
38
35
  try:
39
36
  # Query only base names to make substring matching simpler; remove underscores like the PS script does.
40
- cmd = [
41
- "powershell.exe",
42
- "-NoLogo",
43
- "-NonInteractive",
44
- "-Command",
45
- "Get-ChildItem -Path C:/Windows/Fonts -File | Select-Object -ExpandProperty BaseName"
46
- ]
37
+ cmd = ["powershell.exe", "-NoLogo", "-NonInteractive", "-Command", "Get-ChildItem -Path C:/Windows/Fonts -File | Select-Object -ExpandProperty BaseName"]
47
38
  res = subprocess.run(cmd, capture_output=True, text=True, check=True) # noqa: S603 S607 (trusted command)
48
39
  fonts = [x.strip().replace("_", "") for x in res.stdout.splitlines() if x.strip() != ""]
49
40
  return fonts
@@ -4,7 +4,7 @@ from machineconfig.utils.utils2 import randstr, read_json
4
4
  from machineconfig.utils.path_reduced import PathExtended as PathExtended
5
5
  from machineconfig.utils.io_save import save_json
6
6
  import platform
7
- from machineconfig.utils.utils import LIBRARY_ROOT
7
+ from machineconfig.utils.source_of_truth import LIBRARY_ROOT
8
8
  from uuid import uuid4
9
9
  import os
10
10
  from typing import Any
@@ -4,12 +4,11 @@ import subprocess
4
4
  from rich.console import Console
5
5
  from rich.panel import Panel
6
6
  from rich.syntax import Syntax
7
+
7
8
  from machineconfig.utils.utils2 import randstr
8
9
  from machineconfig.utils.ve import get_ve_activate_line
9
10
  from machineconfig.utils.path_reduced import PathExtended as PathExtended
10
-
11
-
12
- PROGRAM_PATH = PathExtended.home().joinpath("tmp_results", "shells", "python_return_command") + (".ps1" if platform.system() == "Windows" else ".sh")
11
+ from machineconfig.utils.source_of_truth import PROGRAM_PATH
13
12
 
14
13
 
15
14
  def get_shell_script_executing_python_file(python_file: str, func: Optional[str], ve_path: str, strict_execution: bool = True):
@@ -6,7 +6,7 @@ from rich.console import Console
6
6
  from rich.panel import Panel # Added import
7
7
 
8
8
  from machineconfig.utils.path_reduced import PathExtended as PathExtended
9
- from machineconfig.utils.utils import INSTALL_VERSION_ROOT
9
+ from machineconfig.utils.source_of_truth import INSTALL_VERSION_ROOT
10
10
  from machineconfig.utils.utils2 import read_json
11
11
 
12
12
  # from dataclasses import dataclass
@@ -171,7 +171,7 @@ def install_all(installers: list[Installer], safe: bool = False, jobs: int = 10,
171
171
  print(f"\n{'=' * 80}\n๐Ÿš€ BULK INSTALLATION PROCESS ๐Ÿš€\n{'=' * 80}")
172
172
  if fresh:
173
173
  print("๐Ÿงน Fresh install requested - clearing version cache...")
174
- INSTALL_VERSION_ROOT.delete(sure=True)
174
+ PathExtended(INSTALL_VERSION_ROOT).delete(sure=True)
175
175
  print("โœ… Version cache cleared")
176
176
 
177
177
  if safe:
@@ -1,11 +1,9 @@
1
1
  from machineconfig.utils.path_reduced import PathExtended as PathExtended
2
+ from machineconfig.utils.source_of_truth import WINDOWS_INSTALL_PATH, LINUX_INSTALL_PATH
2
3
  from typing import Optional, TypeAlias, Literal
3
4
  import subprocess
4
5
 
5
- # LINUX_INSTALL_PATH = '/usr/local/bin'
6
- # LINUX_INSTALL_PATH = '~/.local/bin'
7
- LINUX_INSTALL_PATH = PathExtended.home().joinpath(".local/bin").__str__()
8
- WINDOWS_INSTALL_PATH = PathExtended.home().joinpath("AppData/Local/Microsoft/WindowsApps").__str__()
6
+
9
7
  CATEGORY: TypeAlias = Literal["OS_SPECIFIC", "OS_GENERIC", "CUSTOM", "OS_SPECIFIC_DEV", "OS_GENERIC_DEV", "CUSTOM_DEV"]
10
8
 
11
9
 
@@ -1,6 +1,7 @@
1
1
  from machineconfig.utils.path_reduced import PathExtended as PathExtended
2
2
  from machineconfig.utils.installer_utils.installer_abc import find_move_delete_linux, find_move_delete_windows
3
- from machineconfig.utils.utils import INSTALL_TMP_DIR, INSTALL_VERSION_ROOT, LIBRARY_ROOT, check_tool_exists
3
+ from machineconfig.utils.source_of_truth import INSTALL_TMP_DIR, INSTALL_VERSION_ROOT, LIBRARY_ROOT
4
+ from machineconfig.utils.options import check_tool_exists
4
5
  from machineconfig.utils.utils2 import pprint, read_json
5
6
 
6
7
  import platform
@@ -61,7 +62,7 @@ class Installer:
61
62
  @staticmethod
62
63
  def choose_app_and_install():
63
64
  print(f"\n{'=' * 80}\n๐Ÿ” SELECT APPLICATION TO INSTALL ๐Ÿ”\n{'=' * 80}")
64
- from machineconfig.utils.utils import choose_one_option
65
+ from machineconfig.utils.options import choose_one_option
65
66
 
66
67
  print("๐Ÿ“‚ Searching for configuration files...")
67
68
  jobs_dir = Path(LIBRARY_ROOT.joinpath("jobs"))
@@ -125,7 +126,8 @@ class Installer:
125
126
  script = "#!/bin/bash" + "\n" + program
126
127
  else:
127
128
  script = program
128
- script_file = PathExtended.tmpfile(name="tmp_shell_script", suffix=".ps1" if platform.system() == "Windows" else ".sh", folder="tmp_scripts").write_text(script, newline=None if platform.system() == "Windows" else "\n")
129
+ script_file = PathExtended.tmpfile(name="tmp_shell_script", suffix=".ps1" if platform.system() == "Windows" else ".sh", folder="tmp_scripts")
130
+ script_file.write_text(script, newline=None if platform.system() == "Windows" else "\n")
129
131
  if platform.system() == "Windows":
130
132
  start_cmd = "powershell"
131
133
  full_command = f"{start_cmd} {script_file}"
@@ -364,7 +366,7 @@ class Installer:
364
366
  if existing_version == version_to_be_installed:
365
367
  print(f"โœ… {exe_name} is up to date (version {version_to_be_installed})")
366
368
  print(f"๐Ÿ“‚ Version information stored at: {INSTALL_VERSION_ROOT}")
367
- return ("โœ… Uptodate", version.strip(), version_to_be_installed.strip())
369
+ return ("โœ… Up to date", version.strip(), version_to_be_installed.strip())
368
370
  else:
369
371
  print(f"๐Ÿ”„ {exe_name} needs update: {existing_version.rstrip()} โ†’ {version_to_be_installed}")
370
372
  tmp_path.write_text(version_to_be_installed, encoding="utf-8")