machineconfig 2.6__py3-none-any.whl → 2.8__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 (120) hide show
  1. machineconfig/cluster/remote/remote_machine.py +0 -1
  2. machineconfig/cluster/sessions_managers/wt_local.py +1 -1
  3. machineconfig/cluster/sessions_managers/wt_local_manager.py +1 -1
  4. machineconfig/cluster/sessions_managers/wt_remote.py +1 -1
  5. machineconfig/cluster/sessions_managers/wt_remote_manager.py +1 -1
  6. machineconfig/cluster/sessions_managers/wt_utils/layout_generator.py +1 -1
  7. machineconfig/cluster/sessions_managers/wt_utils/process_monitor.py +1 -1
  8. machineconfig/cluster/sessions_managers/wt_utils/status_reporter.py +1 -1
  9. machineconfig/cluster/sessions_managers/zellij_local.py +1 -1
  10. machineconfig/cluster/sessions_managers/zellij_local_manager.py +1 -1
  11. machineconfig/cluster/sessions_managers/zellij_remote.py +1 -1
  12. machineconfig/cluster/sessions_managers/zellij_remote_manager.py +1 -1
  13. machineconfig/cluster/sessions_managers/zellij_utils/example_usage.py +1 -1
  14. machineconfig/cluster/sessions_managers/zellij_utils/layout_generator.py +1 -1
  15. machineconfig/cluster/sessions_managers/zellij_utils/process_monitor.py +1 -1
  16. machineconfig/cluster/sessions_managers/zellij_utils/status_reporter.py +1 -1
  17. machineconfig/jobs/__pycache__/__init__.cpython-313.pyc +0 -0
  18. machineconfig/jobs/python/check_installations.py +0 -2
  19. machineconfig/jobs/python/vscode/sync_code.py +0 -1
  20. machineconfig/jobs/python_generic_installers/__pycache__/__init__.cpython-313.pyc +0 -0
  21. machineconfig/jobs/python_linux_installers/__pycache__/__init__.cpython-313.pyc +0 -0
  22. machineconfig/profile/create.py +8 -16
  23. machineconfig/profile/shell.py +140 -179
  24. machineconfig/scripts/__pycache__/__init__.cpython-313.pyc +0 -0
  25. machineconfig/scripts/linux/choose_wezterm_theme +1 -1
  26. machineconfig/scripts/linux/cloud_copy +1 -1
  27. machineconfig/scripts/linux/cloud_mount +1 -1
  28. machineconfig/scripts/linux/cloud_repo_sync +1 -1
  29. machineconfig/scripts/linux/cloud_sync +1 -1
  30. machineconfig/scripts/linux/croshell +2 -1
  31. machineconfig/scripts/linux/devops +1 -1
  32. machineconfig/scripts/linux/fire +1 -1
  33. machineconfig/scripts/linux/fire_agents +1 -1
  34. machineconfig/scripts/linux/ftpx +1 -1
  35. machineconfig/scripts/linux/gh_models +1 -1
  36. machineconfig/scripts/linux/kill_process +1 -1
  37. machineconfig/scripts/linux/mcinit +1 -1
  38. machineconfig/scripts/linux/mount_nfs +1 -1
  39. machineconfig/scripts/linux/mount_nw_drive +1 -11
  40. machineconfig/scripts/linux/repos +1 -1
  41. machineconfig/scripts/linux/scheduler +1 -1
  42. machineconfig/scripts/linux/start_slidev +1 -1
  43. machineconfig/scripts/linux/start_terminals +1 -1
  44. machineconfig/scripts/linux/wifi_conn +1 -1
  45. machineconfig/scripts/python/__pycache__/__init__.cpython-313.pyc +0 -0
  46. machineconfig/scripts/python/__pycache__/cloud_repo_sync.cpython-313.pyc +0 -0
  47. machineconfig/scripts/python/__pycache__/devops.cpython-313.pyc +0 -0
  48. machineconfig/scripts/python/__pycache__/devops_devapps_install.cpython-313.pyc +0 -0
  49. machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-313.pyc +0 -0
  50. machineconfig/scripts/python/__pycache__/get_zellij_cmd.cpython-313.pyc +0 -0
  51. machineconfig/scripts/python/__pycache__/repos.cpython-313.pyc +0 -0
  52. machineconfig/scripts/python/__pycache__/repos_helper_record.cpython-313.pyc +0 -0
  53. machineconfig/scripts/python/ai/mcinit.py +16 -2
  54. machineconfig/scripts/python/ai/scripts/lint_and_type_check.sh +1 -1
  55. machineconfig/scripts/python/croshell.py +0 -1
  56. machineconfig/scripts/python/devops.py +1 -13
  57. machineconfig/scripts/python/devops_devapps_install.py +14 -2
  58. machineconfig/scripts/python/devops_update_repos.py +39 -19
  59. machineconfig/scripts/python/fire_agents.py +1 -1
  60. machineconfig/scripts/python/fire_jobs.py +8 -3
  61. machineconfig/scripts/python/fire_jobs_layout_helper.py +1 -1
  62. machineconfig/scripts/python/helpers/__pycache__/__init__.cpython-313.pyc +0 -0
  63. machineconfig/scripts/python/helpers/__pycache__/repo_sync_helpers.cpython-313.pyc +0 -0
  64. machineconfig/scripts/python/repos.py +10 -227
  65. machineconfig/scripts/python/repos_helper_record.py +270 -0
  66. machineconfig/scripts/windows/choose_wezterm_theme.ps1 +1 -1
  67. machineconfig/scripts/windows/cloud_copy.ps1 +1 -1
  68. machineconfig/scripts/windows/cloud_mount.ps1 +1 -1
  69. machineconfig/scripts/windows/cloud_repo_sync.ps1 +1 -1
  70. machineconfig/scripts/windows/cloud_sync.ps1 +1 -1
  71. machineconfig/scripts/windows/croshell.ps1 +1 -1
  72. machineconfig/scripts/windows/devops.ps1 +1 -29
  73. machineconfig/scripts/windows/dotfile.ps1 +1 -1
  74. machineconfig/scripts/windows/fire.ps1 +1 -45
  75. machineconfig/scripts/windows/ftpx.ps1 +1 -1
  76. machineconfig/scripts/windows/gpt.ps1 +1 -23
  77. machineconfig/scripts/windows/kill_process.ps1 +1 -1
  78. machineconfig/scripts/windows/mcinit.ps1 +1 -1
  79. machineconfig/scripts/windows/mount_ssh.ps1 +1 -1
  80. machineconfig/scripts/windows/pomodoro.ps1 +1 -1
  81. machineconfig/scripts/windows/repos.ps1 +1 -1
  82. machineconfig/scripts/windows/scheduler.ps1 +1 -1
  83. machineconfig/scripts/windows/snapshot.ps1 +1 -1
  84. machineconfig/scripts/windows/start_slidev.ps1 +1 -1
  85. machineconfig/scripts/windows/start_terminals.ps1 +1 -1
  86. machineconfig/scripts/windows/wifi_conn.ps1 +1 -2
  87. machineconfig/settings/shells/pwsh/init.ps1 +0 -4
  88. machineconfig/setup_linux/web_shortcuts/croshell.sh +1 -1
  89. machineconfig/setup_linux/web_shortcuts/interactive.sh +7 -13
  90. machineconfig/setup_windows/web_shortcuts/interactive.ps1 +9 -18
  91. machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py +1 -66
  92. machineconfig/utils/links.py +1 -2
  93. machineconfig/utils/options.py +8 -5
  94. machineconfig/utils/procs.py +50 -31
  95. machineconfig/utils/scheduling.py +0 -1
  96. machineconfig/{cluster/sessions_managers → utils/schemas/layouts}/layout_types.py +0 -1
  97. machineconfig/utils/schemas/repos/repos_types.py +28 -0
  98. machineconfig/utils/source_of_truth.py +1 -4
  99. machineconfig/utils/ssh.py +30 -8
  100. {machineconfig-2.6.dist-info → machineconfig-2.8.dist-info}/METADATA +1 -2
  101. {machineconfig-2.6.dist-info → machineconfig-2.8.dist-info}/RECORD +105 -112
  102. {machineconfig-2.6.dist-info → machineconfig-2.8.dist-info}/entry_points.txt +1 -1
  103. machineconfig/jobs/python_custom_installers/__pycache__/__init__.cpython-313.pyc +0 -0
  104. machineconfig/profile/create_hardlinks.py +0 -140
  105. machineconfig/scripts/linux/checkout_versions +0 -2
  106. machineconfig/scripts/linux/cloud_manager +0 -2
  107. machineconfig/scripts/linux/url2md +0 -2
  108. machineconfig/scripts/python/__pycache__/croshell.cpython-313.pyc +0 -0
  109. machineconfig/scripts/windows/checkout_version.ps1 +0 -1
  110. machineconfig/scripts/windows/cloud_manager.ps1 +0 -1
  111. machineconfig/scripts/windows/neofetch.ps1 +0 -2
  112. machineconfig/scripts/windows/wsl_windows_transfer.ps1 +0 -1
  113. machineconfig/settings/__pycache__/__init__.cpython-313.pyc +0 -0
  114. machineconfig/settings/shells/ipy/profiles/default/__pycache__/__init__.cpython-313.pyc +0 -0
  115. machineconfig/settings/shells/ipy/profiles/default/startup/__pycache__/__init__.cpython-313.pyc +0 -0
  116. machineconfig/utils/ai/browser_user_wrapper.py +0 -66
  117. machineconfig/utils/ai/url2md.py +0 -85
  118. /machineconfig/setup_windows/wt_and_pwsh/{set_pwsh_theme.py → install_nerd_fonts.py} +0 -0
  119. {machineconfig-2.6.dist-info → machineconfig-2.8.dist-info}/WHEEL +0 -0
  120. {machineconfig-2.6.dist-info → machineconfig-2.8.dist-info}/top_level.txt +0 -0
