machineconfig 3.3__py3-none-any.whl → 3.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of machineconfig might be problematic. Click here for more details.

Files changed (88) hide show
  1. machineconfig/cluster/sessions_managers/wt_local_manager.py +1 -1
  2. machineconfig/cluster/sessions_managers/wt_remote_manager.py +1 -1
  3. machineconfig/cluster/sessions_managers/zellij_local_manager.py +1 -1
  4. machineconfig/cluster/sessions_managers/zellij_remote_manager.py +1 -1
  5. machineconfig/cluster/templates/utils.py +1 -1
  6. machineconfig/jobs/linux/msc/cli_agents.sh +18 -2
  7. machineconfig/jobs/python/python_ve_symlink.py +1 -1
  8. machineconfig/jobs/python/vscode/api.py +1 -1
  9. machineconfig/jobs/python/vscode/select_interpreter.py +2 -2
  10. machineconfig/jobs/python/vscode/sync_code.py +1 -1
  11. machineconfig/jobs/python_custom_installers/dev/bypass_paywall.py +1 -1
  12. machineconfig/jobs/python_custom_installers/dev/espanso.py +1 -1
  13. machineconfig/jobs/python_custom_installers/hx.py +1 -1
  14. machineconfig/jobs/python_generic_installers/config.json +0 -11
  15. machineconfig/profile/create.py +3 -3
  16. machineconfig/profile/shell.py +1 -1
  17. machineconfig/scripts/python/ai/mcinit.py +23 -67
  18. machineconfig/scripts/python/ai/solutions/__init__.py +0 -0
  19. machineconfig/scripts/python/ai/solutions/_shared.py +5 -0
  20. machineconfig/scripts/python/ai/solutions/claude/claude.py +8 -0
  21. machineconfig/scripts/python/ai/solutions/cline/cline.py +10 -0
  22. machineconfig/scripts/python/ai/solutions/copilot/github_copilot.py +35 -0
  23. machineconfig/scripts/python/ai/solutions/copilot/privacy.md +4 -0
  24. machineconfig/scripts/python/ai/solutions/crush/crush.json +216 -0
  25. machineconfig/scripts/python/ai/solutions/crush/crush.py +25 -0
  26. machineconfig/scripts/python/ai/solutions/crush/privacy.md +2 -0
  27. machineconfig/scripts/python/ai/solutions/cursor/cursors.py +10 -0
  28. machineconfig/scripts/python/ai/solutions/gemini/gemini.py +14 -0
  29. machineconfig/scripts/python/ai/solutions/generic.py +41 -0
  30. machineconfig/scripts/python/ai/solutions/kilocode/privacy.md +3 -0
  31. machineconfig/scripts/python/ai/solutions/opencode/opencode.json +4 -0
  32. machineconfig/scripts/python/ai/solutions/opencode/opencode.py +1 -0
  33. machineconfig/scripts/python/choose_wezterm_theme.py +1 -1
  34. machineconfig/scripts/python/cloud_copy.py +2 -2
  35. machineconfig/scripts/python/cloud_mount.py +2 -2
  36. machineconfig/scripts/python/cloud_repo_sync.py +3 -2
  37. machineconfig/scripts/python/croshell.py +12 -7
  38. machineconfig/scripts/python/devops_add_identity.py +1 -1
  39. machineconfig/scripts/python/devops_add_ssh_key.py +1 -1
  40. machineconfig/scripts/python/devops_backup_retrieve.py +4 -3
  41. machineconfig/scripts/python/devops_update_repos.py +2 -2
  42. machineconfig/scripts/python/dotfile.py +1 -1
  43. machineconfig/scripts/python/fire_agents.py +3 -3
  44. machineconfig/scripts/python/fire_agents_help_launch.py +2 -2
  45. machineconfig/scripts/python/fire_jobs.py +8 -8
  46. machineconfig/scripts/python/fire_jobs_layout_helper.py +2 -2
  47. machineconfig/scripts/python/ftpx.py +2 -2
  48. machineconfig/scripts/python/helpers/cloud_helpers.py +2 -1
  49. machineconfig/scripts/python/helpers/helpers2.py +4 -3
  50. machineconfig/scripts/python/helpers/helpers4.py +1 -1
  51. machineconfig/scripts/python/helpers/repo_sync_helpers.py +2 -2
  52. machineconfig/scripts/python/mount_nfs.py +1 -1
  53. machineconfig/scripts/python/mount_ssh.py +1 -1
  54. machineconfig/scripts/python/repos.py +6 -3
  55. machineconfig/scripts/python/repos_helper_clone.py +121 -0
  56. machineconfig/scripts/python/repos_helper_record.py +2 -2
  57. machineconfig/scripts/python/start_slidev.py +1 -1
  58. machineconfig/scripts/python/wsl_windows_transfer.py +1 -1
  59. machineconfig/setup_windows/wt_and_pwsh/install_nerd_fonts.py +1 -1
  60. machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py +3 -3
  61. machineconfig/utils/{utils2.py → accessories.py} +13 -29
  62. machineconfig/utils/code.py +2 -2
  63. machineconfig/utils/installer.py +2 -2
  64. machineconfig/utils/installer_utils/installer_abc.py +1 -1
  65. machineconfig/utils/installer_utils/installer_class.py +2 -2
  66. machineconfig/utils/io.py +94 -0
  67. machineconfig/utils/links.py +2 -2
  68. machineconfig/utils/notifications.py +0 -9
  69. machineconfig/utils/{path_reduced.py → path_extended.py} +1 -1
  70. machineconfig/utils/{path.py → path_helper.py} +1 -1
  71. machineconfig/utils/procs.py +1 -1
  72. machineconfig/utils/{utils5.py → scheduler.py} +3 -8
  73. machineconfig/utils/ssh.py +2 -2
  74. machineconfig/utils/terminal.py +12 -2
  75. machineconfig/utils/ve.py +2 -16
  76. {machineconfig-3.3.dist-info → machineconfig-3.5.dist-info}/METADATA +1 -4
  77. {machineconfig-3.3.dist-info → machineconfig-3.5.dist-info}/RECORD +87 -71
  78. machineconfig/utils/io_save.py +0 -95
  79. /machineconfig/scripts/python/ai/{chatmodes → solutions/copilot/chatmodes}/Thinking-Beast-Mode.chatmode.md +0 -0
  80. /machineconfig/scripts/python/ai/{chatmodes → solutions/copilot/chatmodes}/Ultimate-Transparent-Thinking-Beast-Mode.chatmode.md +0 -0
  81. /machineconfig/scripts/python/ai/{chatmodes → solutions/copilot/chatmodes}/deepResearch.chatmode.md +0 -0
  82. /machineconfig/scripts/python/ai/{instructions → solutions/copilot/instructions}/python/dev.instructions.md +0 -0
  83. /machineconfig/scripts/python/ai/{prompts → solutions/copilot/prompts}/allLintersAndTypeCheckers.prompt.md +0 -0
  84. /machineconfig/scripts/python/ai/{prompts → solutions/copilot/prompts}/research-report-skeleton.prompt.md +0 -0
  85. /machineconfig/scripts/python/ai/{configs/.gemini → solutions/gemini}/settings.json +0 -0
  86. {machineconfig-3.3.dist-info → machineconfig-3.5.dist-info}/WHEEL +0 -0
  87. {machineconfig-3.3.dist-info → machineconfig-3.5.dist-info}/entry_points.txt +0 -0
  88. {machineconfig-3.3.dist-info → machineconfig-3.5.dist-info}/top_level.txt +0 -0
