machineconfig 2.0__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 +0 -3
- machineconfig/cluster/data_transfer.py +0 -1
- machineconfig/cluster/file_manager.py +0 -1
- machineconfig/cluster/job_params.py +0 -3
- machineconfig/cluster/loader_runner.py +0 -3
- machineconfig/cluster/remote_machine.py +0 -1
- machineconfig/cluster/script_notify_upon_completion.py +0 -1
- machineconfig/cluster/sessions_managers/archive/create_zellij_template.py +3 -5
- machineconfig/cluster/sessions_managers/archive/session_managers.py +0 -1
- machineconfig/cluster/sessions_managers/enhanced_command_runner.py +17 -57
- machineconfig/cluster/sessions_managers/wt_local.py +36 -110
- machineconfig/cluster/sessions_managers/wt_local_manager.py +42 -112
- machineconfig/cluster/sessions_managers/wt_remote.py +23 -30
- machineconfig/cluster/sessions_managers/wt_remote_manager.py +20 -62
- machineconfig/cluster/sessions_managers/wt_utils/layout_generator.py +10 -15
- machineconfig/cluster/sessions_managers/wt_utils/process_monitor.py +27 -127
- machineconfig/cluster/sessions_managers/wt_utils/remote_executor.py +10 -43
- machineconfig/cluster/sessions_managers/wt_utils/session_manager.py +22 -101
- machineconfig/cluster/sessions_managers/wt_utils/status_reporter.py +11 -39
- machineconfig/cluster/sessions_managers/zellij_local.py +49 -102
- machineconfig/cluster/sessions_managers/zellij_local_manager.py +34 -78
- machineconfig/cluster/sessions_managers/zellij_remote.py +17 -24
- machineconfig/cluster/sessions_managers/zellij_remote_manager.py +7 -13
- machineconfig/cluster/sessions_managers/zellij_utils/example_usage.py +4 -2
- machineconfig/cluster/sessions_managers/zellij_utils/layout_generator.py +6 -6
- machineconfig/cluster/sessions_managers/zellij_utils/process_monitor.py +18 -88
- machineconfig/cluster/sessions_managers/zellij_utils/remote_executor.py +2 -6
- machineconfig/cluster/sessions_managers/zellij_utils/session_manager.py +12 -40
- machineconfig/cluster/sessions_managers/zellij_utils/status_reporter.py +3 -2
- 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 +26 -10
- machineconfig/jobs/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/jobs/linux/msc/cli_agents.sh +16 -0
- machineconfig/jobs/python/check_installations.py +1 -0
- machineconfig/jobs/python/create_bootable_media.py +0 -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 +13 -14
- machineconfig/jobs/python/vscode/select_interpreter.py +21 -22
- machineconfig/jobs/python/vscode/sync_code.py +9 -13
- machineconfig/jobs/python_custom_installers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/jobs/python_custom_installers/archive/ngrok.py +13 -13
- machineconfig/jobs/python_custom_installers/dev/aider.py +7 -15
- machineconfig/jobs/python_custom_installers/dev/alacritty.py +9 -18
- machineconfig/jobs/python_custom_installers/dev/brave.py +10 -19
- machineconfig/jobs/python_custom_installers/dev/bypass_paywall.py +8 -15
- machineconfig/jobs/python_custom_installers/dev/code.py +14 -21
- machineconfig/jobs/python_custom_installers/dev/cursor.py +3 -14
- machineconfig/jobs/python_custom_installers/dev/docker_desktop.py +8 -7
- machineconfig/jobs/python_custom_installers/dev/espanso.py +15 -19
- machineconfig/jobs/python_custom_installers/dev/goes.py +5 -12
- machineconfig/jobs/python_custom_installers/dev/lvim.py +9 -17
- machineconfig/jobs/python_custom_installers/dev/nerdfont.py +12 -19
- machineconfig/jobs/python_custom_installers/dev/redis.py +12 -20
- machineconfig/jobs/python_custom_installers/dev/wezterm.py +12 -19
- machineconfig/jobs/python_custom_installers/dev/winget.py +5 -23
- machineconfig/jobs/python_custom_installers/docker.py +12 -21
- machineconfig/jobs/python_custom_installers/gh.py +11 -19
- machineconfig/jobs/python_custom_installers/hx.py +32 -16
- machineconfig/jobs/python_custom_installers/warp-cli.py +12 -20
- machineconfig/jobs/python_generic_installers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/jobs/python_linux_installers/__pycache__/__init__.cpython-313.pyc +0 -0
- 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/profile/create.py +29 -22
- machineconfig/profile/create_hardlinks.py +26 -19
- machineconfig/profile/shell.py +51 -28
- 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 +4 -6
- machineconfig/scripts/linux/fire +1 -1
- machineconfig/scripts/linux/fire_agents +3 -2
- machineconfig/scripts/linux/ftpx +1 -1
- machineconfig/scripts/linux/gh_models +1 -1
- machineconfig/scripts/linux/kill_process +1 -1
- machineconfig/scripts/linux/mcinit +1 -1
- 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/generate_files.py +84 -0
- machineconfig/scripts/python/ai/instructions/python/dev.instructions.md +2 -2
- machineconfig/scripts/python/ai/mcinit.py +7 -3
- machineconfig/scripts/python/ai/scripts/lint_and_type_check.sh +10 -5
- machineconfig/scripts/python/cloud_copy.py +1 -1
- machineconfig/scripts/python/cloud_mount.py +1 -1
- machineconfig/scripts/python/cloud_repo_sync.py +4 -4
- machineconfig/scripts/python/croshell.py +5 -3
- machineconfig/scripts/python/devops_add_identity.py +1 -1
- machineconfig/scripts/python/devops_add_ssh_key.py +1 -1
- machineconfig/scripts/python/devops_backup_retrieve.py +1 -1
- machineconfig/scripts/python/devops_update_repos.py +140 -52
- machineconfig/scripts/python/dotfile.py +1 -1
- machineconfig/scripts/python/fire_agents.py +28 -9
- machineconfig/scripts/python/fire_jobs.py +3 -4
- machineconfig/scripts/python/ftpx.py +2 -1
- 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/helpers2.py +2 -2
- machineconfig/scripts/python/helpers/helpers4.py +1 -2
- machineconfig/scripts/python/helpers/repo_sync_helpers.py +1 -1
- machineconfig/scripts/python/mount_nfs.py +1 -1
- machineconfig/scripts/python/mount_ssh.py +1 -1
- machineconfig/scripts/python/repos.py +1 -1
- machineconfig/scripts/python/start_slidev.py +1 -1
- machineconfig/scripts/python/wsl_windows_transfer.py +1 -1
- 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 +1 -1
- 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_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/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_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 +66 -12
- machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py +44 -36
- machineconfig/utils/ai/generate_file_checklist.py +8 -10
- machineconfig/utils/ai/url2md.py +4 -2
- machineconfig/utils/cloud/onedrive/setup_oauth.py +1 -0
- machineconfig/utils/cloud/onedrive/transaction.py +63 -98
- machineconfig/utils/code.py +60 -39
- machineconfig/utils/installer.py +27 -33
- machineconfig/utils/installer_utils/installer_abc.py +8 -7
- machineconfig/utils/installer_utils/installer_class.py +149 -70
- machineconfig/utils/links.py +22 -11
- machineconfig/utils/notifications.py +197 -0
- machineconfig/utils/options.py +29 -23
- machineconfig/utils/path.py +13 -6
- machineconfig/utils/path_reduced.py +485 -216
- machineconfig/utils/procs.py +47 -41
- machineconfig/utils/scheduling.py +0 -1
- machineconfig/utils/ssh.py +157 -76
- machineconfig/utils/terminal.py +82 -37
- machineconfig/utils/utils.py +12 -10
- machineconfig/utils/utils2.py +38 -48
- machineconfig/utils/utils5.py +183 -116
- machineconfig/utils/ve.py +9 -4
- {machineconfig-2.0.dist-info → machineconfig-2.1.dist-info}/METADATA +3 -2
- {machineconfig-2.0.dist-info → machineconfig-2.1.dist-info}/RECORD +200 -217
- machineconfig/jobs/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python/__pycache__/python_ve_symlink.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/__pycache__/mcinit.cpython-311.pyc +0 -0
- 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-2.0.dist-info → machineconfig-2.1.dist-info}/WHEEL +0 -0
- {machineconfig-2.0.dist-info → machineconfig-2.1.dist-info}/top_level.txt +0 -0
|
@@ -34,12 +34,12 @@ applyTo: "**/*.py"
|
|
|
34
34
|
* when finished, run a linting static analysis check against files you touched, Any fix any mistakes.
|
|
35
35
|
* Please run `uv run -m pyright $file_touched` and address all issues. if `pyright is not there, first run `uv add pyright --dev`.
|
|
36
36
|
* For all type checkers and linters, like mypy, pyright, pyrefly and pylint, there are config files at different levels of the repo all the way up to home directory level. You don't need to worry about them, just be mindful that they exist. The tools themselves will respect the configs therein.
|
|
37
|
-
* If you want to run all linters and pycheckers agains the entire project to make sure everything is clean, I prepared a nice shell script, you can run it from the repo root as
|
|
37
|
+
* If you want to run all linters and pycheckers agains the entire project to make sure everything is clean, I prepared a nice shell script, you can run it from the repo root as `./.scripts/lint_and_typecheck.sh`. It will produce markdown files that are you are meant to look at @ ./.linters/*.md
|
|
38
38
|
|
|
39
39
|
# General Programming Ethos:
|
|
40
40
|
* Make sure all the code is rigorous, no lazy stuff.
|
|
41
41
|
* For example, always avoid default values in arguments of functions. Those are evil and cause confusion. Always be explicit in parameter passing.
|
|
42
|
-
*
|
|
42
|
+
* Please never ever attempt to change code files by writing meta code to do string manipulation on files, e.g. with `sed` command with terminal. Please do change the files one by one, no matter how many there is. Don't worry about time, nor context window size, its okay, take your time and do the legwork. You can stop in the middle and we will have another LLM to help with the rest.
|
|
43
43
|
* Please avoid writing README files and avoid docstring and comments in code unless absolutely necessary. Use clear naming conventions instead of documenting.
|
|
44
44
|
* Always prefer to functional style of programming over OOP.
|
|
45
45
|
* When passing arguments or constructing dicts or lists or tuples, avoid breaking lines too much, try to use ~ 150 characters per line before breaking to new one.
|
|
@@ -77,11 +77,15 @@ uv venv
|
|
|
77
77
|
repo_root.joinpath(".gemini").mkdir(parents=True, exist_ok=True)
|
|
78
78
|
repo_root.joinpath(".gemini/settings.json").write_text(data=gemini_settings.read_text(encoding="utf-8"), encoding="utf-8")
|
|
79
79
|
|
|
80
|
+
tmp = repo_root.joinpath(".clinerules")
|
|
81
|
+
tmp.mkdir(parents=True, exist_ok=True)
|
|
82
|
+
tmp.joinpath("python_dev.md").write_text(data=generic_instructions.read_text(encoding="utf-8"), encoding="utf-8")
|
|
83
|
+
|
|
80
84
|
# OTHERS
|
|
81
85
|
scripts_dir = mc_root.joinpath("scripts/python/ai/scripts")
|
|
82
|
-
repo_root.joinpath("scripts").mkdir(parents=True, exist_ok=True)
|
|
86
|
+
repo_root.joinpath(".scripts").mkdir(parents=True, exist_ok=True)
|
|
83
87
|
for a_script in scripts_dir.iterdir():
|
|
84
|
-
repo_root.joinpath("scripts", a_script.name).write_text(data=a_script.read_text(encoding="utf-8"), encoding="utf-8")
|
|
88
|
+
repo_root.joinpath(".scripts", a_script.name).write_text(data=a_script.read_text(encoding="utf-8"), encoding="utf-8")
|
|
85
89
|
|
|
86
90
|
dot_ai_dir = repo_root.joinpath(".ai")
|
|
87
91
|
dot_ai_dir.mkdir(parents=True, exist_ok=True)
|
|
@@ -89,7 +93,7 @@ uv venv
|
|
|
89
93
|
if dot_git_ignore_path.exists():
|
|
90
94
|
dot_git_ignore_content = dot_git_ignore_path.read_text(encoding="utf-8")
|
|
91
95
|
to_add: list[str] = []
|
|
92
|
-
to_check_for: list[str] = [".links", "notebooks", ".ai", "scripts",
|
|
96
|
+
to_check_for: list[str] = [".links", "notebooks", ".ai", ".scripts",
|
|
93
97
|
"GEMINI.md", "CLAUDE.md", ".cursor", ".github"]
|
|
94
98
|
for item in to_check_for:
|
|
95
99
|
if item not in dot_git_ignore_content:
|
|
@@ -8,18 +8,23 @@ fi
|
|
|
8
8
|
echo "Running linting and type checking..."
|
|
9
9
|
|
|
10
10
|
echo "Setting up environment..."
|
|
11
|
-
uv add pylint pyright mypy pyrefly ruff ty --dev # linters and type checkers
|
|
12
|
-
uv add cleanpy --
|
|
11
|
+
# uv add pylint pyright mypy pyrefly ruff ty --dev # linters and type checkers
|
|
12
|
+
# uv add --dev cleanpy pylint pyright mypy pyrefly --upgrade-package cleanpy pylint pyright mypy pyrefly
|
|
13
|
+
uv add --dev pyright --upgrade-package pyright
|
|
14
|
+
uv add --dev pylint --upgrade-package pylint
|
|
15
|
+
uv add --dev mypy --upgrade-package mypy
|
|
16
|
+
uv add --dev pyrefly --upgrade-package pyrefly
|
|
17
|
+
uv add --dev cleanpy --upgrade-package cleanpy
|
|
18
|
+
|
|
13
19
|
|
|
14
20
|
uv add types-requests types-toml types-PyYAML types-pytz types-paramiko types-urllib3 --dev
|
|
15
21
|
uv add types-mysqlclient types-SQLAlchemy --dev
|
|
16
|
-
uv add types-pytest-lazy-fixtures --dev
|
|
17
22
|
|
|
18
23
|
uv run -m cleanpy .
|
|
19
24
|
uv run -m ruff clean
|
|
20
|
-
uv run -m ruff format .
|
|
25
|
+
# uv run -m ruff format .
|
|
21
26
|
uv run -m ruff check . --fix
|
|
22
|
-
|
|
27
|
+
uv run --with machineconfig -m machineconfig.scripts.python.ai.generate_files
|
|
23
28
|
|
|
24
29
|
mkdir .linters
|
|
25
30
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
from machineconfig.utils.utils import PROGRAM_PATH, choose_one_option
|
|
6
6
|
from machineconfig.utils.utils2 import read_ini
|
|
7
|
-
from machineconfig.utils.path_reduced import
|
|
7
|
+
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
8
8
|
|
|
9
9
|
import platform
|
|
10
10
|
import argparse
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"""utils"""
|
|
2
2
|
|
|
3
|
+
from pathlib import Path
|
|
3
4
|
import git
|
|
4
|
-
from machineconfig.utils.path_reduced import
|
|
5
|
+
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
5
6
|
from machineconfig.utils.terminal import Terminal
|
|
6
7
|
from machineconfig.utils.utils2 import randstr, read_ini
|
|
7
8
|
|
|
@@ -13,7 +14,6 @@ import argparse
|
|
|
13
14
|
from typing import Optional, Literal
|
|
14
15
|
from rich.console import Console
|
|
15
16
|
from rich.panel import Panel
|
|
16
|
-
# from rich.text import Text
|
|
17
17
|
|
|
18
18
|
console = Console()
|
|
19
19
|
|
|
@@ -92,7 +92,7 @@ git pull originEnc master
|
|
|
92
92
|
from machineconfig.scripts.python.helpers.repo_sync_helpers import delete_remote_repo_copy_and_push_local as func
|
|
93
93
|
func(remote_repo=r'{str(repo_remote_root)}', local_repo=r'{str(repo_local_root)}', cloud=r'{cloud_resolved}')
|
|
94
94
|
"""
|
|
95
|
-
shell_file_1 = get_shell_file_executing_python_script(python_script=program_1_py,
|
|
95
|
+
shell_file_1 = get_shell_file_executing_python_script(python_script=program_1_py, ve_path=str(Path.home().joinpath("code", "crocodile", ".venv")))
|
|
96
96
|
# ================================================================================
|
|
97
97
|
|
|
98
98
|
option2 = 'Delete local repo and replace it with remote copy:'
|
|
@@ -114,7 +114,7 @@ sudo chmod +x $HOME/dotfiles/scripts/linux -R
|
|
|
114
114
|
from machineconfig.scripts.python.helper.repo_sync_helpers import inspect_repos as func
|
|
115
115
|
func(repo_local_root=r'{str(repo_local_root)}', repo_remote_root=r'{str(repo_remote_root)}')
|
|
116
116
|
"""
|
|
117
|
-
shell_file_3 = get_shell_file_executing_python_script(python_script=program_3_py,
|
|
117
|
+
shell_file_3 = get_shell_file_executing_python_script(python_script=program_3_py, ve_path=str(Path.home().joinpath("code", "crocodile", ".venv")))
|
|
118
118
|
# ================================================================================
|
|
119
119
|
|
|
120
120
|
option4 = 'Remove problematic rclone file from repo and replace with remote:'
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env -S uv run --project
|
|
2
|
+
|
|
1
3
|
"""
|
|
2
4
|
croshell
|
|
3
5
|
"""
|
|
4
6
|
|
|
5
7
|
import argparse
|
|
6
|
-
from machineconfig.utils.path_reduced import
|
|
8
|
+
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
7
9
|
from machineconfig.utils.utils2 import randstr
|
|
8
10
|
from machineconfig.utils.utils import PROGRAM_PATH, display_options
|
|
9
11
|
from machineconfig.utils.ve import get_ve_path_and_ipython_profile, get_ve_activate_line
|
|
@@ -134,7 +136,7 @@ def build_parser():
|
|
|
134
136
|
# py_file_path = run(data_path=args.read, data=None, get_figure=None)
|
|
135
137
|
# final_program = f"""
|
|
136
138
|
# #!/bin/bash
|
|
137
|
-
# . $HOME/scripts/activate_ve '
|
|
139
|
+
# . $HOME/scripts/activate_ve '.venv'
|
|
138
140
|
# streamlit run {py_file_path}
|
|
139
141
|
# """
|
|
140
142
|
# PROGRAM_PATH.write_text(data=final_program, encoding="utf-8")
|
|
@@ -173,7 +175,7 @@ print_logo(logo="crocodile")
|
|
|
173
175
|
ve_root_from_file, ipython_profile = get_ve_path_and_ipython_profile(PathExtended(file))
|
|
174
176
|
ipython_profile = ipython_profile if ipython_profile is not None else "default"
|
|
175
177
|
# ve_activateion_line = get_ve_activate_line(ve_name=args.ve or ve_profile_suggested, a_path=str(PathExtended.cwd()))
|
|
176
|
-
activate_ve_line = get_ve_activate_line(ve_root=args.ve or ve_root_from_file or "$HOME/
|
|
178
|
+
activate_ve_line = get_ve_activate_line(ve_root=args.ve or ve_root_from_file or "$HOME/code/machineconfig/.venv")
|
|
177
179
|
final_program = f"""
|
|
178
180
|
#!/bin/bash
|
|
179
181
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
# from platform import system
|
|
6
|
-
from machineconfig.utils.path_reduced import
|
|
6
|
+
from machineconfig.utils.path_reduced import PathExtended as PathExtended, modify_text
|
|
7
7
|
from machineconfig.utils.options import display_options
|
|
8
8
|
from rich.panel import Panel
|
|
9
9
|
from rich.text import Text
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
from platform import system
|
|
6
6
|
from machineconfig.utils.utils import LIBRARY_ROOT, display_options
|
|
7
|
-
from machineconfig.utils.path_reduced import
|
|
7
|
+
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
8
8
|
from rich.console import Console
|
|
9
9
|
from rich.panel import Panel
|
|
10
10
|
from rich import box # Import box
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"""
|
|
3
3
|
|
|
4
4
|
# import subprocess
|
|
5
|
-
from machineconfig.utils.path_reduced import
|
|
5
|
+
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
6
6
|
from machineconfig.utils.utils2 import read_ini, read_toml
|
|
7
7
|
from machineconfig.utils.utils import LIBRARY_ROOT, DEFAULTS_PATH, print_code, choose_cloud_interactively, choose_multiple_options
|
|
8
8
|
from machineconfig.scripts.python.helpers.helpers2 import ES
|
|
@@ -1,21 +1,135 @@
|
|
|
1
1
|
"""Update repositories with fancy output
|
|
2
2
|
"""
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import git
|
|
4
|
+
import subprocess
|
|
5
|
+
import hashlib
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
5
8
|
from machineconfig.utils.utils import DEFAULTS_PATH
|
|
6
9
|
from machineconfig.utils.utils2 import read_ini
|
|
7
|
-
from platform import system
|
|
8
10
|
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
def _get_file_hash(file_path: Path) -> str | None:
|
|
13
|
+
"""Get SHA256 hash of a file, return None if file doesn't exist."""
|
|
14
|
+
if not file_path.exists():
|
|
15
|
+
return None
|
|
16
|
+
return hashlib.sha256(file_path.read_bytes()).hexdigest()
|
|
17
|
+
|
|
11
18
|
|
|
19
|
+
def _set_permissions_recursive(path: Path, executable: bool = True) -> None:
|
|
20
|
+
"""Set permissions recursively for a directory."""
|
|
21
|
+
if not path.exists():
|
|
22
|
+
return
|
|
23
|
+
|
|
24
|
+
if path.is_file():
|
|
25
|
+
if executable:
|
|
26
|
+
path.chmod(0o755)
|
|
27
|
+
else:
|
|
28
|
+
path.chmod(0o644)
|
|
29
|
+
elif path.is_dir():
|
|
30
|
+
path.chmod(0o755)
|
|
31
|
+
for item in path.rglob('*'):
|
|
32
|
+
_set_permissions_recursive(item, executable)
|
|
12
33
|
|
|
13
|
-
|
|
34
|
+
|
|
35
|
+
def _run_uv_sync(repo_path: Path) -> None:
|
|
36
|
+
"""Run uv sync in the given repository path."""
|
|
37
|
+
try:
|
|
38
|
+
print(f"🔄 Running uv sync in {repo_path}")
|
|
39
|
+
result = subprocess.run(
|
|
40
|
+
["uv", "sync"],
|
|
41
|
+
cwd=repo_path,
|
|
42
|
+
capture_output=True,
|
|
43
|
+
text=True,
|
|
44
|
+
check=True
|
|
45
|
+
)
|
|
46
|
+
print("✅ uv sync completed successfully")
|
|
47
|
+
if result.stdout:
|
|
48
|
+
print(f"📝 Output: {result.stdout}")
|
|
49
|
+
except subprocess.CalledProcessError as e:
|
|
50
|
+
print(f"❌ uv sync failed: {e}")
|
|
51
|
+
if e.stderr:
|
|
52
|
+
print(f"📝 Error: {e.stderr}")
|
|
53
|
+
except FileNotFoundError:
|
|
54
|
+
print("⚠️ uv command not found. Please install uv first.")
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _update_repository(repo: git.Repo) -> bool:
|
|
58
|
+
"""Update a single repository and return True if pyproject.toml or uv.lock changed."""
|
|
59
|
+
repo_path = Path(repo.working_dir)
|
|
60
|
+
print(f"🔄 {'Updating ' + str(repo_path):.^80}")
|
|
61
|
+
|
|
62
|
+
# Check if this repo has pyproject.toml or uv.lock
|
|
63
|
+
pyproject_path = repo_path / "pyproject.toml"
|
|
64
|
+
uv_lock_path = repo_path / "uv.lock"
|
|
65
|
+
|
|
66
|
+
# Get hashes before pull
|
|
67
|
+
pyproject_hash_before = _get_file_hash(pyproject_path)
|
|
68
|
+
uv_lock_hash_before = _get_file_hash(uv_lock_path)
|
|
69
|
+
|
|
70
|
+
try:
|
|
71
|
+
# Perform git pull for each remote
|
|
72
|
+
dependencies_changed = False
|
|
73
|
+
for remote in repo.remotes:
|
|
74
|
+
try:
|
|
75
|
+
print(f"📥 Pulling from {remote.name} {repo.active_branch.name}")
|
|
76
|
+
pull_info = remote.pull(repo.active_branch.name)
|
|
77
|
+
for info in pull_info:
|
|
78
|
+
if info.flags & info.FAST_FORWARD:
|
|
79
|
+
print("✅ Fast-forward pull completed")
|
|
80
|
+
elif info.flags & info.NEW_HEAD:
|
|
81
|
+
print("✅ Repository updated")
|
|
82
|
+
else:
|
|
83
|
+
print(f"✅ Pull completed: {info.flags}")
|
|
84
|
+
except Exception as e:
|
|
85
|
+
print(f"⚠️ Failed to pull from {remote.name}: {e}")
|
|
86
|
+
continue
|
|
87
|
+
|
|
88
|
+
# Check if pyproject.toml or uv.lock changed after pull
|
|
89
|
+
pyproject_hash_after = _get_file_hash(pyproject_path)
|
|
90
|
+
uv_lock_hash_after = _get_file_hash(uv_lock_path)
|
|
91
|
+
|
|
92
|
+
if pyproject_hash_before != pyproject_hash_after:
|
|
93
|
+
print("📋 pyproject.toml has changed")
|
|
94
|
+
dependencies_changed = True
|
|
95
|
+
|
|
96
|
+
if uv_lock_hash_before != uv_lock_hash_after:
|
|
97
|
+
print("🔒 uv.lock has changed")
|
|
98
|
+
dependencies_changed = True
|
|
99
|
+
|
|
100
|
+
# Special handling for machineconfig repository
|
|
101
|
+
if "machineconfig" in str(repo_path):
|
|
102
|
+
print("🛠 Special handling for machineconfig repository...")
|
|
103
|
+
scripts_path = Path.home() / "scripts"
|
|
104
|
+
if scripts_path.exists():
|
|
105
|
+
_set_permissions_recursive(scripts_path)
|
|
106
|
+
print(f"✅ Set permissions for {scripts_path}")
|
|
107
|
+
|
|
108
|
+
linux_jobs_path = repo_path / "src" / "machineconfig" / "jobs" / "linux"
|
|
109
|
+
if linux_jobs_path.exists():
|
|
110
|
+
_set_permissions_recursive(linux_jobs_path)
|
|
111
|
+
print(f"✅ Set permissions for {linux_jobs_path}")
|
|
112
|
+
|
|
113
|
+
lf_exe_path = repo_path / "src" / "machineconfig" / "settings" / "lf" / "linux" / "exe"
|
|
114
|
+
if lf_exe_path.exists():
|
|
115
|
+
_set_permissions_recursive(lf_exe_path)
|
|
116
|
+
print(f"✅ Set permissions for {lf_exe_path}")
|
|
117
|
+
|
|
118
|
+
return dependencies_changed
|
|
119
|
+
|
|
120
|
+
except Exception as e:
|
|
121
|
+
print(f"❌ Error updating repository {repo_path}: {e}")
|
|
122
|
+
return False
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def main(verbose: bool = True) -> str:
|
|
126
|
+
"""Main function to update all configured repositories."""
|
|
14
127
|
_ = verbose
|
|
15
|
-
repos: list[str] = ["~/code/
|
|
128
|
+
repos: list[str] = ["~/code/machineconfig", "~/code/machineconfig", ]
|
|
16
129
|
try:
|
|
17
130
|
tmp = read_ini(DEFAULTS_PATH)['general']['repos'].split(",")
|
|
18
|
-
if tmp[-1] == "":
|
|
131
|
+
if tmp[-1] == "":
|
|
132
|
+
tmp = tmp[:-1]
|
|
19
133
|
repos += tmp
|
|
20
134
|
except (FileNotFoundError, KeyError, IndexError):
|
|
21
135
|
print(f"""
|
|
@@ -34,57 +148,31 @@ def main(verbose: bool=True) -> str:
|
|
|
34
148
|
│ to_email = myemail@email.com
|
|
35
149
|
└────────────────────────────────────────────────────────────────""")
|
|
36
150
|
|
|
37
|
-
|
|
151
|
+
# Process repositories
|
|
152
|
+
repos_with_changes = []
|
|
38
153
|
for a_package_path in repos:
|
|
39
154
|
try:
|
|
40
|
-
|
|
41
|
-
repo = git.Repo(str(
|
|
42
|
-
|
|
155
|
+
expanded_path = PathExtended(a_package_path).expanduser()
|
|
156
|
+
repo = git.Repo(str(expanded_path), search_parent_directories=True)
|
|
157
|
+
|
|
158
|
+
# Update repository and check if dependencies changed
|
|
159
|
+
dependencies_changed = _update_repository(repo)
|
|
160
|
+
|
|
161
|
+
if dependencies_changed:
|
|
162
|
+
repos_with_changes.append(Path(repo.working_dir))
|
|
163
|
+
|
|
43
164
|
except Exception as ex:
|
|
44
|
-
print(f"""
|
|
45
|
-
|
|
46
|
-
Path: {a_package_path}
|
|
47
|
-
Exception: {ex}
|
|
165
|
+
print(f"""❌ Repository Error: Path: {a_package_path}
|
|
166
|
+
Exception: {ex}
|
|
48
167
|
{'-' * 50}""")
|
|
49
168
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if "machineconfig" in str(a_repo.working_dir): # special treatment because of executables.
|
|
54
|
-
an_addition = f"""
|
|
55
|
-
echo ""
|
|
56
|
-
echo "🔄 {("Updating " + str(a_repo.working_dir)).center(80, "═")}"
|
|
57
|
-
echo "🛠 Special handling for machineconfig repository..."
|
|
58
|
-
cd "{a_repo.working_dir}"
|
|
59
|
-
# git reset --hard
|
|
60
|
-
git pull origin &
|
|
61
|
-
chmod +x ~/scripts -R
|
|
62
|
-
chmod +x ~/code/machineconfig/src/machineconfig/jobs/linux -R
|
|
63
|
-
chmod +x ~/code/machineconfig/src/machineconfig/settings/lf/linux/exe -R
|
|
64
|
-
"""
|
|
65
|
-
additions.append(an_addition)
|
|
66
|
-
else:
|
|
67
|
-
additions.append(f"""
|
|
68
|
-
echo "🔄 {("Updating " + str(a_repo.working_dir)).center(80, "═")}"
|
|
69
|
-
cd "{a_repo.working_dir}"
|
|
70
|
-
{sep.join([f'git pull {remote.name} {a_repo.active_branch.name} &' for remote in a_repo.remotes])}
|
|
71
|
-
"""
|
|
72
|
-
)
|
|
73
|
-
program = "\n".join(additions)
|
|
169
|
+
# Run uv sync for repositories where pyproject.toml or uv.lock changed
|
|
170
|
+
for repo_path in repos_with_changes:
|
|
171
|
+
_run_uv_sync(repo_path)
|
|
74
172
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
echo "🔄 {("Updating " + str(a_repo.working_dir)).center(80, "═")}"
|
|
78
|
-
cd "{a_repo.working_dir}"
|
|
79
|
-
{sep.join([f'git pull {remote.name} {a_repo.active_branch.name}' for remote in a_repo.remotes])}
|
|
80
|
-
""" for a_repo in repos_objs])
|
|
81
|
-
else: raise NotImplementedError(f"""
|
|
82
|
-
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
83
|
-
┃ ⚠️ Unsupported System: {system()}
|
|
84
|
-
┃ ℹ️ This functionality is only available on Windows and Linux
|
|
85
|
-
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━""")
|
|
86
|
-
return program
|
|
173
|
+
# print("\n🎉 All repositories updated successfully!")
|
|
174
|
+
return """echo "🎉 All repositories updated successfully!" """
|
|
87
175
|
|
|
88
176
|
|
|
89
177
|
if __name__ == '__main__':
|
|
90
|
-
|
|
178
|
+
main()
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"""
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
from machineconfig.utils.path_reduced import
|
|
5
|
+
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
6
6
|
from machineconfig.profile.create import symlink_func
|
|
7
7
|
from machineconfig.utils.utils import LIBRARY_ROOT, REPO_ROOT
|
|
8
8
|
import argparse
|
|
@@ -17,8 +17,12 @@ from typing import Literal, TypeAlias, get_args, Iterable
|
|
|
17
17
|
|
|
18
18
|
from machineconfig.cluster.sessions_managers.zellij_local_manager import ZellijLocalManager
|
|
19
19
|
from machineconfig.utils.utils2 import randstr
|
|
20
|
+
import random
|
|
21
|
+
# import time
|
|
20
22
|
|
|
21
|
-
AGENTS: TypeAlias = Literal["cursor-agent", "gemini", "crush"
|
|
23
|
+
AGENTS: TypeAlias = Literal["cursor-agent", "gemini", "crush", "q",
|
|
24
|
+
# warp terminal
|
|
25
|
+
]
|
|
22
26
|
TabConfig = dict[str, tuple[str, str]] # tab name -> (cwd, command)
|
|
23
27
|
DEFAULT_AGENT_CAP = 6
|
|
24
28
|
|
|
@@ -105,6 +109,7 @@ def launch_agents(repo_root: Path, prompts: list[str], agent: AGENTS, *, max_age
|
|
|
105
109
|
for idx, a_prompt in enumerate(prompts):
|
|
106
110
|
prompt_path = tmp_dir / f"agent{idx}_prompt.txt"
|
|
107
111
|
prompt_path.write_text(a_prompt, encoding="utf-8")
|
|
112
|
+
cmd_path = tmp_dir / f"agent{idx}_cmd.sh"
|
|
108
113
|
match agent:
|
|
109
114
|
case "gemini":
|
|
110
115
|
# model = "gemini-2.5-pro"
|
|
@@ -122,27 +127,41 @@ def launch_agents(repo_root: Path, prompts: list[str], agent: AGENTS, *, max_age
|
|
|
122
127
|
cmd = f"""
|
|
123
128
|
export GEMINI_API_KEY={shlex.quote(api_key)}
|
|
124
129
|
echo "Using Gemini API key $GEMINI_API_KEY"
|
|
125
|
-
echo "Launching gemini agent with prompt from {shlex.quote(str(prompt_path))}"
|
|
126
130
|
cat {prompt_path}
|
|
127
131
|
GEMINI_API_KEY={shlex.quote(api_key)} bash -lc 'cat {safe_path} | gemini {model_arg} --yolo --prompt'
|
|
128
132
|
"""
|
|
129
133
|
case "cursor-agent":
|
|
130
134
|
# As originally implemented
|
|
131
135
|
cmd = f"""
|
|
132
|
-
|
|
133
|
-
cat {prompt_path}
|
|
136
|
+
|
|
134
137
|
cursor-agent --print --output-format text < {prompt_path}
|
|
138
|
+
|
|
135
139
|
"""
|
|
136
140
|
case "crush":
|
|
137
141
|
cmd = f"""
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
142
|
+
# cat {prompt_path} | crush run
|
|
143
|
+
crush run {prompt_path}
|
|
144
|
+
"""
|
|
145
|
+
case "q":
|
|
146
|
+
cmd = f"""
|
|
147
|
+
q chat --no-interactive --trust-all-tools {prompt_path}
|
|
141
148
|
"""
|
|
142
149
|
case _:
|
|
143
150
|
raise ValueError(f"Unsupported agent type: {agent}")
|
|
144
|
-
|
|
145
|
-
|
|
151
|
+
random_sleep_time = random.uniform(0, 5)
|
|
152
|
+
cmd_prefix = f"""
|
|
153
|
+
echo "Sleeping for {random_sleep_time:.2f} seconds to stagger agent startups..."
|
|
154
|
+
sleep {random_sleep_time:.2f}
|
|
155
|
+
echo "Launching `{agent}` with prompt from {prompt_path}"
|
|
156
|
+
echo "Launching `{agent}` with command from {cmd_path}"
|
|
157
|
+
echo "--------START OF AGENT OUTPUT--------"
|
|
158
|
+
sleep 0.1
|
|
159
|
+
"""
|
|
160
|
+
cmd_postfix = """
|
|
161
|
+
sleep 0.1
|
|
162
|
+
echo "---------END OF AGENT OUTPUT---------"
|
|
163
|
+
"""
|
|
164
|
+
cmd_path.write_text(cmd_prefix+cmd+cmd_postfix, encoding="utf-8")
|
|
146
165
|
fire_cmd = f"bash {shlex.quote(str(cmd_path))}"
|
|
147
166
|
tab_config[f"Agent{idx}"] = (str(repo_root), fire_cmd)
|
|
148
167
|
|
|
@@ -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
|
|
@@ -74,7 +74,7 @@ def main() -> None:
|
|
|
74
74
|
|
|
75
75
|
ve_root_from_file, ipy_profile = get_ve_path_and_ipython_profile(choice_file)
|
|
76
76
|
if ipy_profile is None: ipy_profile = "default"
|
|
77
|
-
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")
|
|
78
78
|
|
|
79
79
|
# Convert args.kw to dictionary
|
|
80
80
|
if choice_file.suffix == ".py":
|
|
@@ -258,7 +258,6 @@ except ImportError as _ex:
|
|
|
258
258
|
if "pudb" in command: command = f"pip install pudb & {command}"
|
|
259
259
|
new_line = "\n"
|
|
260
260
|
command = fr"""start cmd -Argument "/k {activate_ve_line.replace(".ps1", ".bat").replace(". ", "")} & {command.replace(new_line, " & ")} " """ # this works from powershell
|
|
261
|
-
# 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)
|
|
262
261
|
|
|
263
262
|
if args.submit_to_cloud:
|
|
264
263
|
command = f"""
|
|
@@ -339,5 +338,5 @@ python -m machineconfig.cluster.templates.cli_click --file {choice_file} """
|
|
|
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.
|
|
@@ -7,7 +8,7 @@ Currently, the only way to work around this is to predifine the host in ~/.ssh/c
|
|
|
7
8
|
|
|
8
9
|
import argparse
|
|
9
10
|
from machineconfig.utils.ssh import SSH
|
|
10
|
-
from machineconfig.utils.path_reduced import
|
|
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
|
|
|
Binary file
|
|
Binary file
|
|
@@ -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,7 +3,7 @@ from typing import Any, Callable, Optional
|
|
|
3
3
|
import inspect
|
|
4
4
|
import os
|
|
5
5
|
# import argparse
|
|
6
|
-
from machineconfig.utils.path_reduced import
|
|
6
|
+
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
7
7
|
# from machineconfig.utils.utils import choose_ssh_host
|
|
8
8
|
|
|
9
9
|
|
|
@@ -51,7 +51,6 @@ def parse_pyfile(file_path: str):
|
|
|
51
51
|
if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef))
|
|
52
52
|
]
|
|
53
53
|
module__doc__ = ast.get_docstring(parsed_ast)
|
|
54
|
-
# from crocodile.core import Display
|
|
55
54
|
main_option = f"RUN AS MAIN -- {module__doc__ if module__doc__ is not None else 'NoDocs'}"
|
|
56
55
|
options = [main_option]
|
|
57
56
|
for function in functions:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from machineconfig.utils.path_reduced import
|
|
1
|
+
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
2
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
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""NFS mounting script
|
|
2
2
|
"""
|
|
3
3
|
|
|
4
|
-
from machineconfig.utils.path_reduced import
|
|
4
|
+
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
5
5
|
from machineconfig.utils.ssh import SSH
|
|
6
6
|
from machineconfig.utils.terminal import Terminal
|
|
7
7
|
from machineconfig.utils.utils import display_options, PROGRAM_PATH, choose_ssh_host
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
from platform import system
|
|
5
5
|
from machineconfig.utils.ssh import SSH
|
|
6
6
|
from machineconfig.utils.terminal import Terminal
|
|
7
|
-
from machineconfig.utils.path_reduced import
|
|
7
|
+
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
8
8
|
from machineconfig.utils.utils import PROGRAM_PATH, choose_ssh_host
|
|
9
9
|
|
|
10
10
|
def main():
|
|
@@ -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
|
|
@@ -3,7 +3,7 @@ slidev
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
from machineconfig.utils.utils import CONFIG_PATH, PROGRAM_PATH, print_code
|
|
6
|
-
from machineconfig.utils.path_reduced import
|
|
6
|
+
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
7
7
|
from machineconfig.utils.terminal import Terminal
|
|
8
8
|
import subprocess
|
|
9
9
|
import platform
|