@@ -1,23 +1 @@
1
-
2
-
3
- . "$HOME\code\machineconfig\.venv\Scripts\activate.ps1"
4
-
5
- $op_script = "~/tmp_results/shells/python_return_command.ps1"
6
- if (Test-Path $op_script ) {
7
- Remove-Item $op_script
8
- }
9
-
10
-
11
- python -m machineconfig.scripts.python.chatgpt $args
12
-
13
- if (Test-Path $op_script ) {
14
- cat $op_script
15
- . $op_script
16
- }
17
- else
18
- {
19
- Write-Host "No output script to be executed @ $op_script"
20
- }
21
-
22
-
23
- deactivate
1
+ uv run --python 3.13 --no-dev --project $HOME/code/machineconfig chatgpt $args
@@ -1 +1 @@
1
- uv run --python 3.13 --with machineconfig python -c "from machineconfig.utils.procs import ProcessManager; ProcessManager().choose_and_kill()"
1
+ uv run --python 3.13 --no-dev --project $HOME/code/machineconfig kill_process $args
@@ -1 +1 @@
1
- uv run --python 3.13 --with machineconfig python -m machineconfig.scripts.python.ai.mcinit $args
1
+ uv run --python 3.13 --no-dev --project $HOME/code/machineconfig mcinit $args
@@ -7,7 +7,7 @@ $user = ''
7
7
  $sharePath = ''