@@ -1,8 +1,8 @@
1
1
  """Set Windows Terminal Settings"""
2
2
 
3
- from machineconfig.utils.utils2 import randstr, read_json
4
- from machineconfig.utils.path_reduced import PathExtended as PathExtended
5
- from machineconfig.utils.io_save import save_json
3
+ from machineconfig.utils.accessories import randstr
4
+ from machineconfig.utils.path_extended import PathExtended as PathExtended
5
+ from machineconfig.utils.io import read_json, save_json
6
6
  import platform
7
7
 
8
8
  # from uuid import uuid4
@@ -32,35 +32,6 @@ def split[T](iterable: list[T], every: int = 1, to: Optional[int] = None) -> lis
32
32
  return list(res)
33
33
 
34
34
 
35
- def read_ini(path: "Path", encoding: Optional[str] = None):
36
- if not Path(path).exists() or Path(path).is_dir():
37
- raise FileNotFoundError(f"File not found or is a directory: {path}")
38
- import configparser
39
-
40
- res = configparser.ConfigParser()
41
- res.read(filenames=[str(path)], encoding=encoding)
42
- return res
43
-
44
-
45
- def read_json(path: "Path", r: bool = False, **kwargs: Any) -> Any: # return could be list or dict etc
46
- import json
47
-
48
- try:
49
- mydict = json.loads(Path(path).read_text(encoding="utf-8"), **kwargs)
50
- except Exception:
51
- import pyjson5
52
-
53
- mydict = pyjson5.loads(Path(path).read_text(encoding="utf-8"), **kwargs) # file has C-style comments.
54
- _ = r
55
- return mydict
56
-
57
-
58
- def read_toml(path: "Path"):
59
- import tomli
60
-
61
- return tomli.loads(path.read_text(encoding="utf-8"))
62
-
63
-
64
35
  def pprint(obj: dict[Any, Any], title: str) -> None:
