machineconfig 2.1__py3-none-any.whl → 2.2__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/sessions_managers/archive/create_zellij_template.py +2 -1
- machineconfig/cluster/templates/utils.py +0 -35
- machineconfig/jobs/python/check_installations.py +1 -1
- machineconfig/jobs/python_custom_installers/dev/code.py +0 -13
- machineconfig/jobs/python_generic_installers/config.json +1 -1
- machineconfig/profile/create.py +10 -5
- machineconfig/profile/create_hardlinks.py +3 -1
- machineconfig/profile/shell.py +8 -7
- machineconfig/scripts/__init__.py +0 -2
- machineconfig/scripts/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/linux/devops +6 -4
- 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_agents.cpython-313.pyc +0 -0
- machineconfig/scripts/python/ai/generate_files.py +14 -15
- machineconfig/scripts/python/ai/mcinit.py +8 -5
- machineconfig/scripts/python/archive/tmate_conn.py +5 -5
- machineconfig/scripts/python/archive/tmate_start.py +7 -7
- machineconfig/scripts/python/choose_wezterm_theme.py +35 -32
- machineconfig/scripts/python/cloud_copy.py +22 -13
- machineconfig/scripts/python/cloud_mount.py +35 -23
- machineconfig/scripts/python/cloud_repo_sync.py +38 -25
- machineconfig/scripts/python/cloud_sync.py +4 -4
- machineconfig/scripts/python/croshell.py +37 -28
- machineconfig/scripts/python/devops.py +45 -27
- machineconfig/scripts/python/devops_add_identity.py +15 -25
- machineconfig/scripts/python/devops_add_ssh_key.py +7 -7
- machineconfig/scripts/python/devops_backup_retrieve.py +17 -15
- machineconfig/scripts/python/devops_devapps_install.py +25 -20
- machineconfig/scripts/python/devops_update_repos.py +142 -57
- machineconfig/scripts/python/dotfile.py +16 -14
- machineconfig/scripts/python/fire_agents.py +24 -17
- machineconfig/scripts/python/fire_jobs.py +91 -55
- machineconfig/scripts/python/ftpx.py +24 -14
- machineconfig/scripts/python/get_zellij_cmd.py +8 -7
- machineconfig/scripts/python/helpers/cloud_helpers.py +33 -28
- machineconfig/scripts/python/helpers/helpers2.py +25 -14
- machineconfig/scripts/python/helpers/helpers4.py +44 -30
- machineconfig/scripts/python/helpers/helpers5.py +1 -1
- machineconfig/scripts/python/helpers/repo_sync_helpers.py +31 -9
- machineconfig/scripts/python/mount_nfs.py +8 -15
- machineconfig/scripts/python/mount_nw_drive.py +10 -5
- machineconfig/scripts/python/mount_ssh.py +8 -6
- machineconfig/scripts/python/repos.py +215 -57
- machineconfig/scripts/python/snapshot.py +0 -1
- machineconfig/scripts/python/start_slidev.py +10 -5
- machineconfig/scripts/python/start_terminals.py +22 -16
- machineconfig/scripts/python/viewer_template.py +0 -1
- machineconfig/scripts/python/wifi_conn.py +49 -75
- machineconfig/scripts/python/wsl_windows_transfer.py +8 -6
- machineconfig/settings/lf/linux/lfrc +1 -0
- machineconfig/setup_linux/web_shortcuts/croshell.sh +5 -0
- machineconfig/setup_linux/web_shortcuts/interactive.sh +1 -1
- machineconfig/setup_linux/web_shortcuts/ssh.sh +0 -4
- machineconfig/setup_windows/wt_and_pwsh/set_pwsh_theme.py +3 -12
- machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py +1 -1
- machineconfig/utils/code.py +3 -3
- machineconfig/utils/installer.py +2 -2
- machineconfig/utils/installer_utils/installer_abc.py +3 -4
- machineconfig/utils/installer_utils/installer_class.py +6 -4
- machineconfig/utils/links.py +103 -33
- machineconfig/utils/notifications.py +52 -38
- machineconfig/utils/options.py +16 -23
- machineconfig/utils/path_reduced.py +239 -205
- machineconfig/utils/procs.py +1 -1
- machineconfig/utils/source_of_truth.py +27 -0
- machineconfig/utils/ssh.py +9 -29
- machineconfig/utils/terminal.py +4 -2
- machineconfig/utils/upgrade_packages.py +91 -0
- machineconfig/utils/utils2.py +1 -2
- machineconfig/utils/utils5.py +23 -11
- machineconfig/utils/ve.py +4 -1
- {machineconfig-2.1.dist-info → machineconfig-2.2.dist-info}/METADATA +13 -13
- {machineconfig-2.1.dist-info → machineconfig-2.2.dist-info}/RECORD +78 -86
- machineconfig/jobs/python_custom_installers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/croshell.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_jobs.cpython-313.pyc +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/helpers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/helpers4.cpython-313.pyc +0 -0
- machineconfig/setup_linux/web_shortcuts/all.sh +0 -48
- machineconfig/setup_linux/web_shortcuts/update_system.sh +0 -48
- machineconfig/utils/utils.py +0 -97
- /machineconfig/setup_linux/web_shortcuts/{tmp.sh → android.sh} +0 -0
- {machineconfig-2.1.dist-info → machineconfig-2.2.dist-info}/WHEEL +0 -0
- {machineconfig-2.1.dist-info → machineconfig-2.2.dist-info}/top_level.txt +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"""ZT"""
|
|
2
2
|
|
|
3
3
|
import socket
|
|
4
|
-
from machineconfig.utils.
|
|
4
|
+
from machineconfig.utils.options import choose_ssh_host
|
|
5
|
+
from machineconfig.utils.code import write_shell_script_to_default_program_path
|
|
5
6
|
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
6
7
|
|
|
7
8
|
prefix = """
|
|
@@ -1,42 +1,7 @@
|
|
|
1
|
-
# """
|
|
2
|
-
# This module contains utility functions for the cluster module.
|
|
3
|
-
# """
|
|
4
1
|
|
|
5
|
-
# import inspect
|
|
6
|
-
# from machineconfig.utils.io_save import save_pickle
|
|
7
|
-
|
|
8
|
-
# from machineconfig.cluster.remote_machine import WorkloadParams
|
|
9
2
|
from typing import Optional
|
|
10
3
|
from machineconfig.utils.path_reduced import PathExtended, PLike
|
|
11
4
|
|
|
12
|
-
# def expensive_function(workload_params: WorkloadParams, sim_dict: Optional[dict[str, Any]] = None) -> P:
|
|
13
|
-
# import time
|
|
14
|
-
# from rich.progress import track
|
|
15
|
-
# print("Hello, I am one thread of an expensive function, and I just started running ...")
|
|
16
|
-
# print(f"Oh, I recieved this parameter: {sim_dict=} & {workload_params=} ")
|
|
17
|
-
# execution_time_in_seconds = 60 * 1
|
|
18
|
-
# steps = 100
|
|
19
|
-
# for _ in track(range(steps), description="Progress bar ..."):
|
|
20
|
-
# time.sleep(execution_time_in_seconds / steps) # Simulate work being done
|
|
21
|
-
# print(f"I'm done, I crunched numbers from {workload_params.idx_start} to {workload_params.idx_end}.")
|
|
22
|
-
# _ = workload_params.idx_max
|
|
23
|
-
|
|
24
|
-
# save_dir = PathExtended.tmp().joinpath("tmp_dirs/expensive_function_single_thread").joinpath(workload_params.save_suffix, f"thread_{workload_params.idx_start}_{workload_params.idx_end}")
|
|
25
|
-
# save_dir.mkdir(parents=True, exist_ok=True)
|
|
26
|
-
# save_pickle(obj={'a': 1}, path=save_dir.joinpath("trial_func_result.pkl"))
|
|
27
|
-
# return save_dir
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
# def assert_has_workload_params(func_or_method: Callable[..., Any]):
|
|
31
|
-
# if not inspect.isfunction(func_or_method) and not inspect.ismethod(func_or_method): raise TypeError(f"{func_or_method} is not a function or method.")
|
|
32
|
-
# try: params = inspect.signature(func_or_method).parameters
|
|
33
|
-
# except ValueError as e: raise ValueError(f"Failed to inspect signature of {func_or_method}: {e}") from e
|
|
34
|
-
# if 'workload_params' not in params: raise ValueError(f"{func_or_method.__name__}() does not have 'workload_params' parameter.")
|
|
35
|
-
# if params['workload_params'].kind != inspect.Parameter.POSITIONAL_OR_KEYWORD: raise ValueError(f"{func_or_method.__name__}() 'workload_params' parameter is not a positional or keyword parameter.")
|
|
36
|
-
# if params['workload_params'].default is not inspect.Parameter.empty: raise ValueError(f"{func_or_method.__name__}() 'workload_params' parameter should not have a default value.")
|
|
37
|
-
# return True
|
|
38
|
-
|
|
39
|
-
|
|
40
5
|
def to_cloud(
|
|
41
6
|
localpath: PLike,
|
|
42
7
|
cloud: str,
|
|
@@ -9,7 +9,7 @@ import platform
|
|
|
9
9
|
# from rich.console import Console
|
|
10
10
|
# from machineconfig.utils.utils2 import pprint
|
|
11
11
|
# # from rich.progress import track
|
|
12
|
-
from machineconfig.utils.
|
|
12
|
+
from machineconfig.utils.source_of_truth import LIBRARY_ROOT
|
|
13
13
|
# from machineconfig.utils.installer import get_installed_cli_apps
|
|
14
14
|
|
|
15
15
|
# from tqdm import tqdm
|
|
@@ -36,20 +36,7 @@ def main(version: Optional[str] = None):
|
|
|
36
36
|
{"⚠️" * 20}
|
|
37
37
|
""")
|
|
38
38
|
raise NotImplementedError(error_msg)
|
|
39
|
-
|
|
40
39
|
_ = version
|
|
41
|
-
|
|
42
|
-
print(f"""
|
|
43
|
-
{"=" * 150}
|
|
44
|
-
ℹ️ INFO | VS Code features:
|
|
45
|
-
📝 Powerful code editor with IntelliSense
|
|
46
|
-
🧩 Thousands of extensions available
|
|
47
|
-
🔍 Integrated debugging
|
|
48
|
-
🔄 Git integration
|
|
49
|
-
⚙️ Highly customizable
|
|
50
|
-
{"=" * 150}
|
|
51
|
-
""")
|
|
52
|
-
|
|
53
40
|
return install_script
|
|
54
41
|
|
|
55
42
|
|
|
@@ -219,7 +219,7 @@
|
|
|
219
219
|
"doc": "🚀 Fly through your shell history. Great Scott!",
|
|
220
220
|
"filename_template_linux_amd_64": "mcfly-v{}-x86_64-unknown-linux-musl.tar.gz",
|
|
221
221
|
"filename_template_linux_arm_64": "mcfly-v{}-aarch64-unknown-linux-musl.tar.gz",
|
|
222
|
-
"filename_template_windows_amd_64": "
|
|
222
|
+
"filename_template_windows_amd_64": "",
|
|
223
223
|
"filename_template_macos_amd_64": "mcfly-v{}-x86_64-apple-darwin.tar.gz",
|
|
224
224
|
"filename_template_macos_arm_64": "",
|
|
225
225
|
"filename_template_windows_arm_64": "",
|
machineconfig/profile/create.py
CHANGED
|
@@ -5,7 +5,9 @@ This script Takes away all config files from the computer, place them in one dir
|
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
7
|
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
8
|
-
from machineconfig.utils.
|
|
8
|
+
from machineconfig.utils.links import symlink_func, symlink_copy
|
|
9
|
+
from machineconfig.utils.options import display_options
|
|
10
|
+
from machineconfig.utils.source_of_truth import LIBRARY_ROOT, REPO_ROOT
|
|
9
11
|
from machineconfig.utils.utils2 import read_toml
|
|
10
12
|
from machineconfig.profile.shell import create_default_shell_profile
|
|
11
13
|
|
|
@@ -19,10 +21,14 @@ from typing import Optional, Any, TypedDict
|
|
|
19
21
|
|
|
20
22
|
system = platform.system() # Linux or Windows
|
|
21
23
|
ERROR_LIST: list[Any] = [] # append to this after every exception captured.
|
|
22
|
-
|
|
23
|
-
OTHER_SYSTEM = "windows" if system == "Linux" else "linux"
|
|
24
|
+
|
|
24
25
|
SYSTEM = system.lower()
|
|
25
26
|
|
|
27
|
+
def get_other_systems(current_system: str) -> list[str]:
|
|
28
|
+
all_systems = ["linux", "windows", "darwin"]
|
|
29
|
+
return [s for s in all_systems if s != current_system.lower()]
|
|
30
|
+
OTHER_SYSTEMS = get_other_systems(SYSTEM)
|
|
31
|
+
|
|
26
32
|
|
|
27
33
|
class SymlinkMapper(TypedDict):
|
|
28
34
|
this: str
|
|
@@ -38,7 +44,7 @@ def main_symlinks(choice: Optional[str] = None):
|
|
|
38
44
|
program_keys_raw: list[str] = list(symlink_mapper.keys())
|
|
39
45
|
program_keys: list[str] = []
|
|
40
46
|
for program_key in program_keys_raw:
|
|
41
|
-
if program_key in exclude or
|
|
47
|
+
if program_key in exclude or any([another_system in program_key for another_system in OTHER_SYSTEMS]):
|
|
42
48
|
continue
|
|
43
49
|
else:
|
|
44
50
|
program_keys.append(program_key)
|
|
@@ -53,7 +59,6 @@ def main_symlinks(choice: Optional[str] = None):
|
|
|
53
59
|
choice_selected = "all" # i.e. program_keys = program_keys
|
|
54
60
|
# overwrite = display_options(msg="Overwrite existing source file?", options=["yes", "no"], default="yes") == "yes"
|
|
55
61
|
from rich.prompt import Confirm
|
|
56
|
-
|
|
57
62
|
overwrite = Confirm.ask("Overwrite existing source file?", default=True)
|
|
58
63
|
else:
|
|
59
64
|
choice_selected = choice
|
|
@@ -6,7 +6,9 @@ This script Takes away all config files from the computer, place them in one dir
|
|
|
6
6
|
|
|
7
7
|
import platform
|
|
8
8
|
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
9
|
-
from machineconfig.utils.
|
|
9
|
+
from machineconfig.utils.links import symlink_copy as symlink_func
|
|
10
|
+
from machineconfig.utils.options import display_options
|
|
11
|
+
from machineconfig.utils.source_of_truth import LIBRARY_ROOT, REPO_ROOT
|
|
10
12
|
from machineconfig.utils.utils2 import read_toml
|
|
11
13
|
from machineconfig.profile.shell import create_default_shell_profile
|
|
12
14
|
|
machineconfig/profile/shell.py
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"""shell"""
|
|
2
2
|
|
|
3
3
|
from machineconfig.utils.utils2 import randstr
|
|
4
|
-
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
4
|
+
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
5
5
|
from machineconfig.utils.terminal import Terminal
|
|
6
|
-
from machineconfig.utils.
|
|
6
|
+
from machineconfig.utils.options import display_options
|
|
7
|
+
from machineconfig.utils.source_of_truth import LIBRARY_ROOT, REPO_ROOT
|
|
7
8
|
import platform
|
|
8
9
|
import os
|
|
9
10
|
from typing import Literal, Optional
|
|
@@ -27,9 +28,9 @@ def create_default_shell_profile() -> None:
|
|
|
27
28
|
profile_path = get_shell_profile_path()
|
|
28
29
|
profile = profile_path.read_text(encoding="utf-8")
|
|
29
30
|
if system == "Windows":
|
|
30
|
-
source = f""". {str(LIBRARY_ROOT.joinpath("settings/shells/pwsh/init.ps1").collapseuser()).replace("~", "$HOME")}"""
|
|
31
|
+
source = f""". {str(PathExtended(LIBRARY_ROOT).joinpath("settings/shells/pwsh/init.ps1").collapseuser()).replace("~", "$HOME")}"""
|
|
31
32
|
else:
|
|
32
|
-
source = f"""source {str(LIBRARY_ROOT.joinpath("settings/shells/bash/init.sh").collapseuser()).replace("~", "$HOME")}"""
|
|
33
|
+
source = f"""source {str(PathExtended(LIBRARY_ROOT).joinpath("settings/shells/bash/init.sh").collapseuser()).replace("~", "$HOME")}"""
|
|
33
34
|
|
|
34
35
|
if source in profile:
|
|
35
36
|
console.print(Panel("🔄 PROFILE | Skipping init script sourcing - already present in profile", title="[bold blue]Profile[/bold blue]", border_style="blue"))
|
|
@@ -116,9 +117,9 @@ def main_env_path(choice: Optional[str], profile_path: Optional[str]) -> None:
|
|
|
116
117
|
profile_path_obj = PathExtended(profile_path) if isinstance(profile_path, str) else get_shell_profile_path()
|
|
117
118
|
profile_path_obj.copy(name=profile_path_obj.name + ".orig_" + randstr())
|
|
118
119
|
console.print(f"💾 Created backup of profile: {profile_path_obj.name}.orig_*")
|
|
119
|
-
# Inline deprecated
|
|
120
|
+
# Inline deprecated modify_text: if file missing, seed with search text before modification
|
|
120
121
|
current = profile_path_obj.read_text(encoding="utf-8") if profile_path_obj.exists() else addition
|
|
121
|
-
updated =
|
|
122
|
+
updated = current if addition in current else current + "\n" + addition
|
|
122
123
|
profile_path_obj.write_text(updated, encoding="utf-8")
|
|
123
124
|
console.print(Panel("✅ PATH variables added to profile successfully", title="[bold blue]Environment[/bold blue]", border_style="blue"))
|
|
124
125
|
|
|
@@ -172,7 +173,7 @@ def main_add_sources_to_shell_profile(profile_path: Optional[str], choice: Optio
|
|
|
172
173
|
|
|
173
174
|
|
|
174
175
|
def main_add_patches_to_shell_profile(profile_path: Optional[str], choice: Optional[str]) -> None:
|
|
175
|
-
patches: list[str] = [item.as_posix() for item in LIBRARY_ROOT.joinpath(f"profile/patches/{system.lower()}").search()]
|
|
176
|
+
patches: list[str] = [item.as_posix() for item in PathExtended(LIBRARY_ROOT).joinpath(f"profile/patches/{system.lower()}").search()]
|
|
176
177
|
|
|
177
178
|
console.print(Panel("🩹 Adding patches to shell profile", title="[bold blue]Patches[/bold blue]", border_style="blue"))
|
|
178
179
|
|
|
Binary file
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
|
|
3
|
-
source ~/code/machineconfig/.venv/bin/activate
|
|
4
|
-
|
|
5
3
|
op_script=$HOME/tmp_results/shells/python_return_command.sh
|
|
6
4
|
if [ -f "$op_script" ]; then
|
|
7
5
|
rm $op_script
|
|
8
6
|
fi
|
|
9
7
|
|
|
10
|
-
#
|
|
11
|
-
python -m machineconfig.scripts.python.devops "$@"
|
|
8
|
+
# source ~/code/machineconfig/.venv/bin/activate
|
|
9
|
+
# python -m machineconfig.scripts.python.devops "$@"
|
|
10
|
+
# echo "🔄 Running devops script..."
|
|
11
|
+
uv run --no-dev --project $HOME/code/machineconfig python -m machineconfig.scripts.python.devops "$@"
|
|
12
|
+
# uv run --with machineconfig python -m machineconfig.scripts.python.devops "$@"
|
|
13
|
+
|
|
12
14
|
|
|
13
15
|
if [ -f "$op_script" ]; then
|
|
14
16
|
chmod +x $op_script
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
#!/usr/bin/env python3
|
|
3
2
|
"""Script to generate a markdown table with checkboxes for all Python files in the repo."""
|
|
4
3
|
|
|
@@ -9,19 +8,19 @@ def get_python_files(repo_root: Path) -> list[str]:
|
|
|
9
8
|
"""Get all Python files relative to repo root."""
|
|
10
9
|
# Get all .py files recursively
|
|
11
10
|
py_files = list(repo_root.glob("**/*.py"))
|
|
12
|
-
|
|
11
|
+
|
|
13
12
|
# Filter out files in .venv and __pycache__ directories
|
|
14
13
|
filtered_files = []
|
|
15
14
|
for file_path in py_files:
|
|
16
15
|
relative_path = file_path.relative_to(repo_root)
|
|
17
16
|
path_parts = relative_path.parts
|
|
18
|
-
|
|
17
|
+
|
|
19
18
|
# Skip files in .venv or __pycache__ directories
|
|
20
19
|
if any(part in {".venv", "__pycache__"} for part in path_parts):
|
|
21
20
|
continue
|
|
22
|
-
|
|
21
|
+
|
|
23
22
|
filtered_files.append(str(relative_path))
|
|
24
|
-
|
|
23
|
+
|
|
25
24
|
return sorted(filtered_files)
|
|
26
25
|
|
|
27
26
|
|
|
@@ -29,12 +28,12 @@ def generate_markdown_table(files: list[str]) -> str:
|
|
|
29
28
|
"""Generate markdown table with checkboxes."""
|
|
30
29
|
header = "# Python Files Checklist\n\n"
|
|
31
30
|
table = "| Index | File Path | Status |\n|-------|-----------|--------|\n"
|
|
32
|
-
|
|
31
|
+
|
|
33
32
|
for index, file_path in enumerate(files, start=1):
|
|
34
33
|
# Remove leading ./ if present
|
|
35
|
-
clean_path = file_path.lstrip(
|
|
34
|
+
clean_path = file_path.lstrip("./")
|
|
36
35
|
table += f"| {index} | {clean_path} | - [ ] |\n"
|
|
37
|
-
|
|
36
|
+
|
|
38
37
|
return header + table
|
|
39
38
|
|
|
40
39
|
|
|
@@ -44,27 +43,28 @@ def main() -> None:
|
|
|
44
43
|
if not repo_root.joinpath("pyproject.toml").exists():
|
|
45
44
|
raise RuntimeError(f" {repo_root} Not a repo root")
|
|
46
45
|
output_file = repo_root / ".ai" / "all_files_with_index.md"
|
|
47
|
-
|
|
46
|
+
|
|
48
47
|
print(f"Repo root: {repo_root}")
|
|
49
48
|
print(f"Output file: {output_file}")
|
|
50
|
-
|
|
49
|
+
|
|
51
50
|
# Ensure output directory exists
|
|
52
51
|
output_file.parent.mkdir(parents=True, exist_ok=True)
|
|
53
|
-
|
|
52
|
+
|
|
54
53
|
# Get Python files
|
|
55
54
|
python_files = get_python_files(repo_root)
|
|
56
55
|
print(f"Found {len(python_files)} Python files")
|
|
57
|
-
|
|
56
|
+
|
|
58
57
|
# Generate markdown
|
|
59
58
|
markdown_content = generate_markdown_table(python_files)
|
|
60
59
|
print(f"Generated markdown content length: {len(markdown_content)}")
|
|
61
|
-
|
|
60
|
+
|
|
62
61
|
# Write to file
|
|
63
62
|
output_file.write_text(markdown_content)
|
|
64
63
|
print(f"Generated {output_file} with {len(python_files)} Python files")
|
|
65
|
-
|
|
64
|
+
|
|
66
65
|
# Create 5 symlinks to repo_root at ~/code_copies/${repo_name}_copy_{i}
|
|
67
66
|
import pathlib
|
|
67
|
+
|
|
68
68
|
# import os
|
|
69
69
|
repo_root = pathlib.Path.cwd().resolve()
|
|
70
70
|
repo_name: str = pathlib.Path(repo_root).name
|
|
@@ -81,4 +81,3 @@ def main() -> None:
|
|
|
81
81
|
|
|
82
82
|
if __name__ == "__main__":
|
|
83
83
|
main()
|
|
84
|
-
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
1
|
from pathlib import Path
|
|
4
2
|
from typing import Optional
|
|
5
3
|
|
|
@@ -9,8 +7,10 @@ uv add --upgrade-package pylint pyright mypy pyrefly ty --dev # linters and typ
|
|
|
9
7
|
uv add --upgrade-package pytest --dev
|
|
10
8
|
"""
|
|
11
9
|
|
|
10
|
+
|
|
12
11
|
def get_repo_root(path: Path) -> Optional[Path]:
|
|
13
12
|
from git import Repo, InvalidGitRepositoryError
|
|
13
|
+
|
|
14
14
|
try:
|
|
15
15
|
repo = Repo(path, search_parent_directories=True)
|
|
16
16
|
root = repo.working_tree_dir
|
|
@@ -20,12 +20,15 @@ def get_repo_root(path: Path) -> Optional[Path]:
|
|
|
20
20
|
pass
|
|
21
21
|
return None
|
|
22
22
|
|
|
23
|
+
|
|
23
24
|
def add_ai_configs(repo_root: Path):
|
|
24
25
|
import machineconfig as mc
|
|
26
|
+
|
|
25
27
|
mc_root = Path(mc.__file__).parent
|
|
26
28
|
|
|
27
29
|
repo_root_resolved = get_repo_root(repo_root)
|
|
28
|
-
if repo_root_resolved is not None:
|
|
30
|
+
if repo_root_resolved is not None:
|
|
31
|
+
repo_root = repo_root_resolved # this means you can run the command from any subdirectory of the repo.
|
|
29
32
|
|
|
30
33
|
if repo_root.joinpath("pyproject.toml").exists() is False:
|
|
31
34
|
uv_init = input(f"{repo_root} does not seem to be a python project (no pyproject.toml found), would you like to initialize one? (y/n) ")
|
|
@@ -35,6 +38,7 @@ uv init --python 3.13
|
|
|
35
38
|
uv venv
|
|
36
39
|
"""
|
|
37
40
|
import subprocess
|
|
41
|
+
|
|
38
42
|
subprocess.run(command_to_run, shell=True, check=True)
|
|
39
43
|
else:
|
|
40
44
|
print("Terminating mcinit ...")
|
|
@@ -93,8 +97,7 @@ uv venv
|
|
|
93
97
|
if dot_git_ignore_path.exists():
|
|
94
98
|
dot_git_ignore_content = dot_git_ignore_path.read_text(encoding="utf-8")
|
|
95
99
|
to_add: list[str] = []
|
|
96
|
-
to_check_for: list[str] = [".links", "notebooks", ".ai", ".scripts",
|
|
97
|
-
"GEMINI.md", "CLAUDE.md", ".cursor", ".github"]
|
|
100
|
+
to_check_for: list[str] = [".links", "notebooks", ".ai", ".scripts", "GEMINI.md", "CLAUDE.md", ".cursor", ".github"]
|
|
98
101
|
for item in to_check_for:
|
|
99
102
|
if item not in dot_git_ignore_content:
|
|
100
103
|
to_add.append(item)
|
|
@@ -13,16 +13,16 @@ console = Console()
|
|
|
13
13
|
|
|
14
14
|
def get_conn_string(sess_name: str) -> str:
|
|
15
15
|
creds = configparser.ConfigParser()
|
|
16
|
-
creds.read(Path.home().joinpath(
|
|
17
|
-
sess_name = creds[
|
|
18
|
-
user_name = creds[
|
|
16
|
+
creds.read(Path.home().joinpath("dotfiles/creds/tmate/creds.ini"))
|
|
17
|
+
sess_name = creds["sessions_names"][sess_name]
|
|
18
|
+
user_name = creds["keys"]["username"]
|
|
19
19
|
return f"{user_name}/{sess_name}@sgp1.tmate.io"
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
def main():
|
|
23
23
|
console.print(Panel("🔌 Tmate Connection Manager", title="[bold]Welcome[/bold]"))
|
|
24
24
|
|
|
25
|
-
parser = argparse.ArgumentParser(description=
|
|
25
|
+
parser = argparse.ArgumentParser(description="Tmate launcher")
|
|
26
26
|
parser.add_argument("sess_name", help="session name", default=random.choices(list(string.digits + string.ascii_letters), k=20))
|
|
27
27
|
args = parser.parse_args()
|
|
28
28
|
|
|
@@ -37,5 +37,5 @@ def main():
|
|
|
37
37
|
console.print("✅ Connection closed")
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
if __name__ ==
|
|
40
|
+
if __name__ == "__main__":
|
|
41
41
|
main()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"""Tmate
|
|
2
|
-
|
|
1
|
+
"""Tmate"""
|
|
2
|
+
|
|
3
3
|
import argparse
|
|
4
4
|
import configparser
|
|
5
5
|
from pathlib import Path
|
|
@@ -17,10 +17,10 @@ def main():
|
|
|
17
17
|
|
|
18
18
|
console.print("[bold yellow]Loading credentials...[/bold yellow]")
|
|
19
19
|
creds = configparser.ConfigParser()
|
|
20
|
-
creds.read(Path.home().joinpath(
|
|
20
|
+
creds.read(Path.home().joinpath("dotfiles/creds/tmate/creds.ini"))
|
|
21
21
|
console.print("[green]Credentials loaded[/green]")
|
|
22
22
|
|
|
23
|
-
parser = argparse.ArgumentParser(description=
|
|
23
|
+
parser = argparse.ArgumentParser(description="Tmate launcher")
|
|
24
24
|
random_sess = random.choices(list(string.digits + string.ascii_letters), k=20)
|
|
25
25
|
_ = random_sess
|
|
26
26
|
parser.add_argument("sess_name", help="session name (new only with random string will be chosen if not passed)", default=None)
|
|
@@ -28,8 +28,8 @@ def main():
|
|
|
28
28
|
args = parser.parse_args()
|
|
29
29
|
|
|
30
30
|
console.print(f"🔍 Looking up session configuration: {args.sess_name}")
|
|
31
|
-
sess_name = creds[
|
|
32
|
-
api_key = creds[
|
|
31
|
+
sess_name = creds["sessions_names"][args.sess_name]
|
|
32
|
+
api_key = creds["keys"]["api_key"]
|
|
33
33
|
|
|
34
34
|
console.print(Panel(f"🚀 Starting tmate session: {sess_name}", title="[bold green]Session Info[/bold green]"))
|
|
35
35
|
|
|
@@ -40,5 +40,5 @@ def main():
|
|
|
40
40
|
console.print("[green]Tmate session ended[/green]")
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
if __name__ ==
|
|
43
|
+
if __name__ == "__main__":
|
|
44
44
|
main()
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Choose a theme for Wezterm
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from machineconfig.utils.
|
|
5
|
+
from machineconfig.utils.options import choose_one_option
|
|
6
|
+
from machineconfig.utils.path_reduced import PathExtended
|
|
6
7
|
from typing import Any
|
|
7
8
|
import time
|
|
8
9
|
from rich.panel import Panel
|
|
@@ -13,32 +14,32 @@ console = Console()
|
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
schemes_list = [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
17
|
+
"Pro",
|
|
18
|
+
"Spiderman",
|
|
19
|
+
"shades-of-purple",
|
|
20
|
+
"synthwave",
|
|
21
|
+
"Symfonic",
|
|
22
|
+
"PaulMillr",
|
|
23
|
+
"Neon",
|
|
24
|
+
"LiquidCarbonTransparentInverse",
|
|
25
|
+
"Laser",
|
|
26
|
+
"IR_Black",
|
|
27
|
+
"Hurtado",
|
|
28
|
+
"Homebrew",
|
|
29
|
+
"Hipster Green",
|
|
30
|
+
"Firefly Traditional",
|
|
31
|
+
"Elementary",
|
|
32
|
+
"deep",
|
|
33
|
+
"Dark Pastel",
|
|
34
|
+
"Bright Lights",
|
|
35
|
+
"Adventure",
|
|
36
|
+
"Nancy (terminal.sexy)",
|
|
37
|
+
"Bim (Gogh)",
|
|
38
|
+
"BlueDolphin",
|
|
39
|
+
"Borland",
|
|
40
|
+
"Grass (Gogh)",
|
|
41
|
+
"Greenscreen (light) (terminal.sexy)",
|
|
42
|
+
"Grayscale (dark) (terminal.sexy)",
|
|
42
43
|
]
|
|
43
44
|
|
|
44
45
|
|
|
@@ -54,10 +55,11 @@ def set_theme(theme: str):
|
|
|
54
55
|
txt_lines = PathExtended("~/.config/wezterm/wezterm.lua").expanduser().read_text(encoding="utf-8").splitlines()
|
|
55
56
|
res_lines = []
|
|
56
57
|
for line in txt_lines:
|
|
57
|
-
if
|
|
58
|
+
if "config.color_scheme = " in line:
|
|
58
59
|
res_lines.append(f"config.color_scheme = '{theme}'")
|
|
59
|
-
else:
|
|
60
|
-
|
|
60
|
+
else:
|
|
61
|
+
res_lines.append(line)
|
|
62
|
+
PathExtended("~/.config/wezterm/wezterm.lua").expanduser().write_text("\n".join(res_lines), encoding="utf-8")
|
|
61
63
|
time.sleep(0.1)
|
|
62
64
|
print("💾 Configuration saved")
|
|
63
65
|
|
|
@@ -70,6 +72,7 @@ def main():
|
|
|
70
72
|
curses.wrapper(accessory)
|
|
71
73
|
console.print(Panel("✅ Theme selection completed", title_align="left", border_style="green"))
|
|
72
74
|
|
|
75
|
+
|
|
73
76
|
def accessory(stdscr: Any):
|
|
74
77
|
options = schemes_list
|
|
75
78
|
current_option = 0
|
|
@@ -90,7 +93,7 @@ def accessory(stdscr: Any):
|
|
|
90
93
|
stdscr.addstr(i, 0, f" {option}")
|
|
91
94
|
|
|
92
95
|
# Display status line
|
|
93
|
-
status_line = f"🔍 Theme {current_option+1}/{len(options)} | ↑/↓: Navigate | Enter: Select"
|
|
96
|
+
status_line = f"🔍 Theme {current_option + 1}/{len(options)} | ↑/↓: Navigate | Enter: Select"
|
|
94
97
|
stdscr.addstr(page_size, 0, status_line)
|
|
95
98
|
|
|
96
99
|
# Get key press
|
|
@@ -101,6 +104,6 @@ def accessory(stdscr: Any):
|
|
|
101
104
|
current_option -= 1
|
|
102
105
|
elif key == curses.KEY_DOWN and current_option < len(options) - 1:
|
|
103
106
|
current_option += 1
|
|
104
|
-
elif key == ord(
|
|
107
|
+
elif key == ord("\n"): # Enter key
|
|
105
108
|
break # Exit the loop
|
|
106
109
|
set_theme(options[current_option])
|
|
@@ -18,6 +18,7 @@ from machineconfig.utils.utils2 import pprint
|
|
|
18
18
|
|
|
19
19
|
console = Console()
|
|
20
20
|
|
|
21
|
+
|
|
21
22
|
@retry(stop=stop_after_attempt(3), wait=wait_chain(wait_fixed(1), wait_fixed(4), wait_fixed(9)))
|
|
22
23
|
def get_securely_shared_file(url: Optional[str] = None, folder: Optional[str] = None) -> None:
|
|
23
24
|
console.print(Panel("🚀 Secure File Downloader", title="[bold blue]Downloader[/bold blue]", border_style="blue"))
|
|
@@ -63,7 +64,7 @@ def get_securely_shared_file(url: Optional[str] = None, folder: Optional[str] =
|
|
|
63
64
|
def arg_parser() -> None:
|
|
64
65
|
console.print(Panel("☁️ Cloud Copy Utility", title="[bold blue]Cloud Copy[/bold blue]", border_style="blue", width=152))
|
|
65
66
|
|
|
66
|
-
parser = argparse.ArgumentParser(description=
|
|
67
|
+
parser = argparse.ArgumentParser(description="🚀 Cloud CLI. It wraps rclone with sane defaults for optimum type time.")
|
|
67
68
|
|
|
68
69
|
# positional argument
|
|
69
70
|
parser.add_argument("source", help="📂 file/folder path to be taken from here.")
|
|
@@ -80,7 +81,7 @@ def arg_parser() -> None:
|
|
|
80
81
|
parser.add_argument("--zip", "-z", help="📦 unzip after receiving.", action="store_true", default=ArgsDefaults.zip_)
|
|
81
82
|
parser.add_argument("--os_specific", "-o", help="💻 choose path specific for this OS.", action="store_true", default=ArgsDefaults.os_specific)
|
|
82
83
|
|
|
83
|
-
parser.add_argument("--config", "-c",
|
|
84
|
+
parser.add_argument("--config", "-c", help="⚙️ path to cloud.json file.", default=None)
|
|
84
85
|
|
|
85
86
|
args = parser.parse_args()
|
|
86
87
|
args_dict = vars(args)
|
|
@@ -117,26 +118,34 @@ def arg_parser() -> None:
|
|
|
117
118
|
if cloud in source:
|
|
118
119
|
console.print(Panel(f"📥 DOWNLOADING FROM CLOUD\n☁️ Cloud: {cloud}\n📂 Source: {source.replace(cloud + ':', '')}\n🎯 Target: {target}", title="[bold blue]Download[/bold blue]", border_style="blue", width=152))
|
|
119
120
|
|
|
120
|
-
PathExtended(target).from_cloud(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
PathExtended(target).from_cloud(
|
|
122
|
+
cloud=cloud,
|
|
123
|
+
remotepath=source.replace(cloud + ":", ""),
|
|
124
|
+
unzip=args_obj.zip,
|
|
125
|
+
decrypt=args_obj.encrypt,
|
|
126
|
+
pwd=args_obj.pwd,
|
|
127
|
+
overwrite=args_obj.overwrite,
|
|
128
|
+
rel2home=args_obj.rel2home,
|
|
129
|
+
os_specific=args_obj.os_specific,
|
|
130
|
+
root=args_obj.root,
|
|
131
|
+
strict=False,
|
|
132
|
+
)
|
|
125
133
|
console.print(Panel("✅ Download completed successfully", title="[bold green]Success[/bold green]", border_style="green", width=152))
|
|
126
134
|
|
|
127
135
|
elif cloud in target:
|
|
128
136
|
console.print(Panel(f"📤 UPLOADING TO CLOUD\n☁️ Cloud: {cloud}\n📂 Source: {source}\n🎯 Target: {target.replace(cloud + ':', '')}", title="[bold blue]Upload[/bold blue]", border_style="blue", width=152))
|
|
129
137
|
|
|
130
|
-
res = PathExtended(source).to_cloud(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
share=args_obj.share)
|
|
138
|
+
res = PathExtended(source).to_cloud(
|
|
139
|
+
cloud=cloud, remotepath=target.replace(cloud + ":", ""), zip=args_obj.zip, encrypt=args_obj.encrypt, pwd=args_obj.pwd, rel2home=args_obj.rel2home, root=args_obj.root, os_specific=args_obj.os_specific, strict=False, share=args_obj.share
|
|
140
|
+
)
|
|
134
141
|
console.print(Panel("✅ Upload completed successfully", title="[bold green]Success[/bold green]", border_style="green", width=152))
|
|
135
142
|
|
|
136
143
|
if args_obj.share:
|
|
137
144
|
fname = f".share_url_{cloud}"
|
|
138
|
-
if PathExtended(source).is_dir():
|
|
139
|
-
|
|
145
|
+
if PathExtended(source).is_dir():
|
|
146
|
+
share_url_path = PathExtended(source).joinpath(fname)
|
|
147
|
+
else:
|
|
148
|
+
share_url_path = PathExtended(source).with_suffix(fname)
|
|
140
149
|
share_url_path.write_text(res.as_url_str(), encoding="utf-8")
|
|
141
150
|
console.print(Panel(f"🔗 SHARE URL GENERATED\n📝 URL file: {share_url_path}\n🌍 {res.as_url_str()}", title="[bold blue]Share[/bold blue]", border_style="blue", width=152))
|
|
142
151
|
else:
|