8
8
  $driveLetter = ''
9
9
 
10
- uv run --python 3.13 --with machineconfig python -m machineconfig.scripts.python.mount_ssh
10
+ uv run --python 3.13 --no-dev --project $HOME/code/machineconfig python -m machineconfig.scripts.python.mount_ssh
11
11
 
12
12
  net use T: \\sshfs.kr\$user@$host.local
13
13
  # this worked: net use T: \\sshfs\alex@alex-p51s-5.local
@@ -1 +1 @@
1
- uv run --python 3.13 --with machineconfig -m fire machineconfig.scripts.python.pomodoro pomodoro $args
1
+ uv run --python 3.13 --no-dev --project $HOME/code/machineconfig pomodoro $args
@@ -1 +1 @@
1
- uv run --python 3.13 --with machineconfig python -m machineconfig.scripts.python.repos $args
1
+ uv run --python 3.13 --no-dev --project $HOME/code/machineconfig repos $args
@@ -1 +1 @@
1
- uv run --python 3.13 --with machineconfig python -m machineconfig.scripts.python.scheduler $Args
1
+ uv run --python 3.13 --no-dev --project $HOME/code/machineconfig scheduler $Args
@@ -1 +1 @@
1
- uv run --python 3.13 --with machineconfig python $PSScriptRoot/../python/snapshot.py $args
1
+ uv run --python 3.13 --no-dev --project $HOME/code/machineconfig snapshot $args
@@ -1 +1 @@
1
- uv run --python 3.13 --with machineconfig python -m machineconfig.scripts.python.start_slidev $args
1
+ uv run --python 3.13 --no-dev --project $HOME/code/machineconfig start_slidev $args
@@ -1 +1 @@
1
- uv run --python 3.13 --with machineconfig python -m machineconfig.scripts.python.start_terminals $args
1
+ uv run --python 3.13 --no-dev --project $HOME/code/machineconfig start_terminals $args
@@ -1,3 +1,2 @@
1
1
 
2
- $pyparser=Resolve-Path("$PSScriptRoot/../python/wifi_conn.py")
3
- uv run --python 3.13 --with machineconfig python $pyparser $args
2
+ uv run --python 3.13 --no-dev --project $HOME/code/machineconfig wifi_conn $args
@@ -1,9 +1,5 @@
1
1
 
2
2
 