65
36
  from rich import inspect
66
37
 
@@ -86,3 +57,16 @@ def human_friendly_dict(d: dict[str, Any]) -> dict[str, Any]:
86
57
  else:
87
58
  result[k] = v
88
59
  return result
60
+
61
+
62
+ def get_repo_root(path: Path) -> Optional[Path]:
63
+ from git import Repo, InvalidGitRepositoryError
64
+
65
+ try:
66
+ repo = Repo(str(path), search_parent_directories=True)
67
+ root = repo.working_tree_dir
68
+ if root is not None:
69
+ return Path(root)
70
+ except InvalidGitRepositoryError:
71
+ pass
72
+ return None
@@ -5,9 +5,9 @@ from rich.console import Console
5
5
  from rich.panel import Panel
6
6
  from rich.syntax import Syntax
7
7
 
8
- from machineconfig.utils.utils2 import randstr
8
+ from machineconfig.utils.accessories import randstr
9
9
  from machineconfig.utils.ve import get_ve_activate_line
10
- from machineconfig.utils.path_reduced import PathExtended as PathExtended
10
+ from machineconfig.utils.path_extended import PathExtended as PathExtended
11
11
 
12
12
 
13
13
  def get_shell_script_executing_python_file(python_file: str, func: Optional[str], ve_path: str, strict_execution: bool = True):
@@ -6,9 +6,9 @@ from machineconfig.utils.schemas.installer.installer_types import APP_INSTALLER_
6
6
  from rich.console import Console
7
7
  from rich.panel import Panel # Added import
8
8
 
9
- from machineconfig.utils.path_reduced import PathExtended as PathExtended
9
+ from machineconfig.utils.path_extended import PathExtended as PathExtended
10
10
  from machineconfig.utils.source_of_truth import INSTALL_VERSION_ROOT
11
- from machineconfig.utils.utils2 import read_json
11
+ from machineconfig.utils.io import read_json
12
12
 
13
13
  from typing import Any
14
14
  import platform
@@ -1,4 +1,4 @@
1
- from machineconfig.utils.path_reduced import PathExtended as PathExtended
1
+ from machineconfig.utils.path_extended import PathExtended as PathExtended
2
2
  from machineconfig.utils.source_of_truth import WINDOWS_INSTALL_PATH, LINUX_INSTALL_PATH
3
3
  from typing import Optional
4
4
  import subprocess
@@ -1,8 +1,8 @@
1
- from machineconfig.utils.path_reduced import PathExtended as PathExtended
1
+ from machineconfig.utils.path_extended import PathExtended as PathExtended
2
2
  from machineconfig.utils.installer_utils.installer_abc import find_move_delete_linux, find_move_delete_windows
3
3
  from machineconfig.utils.source_of_truth import INSTALL_TMP_DIR, INSTALL_VERSION_ROOT, LIBRARY_ROOT
