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