3
-
4
- # PATH extension =====================================================
5
- # $env:Path += ";$HOME\code\machineconfig\src\machineconfig\scripts\windows;$HOME\dotfiles\scripts\windows;C:\Program Files (x86)\GnuWin32\bin;C:\Program Files\CodeBlocks\MinGW\bin;C:\Program Files\nu\bin;C:\Program Files\Graphviz\bin"
6
-
7
3
  function Add-ToPathIfNotAlready {
8
4
  param (
9
5
  [Parameter(Mandatory=$true)]
@@ -7,5 +7,5 @@ cd $HOME/code/machineconfig
7
7
  $HOME/.local/bin/uv sync --no-dev
8
8
  $HOME/.local/bin/uv pip install -e ../crocodile
9
9
 
10
- source $HOME/code/machineconfig/src/machineconfig/setup_linux/symlinks.sh
10
+ uv run --no-dev --project $HOME/code/machineconfig -m fire machineconfig.profile.create main --choice=all
11
11
  . ~/.bashrc
@@ -37,8 +37,7 @@ echo """#=======================================================================
37
37
  🐍 PYTHON ENVIRONMENT | Virtual environment setup
38
38
  #=======================================================================
39
39
  """
40
- read -p "🐍 Install Python virtual environment '.venv' [y]/n? " choice
41
- export ve_name=".venv"
40
+ read -p "🐍 Install UV and repos [y]/n? " choice
42
41
  if [[ "$choice" == "y" || "$choice" == "Y" ]]; then
43
42
  echo """ 🔧 Setting up Python environment...
44
43
  """
@@ -102,8 +101,7 @@ choice=${choice:-y}
102
101
  if [[ "$choice" == "y" || "$choice" == "Y" ]]; then
103
102
  echo """ 🔧 Creating symlinks and setting permissions...
104
103
  """
105
- source $HOME/code/machineconfig/.venv/bin/activate
106
- python -m fire machineconfig.profile.create main --choice=all
104
+ uv run --python 3.13 --with machineconfig python -m fire machineconfig.profile.create main --choice=all
107
105
  sudo chmod 600 $HOME/.ssh/*
108
106
  sudo chmod 700 $HOME/.ssh
109
107
  else
@@ -120,8 +118,7 @@ choice=${choice:-y}
120
118
  if [[ "$choice" == "y" || "$choice" == "Y" ]]; then
121
119
  echo """ 🔧 Installing CLI applications...
122
120
  """
123
- . $HOME/code/machineconfig/.venv/bin/activate
124
- python -m fire machineconfig.scripts.python.devops_devapps_install main --which=AllEssentials
121
+ uv run --python 3.13 --with machineconfig python -m fire machineconfig.scripts.python.devops_devapps_install main --which=AllEssentials
125
122
  . $HOME/.bashrc
126
123
  else
127
124
  echo """ ⏭️ Skipping CLI apps installation
@@ -132,16 +129,14 @@ echo """#=======================================================================
132
129
  🛠️ DEVELOPMENT TOOLS | Software development packages
133
130
  #=======================================================================
134
131
  """
135
- read -p "🛠️ Install Development Tools [y]/n? " choice
132
+ read -p "🛠️ Install Development Tools (rust, libssql-dev, ffmpeg, wezterm, brave, code) [y]/n? " choice
136
133
  choice=${choice:-y}
137
134
  if [[ "$choice" == "y" || "$choice" == "Y" ]]; then
138
- echo """ 🔧 Installing development tools...
139
- """
135
+ echo """ 🔧 Installing development tools... """
140
136
  (curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh) || true
141
137
  sudo nala install libssl-dev -y
142
138
  sudo nala install ffmpeg -y
143
- . $HOME/code/machineconfig/.venv/bin/activate
144
- python -m fire machineconfig.scripts.python.devops_devapps_install main --which=wezterm,brave,code
139
+ uv run --python 3.13 --with machineconfig python -m fire machineconfig.scripts.python.devops_devapps_install main --which=wezterm,brave,code
145
140
  else
146
141
  echo """ ⏭️ Skipping development tools installation
147
142
  """
@@ -171,8 +166,7 @@ choice=${choice:-y}
171
166
  if [[ "$choice" == "y" || "$choice" == "Y" ]]; then
172
167
  echo """ 🔄 Retrieving data...
173
168
  """
174
- . $HOME/code/machineconfig/.venv/bin/activate
175
- python -m fire machineconfig.scripts.python.devops_backup_retrieve main --direction=RETRIEVE
169
+ uv run --python 3.13 --with machineconfig python -m fire machineconfig.scripts.python.devops_backup_retrieve main --direction=RETRIEVE
176
170
  else
177
171
  echo """ ⏭️ Skipping data retrieval
178
172
  """
@@ -7,16 +7,16 @@ Write-Host "ℹ️ If you have execution policy issues, run:
7
7
  Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser"
8
8
  Write-Host "💡 To accept all prompts automatically, run: `$yesAll = `$true`n"
9
9
 
10
- # Set environment variable and execute scripts
11
- $ve_name = ".venv"
12
10
 
13
11
  Write-Host "🔄 Setting up Python environment..."
14
12
  Invoke-WebRequest -Uri "https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_windows/ve.ps1" -OutFile "ve.ps1"
15
13
  .\ve.ps1
14
+ rm ve.ps1
16
15
 
17
16
  Write-Host "`n🔄 Setting up repositories..."
18
17
  Invoke-WebRequest -Uri "https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_windows/repos.ps1" -OutFile "repos.ps1"
19
18
  .\repos.ps1
19
+ rm repos.ps1
20
20
 
21
21
  Write-Host "`n📂 ============================================
22
22
  🔄 DOTFILES MIGRATION OPTIONS
@@ -97,7 +97,8 @@ if ($createLinksChoice -eq "y" -or $createLinksChoice -eq "Y") {
97
97
  if ($linkTypeChoice -eq "s" -or $linkTypeChoice -eq "S") {
98
98
  python -m fire machineconfig.profile.create main --choice=all
99
99
  } elseif ($linkTypeChoice -eq "h" -or $linkTypeChoice -eq "H") {
100
- python -m fire machineconfig.profile.create_hardlinks main --choice=all
100
+ # python -m fire machineconfig.profile.create_hardlinks main --choice=all
101
+ python -m fire machineconfig.profile.create main --choice=all
101
102
  } else {
102
103
  Write-Host "Invalid choice for link type. Installation aborted."
103
104
  }
@@ -119,9 +120,7 @@ if (-not $yesAll) {
119
120
  }
120
121
 
121
122
  } else {
122
- . $HOME\code\machineconfig\.venv\Scripts\activate.ps1
123
- python -m fire machineconfig.scripts.python.devops_devapps_install main --which=AllEssentials
124
- deactivate
123
+ uv run --python 3.13 --with machineconfig python -m fire machineconfig.scripts.python.devops_devapps_install main --which=AllEssentials
125
124
  }
126
125
 
127
126
 
@@ -146,8 +145,7 @@ if (-not $yesAll) {
146
145
  }
147
146
  if ([string]::IsNullOrEmpty($choice)) { $choice = "y" }
148
147
  if ($choice -eq "y" -or $choice -eq "Y") {
149
- . ~\code\machineconfig\.venv\Scripts\Activate.ps1
150
- python -m fire machineconfig.scripts.python.devops_backup_retrieve main --direction=RETRIEVE
148
+ uv run --python 3.13 --with machineconfig python -m fire machineconfig.scripts.python.devops_backup_retrieve main --direction=RETRIEVE
151
149
  } else {
152
150
  Write-Host "Installation aborted."
153
151
  }
@@ -161,19 +159,12 @@ if (-not $yesAll) {
161
159
  }
162
160
  if ([string]::IsNullOrEmpty($choice)) { $choice = "y" }
163
161
  if ($choice -eq "y" -or $choice -eq "Y") {
164
- # python -m fire machineconfig.scripts.python.devops_devapps_install main --which=wezterm
165
- # python -m fire machineconfig.scripts.python.devops_devapps_install main --which=brave
166
- # python -m fire machineconfig.scripts.python.devops_devapps_install main --which=code
167
162
  winget install --no-upgrade --name "Windows Terminal" --Id "Microsoft.WindowsTerminal" --source winget --scope user --accept-package-agreements --accept-source-agreements # Terminal is is installed by default on W 11
168
163
  winget install --no-upgrade --name "Powershell" --Id "Microsoft.PowerShell" --source winget --scope user --accept-package-agreements --accept-source-agreements # powershell require admin
169
- python -m fire machineconfig.setup_windows.wt_and_pwsh.set_pwsh_theme install_nerd_fonts
170
- python -m fire machineconfig.setup_windows.wt_and_pwsh.set_wt_settings main
171
164
  winget install --no-upgrade --name "Brave" --Id "Brave.Brave" --source winget --scope user --accept-package-agreements --accept-source-agreements
172
165
  winget install --no-upgrade --name "Microsoft Visual Studio Code" --Id "Microsoft.VisualStudioCode" --source winget --scope user --accept-package-agreements --accept-source-agreements
173
- . $HOME\code\machineconfig\.venv\Scripts\Activate.ps1
174
- python -m fire machineconfig.setup_windows.wt_and_pwsh.set_pwsh_theme install_nerd_fonts
175
- python -m fire machineconfig.setup_windows.wt_and_pwsh.set_wt_settings main
176
-
166
+ uv run --python 3.13 --with machineconfig python -m fire machineconfig.setup_windows.wt_and_pwsh.install_nerd_fonts main
167
+ uv run --python 3.13 --with machineconfig python -m fire machineconfig.setup_windows.wt_and_pwsh.set_wt_settings main
177
168
  } else {
178
169
  Write-Host "Installation aborted."
179
170
  }
@@ -181,7 +172,7 @@ if ($choice -eq "y" -or $choice -eq "Y") {
181
172
 
182
173
  # Install Apps
183
174
  if (-not $yesAll) {
184
- $choice = Read-Host "Install Apps [y]/n ? "
175
+ $choice = Read-Host "Install Windows Apps [y]/n ? "
185
176
  } else {
186
177
  $choice = "y"
187
178
  }
@@ -4,8 +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.source_of_truth import LIBRARY_ROOT
8
- from uuid import uuid4
7
+ # from uuid import uuid4
9
8
  import os
10
9
  from typing import Any
11
10
  from rich.console import Console
@@ -100,65 +99,6 @@ class TerminalSettings(object):
100
99
  else:
101
100
  console.print(Panel("❌ PowerShell profile was not found in the list of profiles and therefore was not made the default.", title="[bold red]Terminal Settings[/bold red]", border_style="red"))
102
101
 
103
- def add_croshell(self):
104
- print("\n🐊 Adding croshell profile...")
105
- croshell = dict(
106
- name="croshell",
107
- guid="{" + str(uuid4()) + "}",
108
- commandline=f'powershell.exe -Command "{LIBRARY_ROOT.as_posix()}/scripts/windows/croshell.ps1"',
109
- startingDirectory="%USERPROFILE%", # "%USERPROFILE%", # None: inherent from parent process.
110
- )
111
- # startingDirectory = None means: inheret from parent process, which will is the default, which point to /System32
112
- # Launching a new profile with ctr+shift+2 is equivalent to: wt --profile croshell -d . --new-tab
113
- for profile in self.profs:
114
- if profile["name"] == "croshell":
115
- profile.update(croshell)
116
- console.print(Panel("✅ Updated existing croshell profile", title="[bold blue]Terminal Settings[/bold blue]", border_style="blue"))
117
- break
118
- else:
119
- self.profs.append(croshell)
120
- console.print(Panel("✅ Added new croshell profile", title="[bold blue]Terminal Settings[/bold blue]", border_style="blue"))
121
-
122
- def add_ubuntu(self):
123
- print("\n🐧 Adding Ubuntu WSL profile...")
124
- # Add Ubunto if it is not there.
125
- ubuntu = dict(
126
- name="Ubuntu",
127
- commandline="wsl -d Ubuntu -- cd ~",
128
- hidden=False,
129
- guid="{" + str(uuid4()) + "}",
130
- startingDirectory="%USERPROFILE%", # "%USERPROFILE%", # None: inherent from parent process.
131
- )
132
- if not any(x.get("name") == "Ubuntu" for x in self.profs):
133
- self.profs.append(ubuntu)
134
- console.print(Panel("✅ Added Ubuntu WSL profile", title="[bold blue]Terminal Settings[/bold blue]", border_style="blue"))
135
- else:
136
- console.print(Panel("ℹ️ Ubuntu profile already exists", title="[bold blue]Terminal Settings[/bold blue]", border_style="blue"))
137
-
138
- def standardize_profiles_order(self):
139
- print("\n🔄 Standardizing profile order...")
140
- # Changing order of profiles:
141
- others = []
142
- pwsh = croshell = ubuntu = wpwsh = cmd = azure = None
143
- for profile in self.profs:
144
- name = profile["name"]
145
- if name == "PowerShell":
146
- pwsh = profile
147
- elif name == "croshell":
148
- croshell = profile
149
- elif name == "Ubuntu":
150
- ubuntu = profile
151
- elif name == "Windows PowerShell":
152
- wpwsh = profile
153
- elif name == "Command Prompt":
154
- cmd = profile
155
- elif name == "Azure Cloud Shell":
156
- azure = profile
157
- else:
158
- others.append(profile)
159
- self.profs = [item for item in [pwsh, croshell, ubuntu, wpwsh, cmd, azure] + others if item is not None]
160
- console.print(Panel("✅ Profile order standardized", title="[bold blue]Terminal Settings[/bold blue]", border_style="blue"))
161
-
162
102
 
163
103
  def main():
164
104
  print(f"\n{'=' * 80}\n🖥️ WINDOWS TERMINAL SETUP 🖥️\n{'=' * 80}")
@@ -168,12 +108,7 @@ def main():
168
108
  ts = TerminalSettings()
169
109
  ts.update_default_settings()
170
110
  ts.customize_powershell(nerd_font=True)
171
-
172
111
  ts.make_powershell_default_profile()
173
- ts.add_croshell()
174
- ts.add_ubuntu()
175
- ts.standardize_profiles_order()
176
-
177
112
  print("⌨️ Adding keyboard shortcut for pane zoom (ctrl+shift+z)...")
178
113
  ts.dat["actions"].append({"command": "togglePaneZoom", "keys": "ctrl+shift+z"})
179
114
 
@@ -112,10 +112,9 @@ def symlink_func(this: PathExtended, to_this: PathExtended, prioritize_to_this:
112
112
  console.print(Panel(f"❌ ERROR | Failed at linking {this} ➡️ {to_this}. Reason: {ex}", title="Error", expand=False))
113
113
 
114
114
 
115
- def symlink_copy(this: PathExtended, to_this: PathExtended, prioritize_to_this: bool = True):
115
+ def symlink_copy(this: PathExtended, to_this: PathExtended, prioritize_to_this: bool):
116
116
  this = PathExtended(this).expanduser().absolute()
117
117
  to_this = PathExtended(to_this).expanduser().absolute()
118
- # Case analysis based on docstring of symlink_func
119
118
  if this.exists():
120
119
  if to_this.exists():
121
120
  if this.is_symlink():
@@ -14,22 +14,25 @@ T = TypeVar("T")
14
14
  def check_tool_exists(tool_name: str) -> bool:
15
15
  if platform.system() == "Windows":
16
16
  tool_name = tool_name.replace(".exe", "") + ".exe"
17
- cmd = "where.exe"
18
- root_path = Path(WINDOWS_INSTALL_PATH)
17
+ res1 = any([Path(WINDOWS_INSTALL_PATH).joinpath(tool_name).is_file(), Path.home().joinpath("AppData/Roaming/npm").joinpath(tool_name).is_file()])
18
+ tool_name = tool_name.replace(".exe", "") + ".exe"
19
+ res2 = any([Path(WINDOWS_INSTALL_PATH).joinpath(tool_name).is_file(), Path.home().joinpath("AppData/Roaming/npm").joinpath(tool_name).is_file()])
20
+ return res1 or res2
19
21
  elif platform.system() in ["Linux", "Darwin"]:
20
- cmd = "which"
21
22
  root_path = Path(LINUX_INSTALL_PATH)
22
23
  return any([Path("/usr/local/bin").joinpath(tool_name).is_file(), Path("/usr/bin").joinpath(tool_name).is_file(), root_path.joinpath(tool_name).is_file()])
23
24
  else:
24
25
  raise NotImplementedError(f"platform {platform.system()} not implemented")
25
- _ = cmd
26
+ # _ = cmd
27
+ # cmd = "where.exe"
28
+ # cmd = "which"
26
29
  # try: # talking to terminal is too slow.
27
30
  # _tmp = subprocess.check_output([cmd, tool_name], stderr=subprocess.DEVNULL)
28
31
  # res: bool = True
29
32
  # except (subprocess.CalledProcessError, FileNotFoundError):
30
33
  # res = False
31
34
  # return res
32
- return root_path.joinpath(tool_name).is_file()
35
+ # return root_path.joinpath(tool_name).is_file()
33
36
 
34
37
 
35
38
  def choose_one_option(options: Iterable[T], header: str = "", tail: str = "", prompt: str = "", msg: str = "", default: Optional[T] = None, fzf: bool = False, custom_input: bool = False) -> T:
@@ -1,7 +1,7 @@
1
1
  """Procs"""
2
2
 
3
3
  import psutil
4
- from tqdm import tqdm
4
+ from rich.progress import Progress, SpinnerColumn, TextColumn
5
5
  from pytz import timezone
6
6
  from machineconfig.utils.options import display_options
7
7
  from typing import Optional, Any
@@ -20,14 +20,22 @@ def get_processes_accessing_file(path: str):
20
20
  title = "🔍 SEARCHING FOR PROCESSES ACCESSING FILE"
21
21
  console.print(Panel(title, title="[bold blue]Process Info[/bold blue]", border_style="blue"))
22
22
  res: dict[int, list[str]] = {}
23
- for proc in tqdm(psutil.process_iter(), desc="🔎 Scanning processes"):
24
- try:
25
- files = proc.open_files()
26
- except psutil.AccessDenied:
27
- continue
28
- tmp = [file.path for file in files if path in file.path]
29
- if len(tmp) > 0:
30
- res[proc.pid] = tmp
23
+
24
+ with Progress(
25
+ SpinnerColumn(),
26
+ TextColumn("[progress.description]{task.description}"),
27
+ ) as progress:
28
+ progress.add_task("🔎 Scanning processes...", total=None)
29
+
30
+ for proc in psutil.process_iter():
31
+ try:
32
+ files = proc.open_files()
33
+ except psutil.AccessDenied:
34
+ continue
35
+ tmp = [file.path for file in files if path in file.path]
36
+ if len(tmp) > 0:
37
+ res[proc.pid] = tmp
38
+
31
39
  # Convert to list of dictionaries for consistent data structure
32
40
  result_data = [{"pid": pid, "files": files} for pid, files in res.items()]
33
41
  console.print(Panel(f"✅ Found {len(res)} processes accessing the specified file", title="[bold blue]Process Info[/bold blue]", border_style="blue"))
@@ -53,27 +61,34 @@ class ProcessManager:
53
61
  title = "📊 INITIALIZING PROCESS MANAGER"
54
62
  console.print(Panel(title, title="[bold blue]Process Info[/bold blue]", border_style="blue"))
55
63
  process_info = []
56
- for proc in tqdm(psutil.process_iter(), desc="🔍 Reading system processes"):
57
- try:
58
- mem_usage_mb = proc.memory_info().rss / (1024 * 1024)
59
- # Convert create_time to local timezone
60
- create_time_utc = datetime.fromtimestamp(proc.create_time(), tz=timezone("UTC"))
61
- create_time_local = create_time_utc.astimezone(timezone("Australia/Adelaide"))
62
-
63
- process_info.append(
64
- {
65
- "pid": proc.pid,
66
- "name": proc.name(),
67
- "username": proc.username(),
68
- "cpu_percent": proc.cpu_percent(),
69
- "memory_usage_mb": mem_usage_mb,
70
- "status": proc.status(),
71
- "create_time": create_time_local,
72
- "command": " ".join(proc.cmdline()),
73
- }
74
- )
75
- except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
76
- pass
64
+
65
+ with Progress(
66
+ SpinnerColumn(),
67
+ TextColumn("[progress.description]{task.description}"),
68
+ ) as progress:
69
+ progress.add_task("🔍 Reading system processes...", total=None)
70
+
71
+ for proc in psutil.process_iter():
72
+ try:
73
+ mem_usage_mb = proc.memory_info().rss / (1024 * 1024)
74
+ # Convert create_time to local timezone
75
+ create_time_utc = datetime.fromtimestamp(proc.create_time(), tz=timezone("UTC"))
76
+ create_time_local = create_time_utc.astimezone(timezone("Australia/Adelaide"))
77
+
78
+ process_info.append(
79
+ {
80
+ "pid": proc.pid,
81
+ "name": proc.name(),
82
+ "username": proc.username(),
83
+ "cpu_percent": proc.cpu_percent(),
84
+ "memory_usage_mb": mem_usage_mb,
85
+ "status": proc.status(),
86
+ "create_time": create_time_local,
87
+ "command": " ".join(proc.cmdline()),
88
+ }
89
+ )
90
+ except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
91
+ pass
77
92
 
78
93
  # Sort by memory usage (descending)
79
94
  process_info.sort(key=lambda x: x["memory_usage_mb"], reverse=True)
@@ -230,5 +245,9 @@ def get_age(create_time: Any) -> str:
230
245
  return f"unknown due to {ee} and {e}"
231
246
 
232
247
 
248
+ def main():
249
+ from machineconfig.utils.procs import ProcessManager; ProcessManager().choose_and_kill()
250
+
251
+
233
252
  if __name__ == "__main__":
234
- pass
253
+ main()
@@ -72,7 +72,6 @@
72
72
  # return "\n".join([header, separator] + rows)
73
73
 
74
74
 
75
- # SCHEDULER_DEFAULT_ROOT = PathExtended.home().joinpath("dotfiles/scripts/.scheduler")
76
75
  # SUCCESS = "success"
77
76
  # DEFAULT_CONFIG = """
78
77
  # [specs]
@@ -24,6 +24,5 @@ class LayoutConfig(TypedDict):
24
24
 
25
25
  class LayoutsFile(TypedDict):
26
26
  """Complete layout file structure."""
27
-
28
27
  version: str
29
28
  layouts: List[LayoutConfig]
@@ -0,0 +1,28 @@
1
+
2
+
3
+ from typing import TypedDict
4
+
5
+
6
+
7
+ class GitVersionInfo(TypedDict):
8
+ branch: str
9
+ commit: str
10
+
11
+
12
+ class RepoRemote(TypedDict):
13
+ name: str
14
+ url: str
15
+
16
+
17
+ class RepoRecordDict(TypedDict):
18
+ name: str
19
+ parentDir: str
20
+ currentBranch: str
21
+ remotes: list[RepoRemote]
22
+ version: GitVersionInfo
23
+ isDirty: bool
24
+
25
+
26
+ class RepoRecordFile(TypedDict):
27
+ version: str
28
+ repos: list[RepoRecordDict]
@@ -3,12 +3,11 @@ Utils
3
3
  """
4
4
 
5
5
  import machineconfig
6
- # import platform
7
6
  from pathlib import Path
8
7
 
9
8
  LIBRARY_ROOT = Path(machineconfig.__file__).resolve().parent
10
9
  REPO_ROOT = LIBRARY_ROOT.parent.parent
11
- # PROGRAM_PATH = Path(Path.home().joinpath("tmp_results", "shells", "python_return_command").__str__() + (".ps1" if platform.system() == "Windows" else ".sh"))
10
+
12
11
  CONFIG_PATH = Path.home().joinpath(".config/machineconfig")
13
12
  DEFAULTS_PATH = Path.home().joinpath("dotfiles/machineconfig/defaults.ini")
14
13
 
@@ -22,6 +21,4 @@ WINDOWS_INSTALL_PATH = Path.home().joinpath("AppData/Local/Microsoft/WindowsApps
22
21
 
23
22
 
24
23
  if __name__ == "__main__":
25
- # import typer
26
- # typer.run(check_tool_exists)
27
24
  pass
@@ -116,13 +116,35 @@ class SSH: # inferior alternative: https://github.com/fabric/fabric
116
116
  print(f"""⚠️ WARNING: Failed to open SFTP connection to {hostname}.
117
117
  Error Details: {err}\nData transfer may be affected!""")
118
118
 
119
- def view_bar(slf: Any, a: Any, b: Any):
120
- slf.total = int(b)
121
- slf.update(int(a - slf.n)) # update pbar with increment
122
-
123
- from tqdm import tqdm
124
-
125
- self.tqdm_wrap = type("TqdmWrap", (tqdm,), {"view_bar": view_bar})
119
+ from rich.progress import Progress, SpinnerColumn, TextColumn, BarColumn, FileSizeColumn, TransferSpeedColumn
120
+
121
+ class RichProgressWrapper:
122
+ def __init__(self, **kwargs: Any):
123
+ self.kwargs = kwargs
124
+ self.progress: Optional[Progress] = None
125
+ self.task: Optional[Any] = None
126
+
127
+ def __enter__(self) -> "RichProgressWrapper":
128
+ self.progress = Progress(
129
+ SpinnerColumn(),
130
+ TextColumn("[bold blue]{task.description}"),
131
+ BarColumn(),
132
+ FileSizeColumn(),
133
+ TransferSpeedColumn(),
134
+ )
135
+ self.progress.start()
136
+ self.task = self.progress.add_task("Transferring...", total=0)
137
+ return self
138
+
139
+ def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
140
+ if self.progress:
141
+ self.progress.stop()
142
+
143
+ def view_bar(self, transferred: int, total: int) -> None:
144
+ if self.progress and self.task is not None:
145
+ self.progress.update(self.task, completed=transferred, total=total)
146
+
147
+ self.tqdm_wrap = RichProgressWrapper
126
148
  self._local_distro: Optional[str] = None
127
149
  self._remote_distro: Optional[str] = None
128
150
  self._remote_machine: Optional[MACHINE] = None
@@ -201,7 +223,7 @@ class SSH: # inferior alternative: https://github.com/fabric/fabric
201
223
  assert '"' not in cmd, 'Avoid using `"` in your command. I dont know how to handle this when passing is as command to python in pwsh command.'
202
224
  if not return_obj:
203
225
  return self.run(
204
- cmd=f"""uv run --with machineconfig -c "{Terminal.get_header(wdir=None, toolbox=True)}{cmd}\n""" + '"', desc=desc or f"run_py on {self.get_remote_repr()}", verbose=verbose, strict_err=strict_err, strict_returncode=strict_returncode
226
+ cmd=f"""uv run --no-dev --project $HOME/code/machineconfig -c "{Terminal.get_header(wdir=None, toolbox=True)}{cmd}\n""" + '"', desc=desc or f"run_py on {self.get_remote_repr()}", verbose=verbose, strict_err=strict_err, strict_returncode=strict_returncode
205
227
  )
206
228
  assert "obj=" in cmd, "The command sent to run_py must have `obj=` statement if return_obj is set to True"
207
229
  source_file = self.run_py(f"""{cmd}\npath = Save.pickle(obj=obj, path=P.tmpfile(suffix='.pkl'))\nprint(path)""", desc=desc, verbose=verbose, strict_err=True, strict_returncode=True).op.split("\n")[-1]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: machineconfig
3
- Version: 2.6
3
+ Version: 2.8
4
4
  Summary: Dotfiles management package
5
5
  Author-email: Alex Al-Saffar <programmer@usa.com>
6
6
  License: Apache 2.0
@@ -30,7 +30,6 @@ Requires-Dist: rich>=14.0.0
30
30
  Requires-Dist: tenacity>=9.1.2
31
31
  Requires-Dist: toml>=0.10.2
32
32
  Requires-Dist: tomli>=2.2.1
33
- Requires-Dist: tqdm>=4.67.1
34
33
  Provides-Extra: windows
35
34
  Requires-Dist: pywin32; extra == "windows"
36
35
  Provides-Extra: docs