4
4
  from machineconfig.utils.options import check_tool_exists
5
- from machineconfig.utils.utils2 import read_json
5
+ from machineconfig.utils.io import read_json
6
6
  from machineconfig.utils.schemas.installer.installer_types import InstallerData, InstallerDataFiles
7
7
 
8
8
  import platform
@@ -0,0 +1,94 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Any, Union, Optional, Mapping
4
+ from pathlib import Path
5
+ import json
6
+ import pickle
7
+ import configparser
8
+
9
+
10
+ PathLike = Union[str, Path]
11
+
12
+
13
+ def _ensure_parent(path: PathLike) -> Path:
14
+ path_obj = Path(path)
15
+ path_obj.parent.mkdir(parents=True, exist_ok=True)
16
+ return path_obj
17
+
18
+
19
+ def save_pickle(obj: Any, path: PathLike, verbose: bool = False) -> Path:
20
+ path_obj = _ensure_parent(path)
21
+ with open(path_obj, "wb") as fh:
22
+ pickle.dump(obj, fh, protocol=pickle.HIGHEST_PROTOCOL)
23
+ if verbose:
24
+ print(f"Saved pickle -> {path_obj}")
25
+ return Path(path_obj)
26
+
27
+
28
+ def save_json(obj: Any, path: PathLike, indent: Optional[int] = None, verbose: bool = False) -> Path:
29
+ path_obj = _ensure_parent(path)
30
+ with open(path_obj, "w", encoding="utf-8") as fh:
31
+ json.dump(obj, fh, indent=indent, ensure_ascii=False)
32
+ fh.write("\n")
33
+ if verbose:
34
+ print(f"Saved json -> {path_obj}")
35
+ return Path(path_obj)
36
+
37
+
38
+ # def save_toml(obj: Mapping[str, Any], path: PathLike, verbose: bool = False) -> Path:
39
+ # path_obj = _ensure_parent(path)
40
+ # with open(path_obj, "w", encoding="utf-8") as fh:
41
+ # toml.dump(obj, fh)
42
+ # if verbose:
43
+ # print(f"Saved toml -> {path_obj}")
44
+ # return Path(path_obj)
45
+
46
+
47
+ # def save_yaml(obj: Any, path: PathLike, verbose: bool = False) -> Path:
48
+ # path_obj = _ensure_parent(path)
49
+ # with open(path_obj, "w", encoding="utf-8") as fh:
50
+ # yaml.safe_dump(obj, fh, sort_keys=False)
51
+ # if verbose:
52
+ # print(f"Saved yaml -> {path_obj}")
53
+ # return Path(path_obj)
54
+
55
+
56
+ def save_ini(path: PathLike, obj: Mapping[str, Mapping[str, Any]], verbose: bool = False) -> Path:
57
+ cp = configparser.ConfigParser()
58
+ for section, values in obj.items():
59
+ cp[section] = {str(k): str(v) for k, v in values.items()}
60
+ path_obj = _ensure_parent(path)
61
+ with open(path_obj, "w", encoding="utf-8") as fh:
62
+ cp.write(fh)
63
+ if verbose:
64
+ print(f"Saved ini -> {path_obj}")
65
+ return Path(path_obj)
66
+
67
+
68
+ def read_ini(path: "Path", encoding: Optional[str] = None):
69
+ if not Path(path).exists() or Path(path).is_dir():
70
+ raise FileNotFoundError(f"File not found or is a directory: {path}")
71
+ import configparser
72
+
73
+ res = configparser.ConfigParser()
74
+ res.read(filenames=[str(path)], encoding=encoding)
75
+ return res
76
+
77
+
78
+ def read_json(path: "Path", r: bool = False, **kwargs: Any) -> Any: # return could be list or dict etc
79
+ import json
80
+
81
+ try:
82
+ mydict = json.loads(Path(path).read_text(encoding="utf-8"), **kwargs)
83
+ except Exception:
84
+ import pyjson5
85
+
86
+ mydict = pyjson5.loads(Path(path).read_text(encoding="utf-8"), **kwargs) # file has C-style comments.
87
+ _ = r
88
+ return mydict
89
+
90
+
91
+ def from_pickle(path: Path) -> Any:
92
+ import pickle
93
+
94
+ return pickle.loads(path.read_bytes())
@@ -1,5 +1,5 @@
1
- from machineconfig.utils.path_reduced import PathExtended as PathExtended, PLike
2
- from machineconfig.utils.utils2 import randstr
1
+ from machineconfig.utils.path_extended import PathExtended as PathExtended, PLike
2
+ from machineconfig.utils.accessories import randstr
3
3
  from rich.console import Console
4
4
  from rich.panel import Panel
5
5
 
@@ -1,16 +1,8 @@
1
1
  """Notifications Module"""
2
2
 
3
- # from crocodile.core import install_n_import
4
- # from crocodile.file_management import P, Read
5
3
  from pathlib import Path
6
-
7
- # from crocodile.meta import RepeatUntilNoException
8
4
  import smtplib
9
5
  import imaplib
10
-
11
- # from email import message
12
- # from email import encoders
13
- # from email.mime.base import MIMEBase
14
6
  from email.mime.text import MIMEText
15
7
  from email.mime.multipart import MIMEMultipart
16
8
  from typing import Optional, Any, Union
@@ -192,7 +184,6 @@ encryption = ssl
192
184
  # else:
193
185
  # body_file_path = None
194
186
  # assert body is not None, "You must pass either body or body_file."
195
- # from crocodile.meta import Terminal
196
187
 
197
188
  # to_str = ",".join(to)
198
189
  # attachments_str = " ".join([f"--attachment {str(p)}" for p in attachments]) if attachments is not None else ""
@@ -1,4 +1,4 @@
1
- from machineconfig.utils.utils2 import randstr
1
+ from machineconfig.utils.accessories import randstr
2
2
 
3
3
  from datetime import datetime
4
4
  import time
@@ -1,4 +1,4 @@
1
- from machineconfig.utils.path_reduced import PathExtended as PathExtended
1
+ from machineconfig.utils.path_extended import PathExtended as PathExtended
2
2
  from machineconfig.utils.options import choose_one_option
3
3
  from machineconfig.utils.source_of_truth import EXCLUDE_DIRS
4
4
  from rich.console import Console
@@ -8,7 +8,7 @@ from typing import Optional, Any
8
8
  from rich.console import Console
9
9
  from rich.panel import Panel
10
10
  from datetime import datetime, timezone
11
- from machineconfig.utils.utils2 import pprint
11
+ from machineconfig.utils.accessories import pprint
12
12
 
13
13
  console = Console()
14
14
 
@@ -3,7 +3,8 @@ from typing import Callable, Optional, Union, Any, NoReturn, TypeVar, Protocol,
3
3
  import logging
4
4
  import time
5
5
  from datetime import datetime, timezone, timedelta
6
- from machineconfig.utils.path_reduced import PathExtended as PathExtended
6
+ from machineconfig.utils.io import from_pickle
7
+ from machineconfig.utils.path_extended import PathExtended as PathExtended
7
8
 
8
9
 
9
10
  class LoggerTemplate(Protocol):
@@ -108,7 +109,7 @@ class Scheduler:
108
109
  # "logfile": self.logger.file_path
109
110
  }
110
111
  summ.update(sess_stats)
111
- from machineconfig.utils.utils2 import get_repr
112
+ from machineconfig.utils.accessories import get_repr
112
113
 
113
114
  tmp = get_repr(summ)
114
115
  self.logger.critical("\n--> Scheduler has finished running a session. \n" + tmp + "\n" + "-" * 100)
@@ -157,12 +158,6 @@ def to_pickle(obj: Any, path: Path) -> None:
157
158
  path.write_bytes(pickle.dumps(obj))
158
159
 
159
160
 
160
- def from_pickle(path: Path) -> Any:
161
- import pickle
162
-
163
- return pickle.loads(path.read_bytes())
164
-
165
-
166
161
  class Cache(Generic[T]): # This class helps to accelrate access to latest data coming from expensive function. The class has two flavours, memory-based and disk-based variants."""
167
162
  # source_func: Callable[[], T]
168
163
  def __init__(
@@ -3,8 +3,8 @@ import os
3
3
  from dataclasses import dataclass
4
4
  import rich.console
5
5
  from machineconfig.utils.terminal import Terminal, Response, MACHINE
6
- from machineconfig.utils.path_reduced import PathExtended, PLike, OPLike
7
- from machineconfig.utils.utils2 import pprint
6
+ from machineconfig.utils.path_extended import PathExtended, PLike, OPLike
7
+ from machineconfig.utils.accessories import pprint
8
8
  # from machineconfig.utils.ve import get_ve_activate_line
9
9
 
10
10
 
@@ -1,4 +1,4 @@
1
- from machineconfig.utils.path_reduced import PathExtended, OPLike
1
+ from machineconfig.utils.path_extended import PathExtended, OPLike
2
2
  import subprocess
3
3
  from typing import Any, BinaryIO, Optional, Union
4
4
  import platform
@@ -219,9 +219,19 @@ class Terminal:
219
219
 
220
220
  @staticmethod
221
221
  def get_header(wdir: OPLike, toolbox: bool):
222
+ if toolbox:
223
+ toobox_code = """
224
+ try:
225
+ from crocodile.toolbox import *
226
+ except ImportError:
227
+ print("Crocodile not found, skipping import.")
228
+ pass
229
+ """
230
+ else:
231
+ toobox_code = "# No toolbox import."
222
232
  return f"""
223
233
  # >> Code prepended
224
- {"from crocodile.toolbox import *" if toolbox else "# No toolbox import."}
234
+ {toobox_code}
225
235
  {'''sys.path.insert(0, r'{wdir}') ''' if wdir is not None else "# No path insertion."}
226
236
  # >> End of header, start of script passed
227
237
  """
machineconfig/utils/ve.py CHANGED
@@ -1,8 +1,7 @@
1
- from machineconfig.utils.path_reduced import PathExtended as PathExtended
2
- from machineconfig.utils.utils2 import read_ini
1
+ from machineconfig.utils.path_extended import PathExtended as PathExtended
2
+ from machineconfig.utils.io import read_ini
3
3
  import platform
4
4
  from typing import Optional
5
- from pathlib import Path
6
5
 
7
6
 
8
7
  def get_ve_path_and_ipython_profile(init_path: PathExtended) -> tuple[Optional[str], Optional[str]]:
@@ -39,19 +38,6 @@ def get_ve_path_and_ipython_profile(init_path: PathExtended) -> tuple[Optional[s
39
38
  return ve_path, ipy_profile
40
39
 
41
40
 
42
- def get_repo_root(path: Path) -> Optional[Path]:
43
- from git import Repo, InvalidGitRepositoryError
44
-
45
- try:
46
- repo = Repo(str(path), search_parent_directories=True)
47
- root = repo.working_tree_dir
48
- if root is not None:
49
- return Path(root)
50
- except InvalidGitRepositoryError:
51
- pass
52
- return None
53
-
54
-
55
41
  def get_ve_activate_line(ve_root: str):
56
42
  if platform.system() == "Windows":
57
43
  activate_ve_line = f". {ve_root}/Scripts/activate.ps1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: machineconfig
3
- Version: 3.3
3
+ Version: 3.5
4
4
  Summary: Dotfiles management package
5
5
  Author-email: Alex Al-Saffar <programmer@usa.com>
6
6
  License: Apache 2.0
@@ -24,9 +24,6 @@ Requires-Dist: gitpython>=3.1.44
24
24
  Requires-Dist: pyfzf>=0.3.1
25
25
  Requires-Dist: rclone-python>=0.1.23
26
26
  Requires-Dist: pyjson5>=1.6.9
27
- Requires-Dist: pyyaml>=6.0.2
28
- Requires-Dist: toml>=0.10.2
29
- Requires-Dist: tomli>=2.2.1
30
27
  Provides-Extra: windows
31
28
  Requires-Dist: pywin32; extra == "windows"
32
29
  Provides-Extra: docs