machineconfig 7.49__py3-none-any.whl → 7.64__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/utils/maker.py +21 -11
- machineconfig/jobs/installer/custom/boxes.py +2 -2
- machineconfig/jobs/installer/custom/hx.py +16 -12
- machineconfig/jobs/installer/custom_dev/brave.py +1 -1
- machineconfig/jobs/installer/custom_dev/cloudflare_warp_cli.py +23 -0
- machineconfig/jobs/installer/custom_dev/code.py +4 -1
- machineconfig/jobs/installer/custom_dev/dubdb_adbc.py +1 -1
- machineconfig/jobs/installer/custom_dev/nerfont_windows_helper.py +1 -10
- machineconfig/jobs/installer/custom_dev/sysabc.py +119 -0
- machineconfig/jobs/installer/custom_dev/wezterm.py +2 -19
- machineconfig/jobs/installer/installer_data.json +739 -25
- machineconfig/jobs/installer/linux_scripts/redis.sh +1 -0
- machineconfig/jobs/installer/package_groups.py +49 -83
- machineconfig/logger.py +0 -1
- machineconfig/profile/create_links_export.py +21 -7
- machineconfig/profile/mapper.toml +1 -4
- machineconfig/scripts/linux/wrap_mcfg +1 -1
- machineconfig/scripts/python/croshell.py +20 -43
- machineconfig/scripts/python/devops.py +3 -4
- machineconfig/scripts/python/env_manager/path_manager_tui.py +1 -1
- machineconfig/scripts/python/fire_jobs.py +53 -39
- machineconfig/scripts/python/ftpx.py +4 -2
- machineconfig/scripts/python/helpers_agents/agentic_frameworks/fire_qwen.py +0 -12
- machineconfig/scripts/python/helpers_croshell/crosh.py +3 -3
- machineconfig/scripts/python/helpers_devops/cli_config.py +3 -19
- machineconfig/scripts/python/helpers_devops/cli_config_dotfile.py +22 -13
- machineconfig/scripts/python/helpers_devops/cli_self.py +12 -6
- machineconfig/scripts/python/helpers_devops/cli_share_file.py +2 -2
- machineconfig/scripts/python/helpers_devops/cli_share_server.py +1 -1
- machineconfig/scripts/python/helpers_devops/cli_terminal.py +1 -1
- machineconfig/scripts/python/helpers_devops/cli_utils.py +1 -152
- machineconfig/scripts/python/helpers_devops/devops_backup_retrieve.py +4 -4
- machineconfig/scripts/python/helpers_fire_command/file_wrangler.py +2 -20
- machineconfig/scripts/python/helpers_fire_command/fire_jobs_route_helper.py +3 -4
- machineconfig/scripts/python/helpers_msearch/scripts_linux/fzfg +1 -1
- machineconfig/scripts/python/helpers_repos/clone.py +0 -1
- machineconfig/scripts/python/helpers_repos/cloud_repo_sync.py +9 -3
- machineconfig/scripts/python/helpers_repos/count_lines_frontend.py +1 -1
- machineconfig/scripts/python/helpers_repos/entrypoint.py +2 -1
- machineconfig/scripts/python/helpers_repos/record.py +2 -1
- machineconfig/scripts/python/helpers_sessions/sessions_multiprocess.py +7 -7
- machineconfig/scripts/python/helpers_utils/download.py +151 -0
- machineconfig/scripts/python/helpers_utils/path.py +106 -0
- machineconfig/scripts/python/interactive.py +17 -26
- machineconfig/scripts/python/nw/devops_add_ssh_key.py +21 -5
- machineconfig/scripts/python/nw/ssh_debug_linux.py +7 -7
- machineconfig/scripts/python/nw/ssh_debug_windows.py +4 -4
- machineconfig/scripts/python/nw/wsl_windows_transfer.py +3 -2
- machineconfig/scripts/python/sessions.py +37 -22
- machineconfig/scripts/python/utils.py +8 -3
- machineconfig/scripts/windows/mounts/mount_ssh.ps1 +1 -1
- machineconfig/settings/shells/nushell/init.nu +2 -2
- machineconfig/settings/shells/wezterm/wezterm.lua +2 -0
- machineconfig/settings/shells/zsh/init.sh +1 -8
- machineconfig/settings/yazi/init.lua +45 -24
- machineconfig/settings/yazi/keymap_windows.toml +1 -2
- machineconfig/settings/yazi/shell/yazi_cd.ps1 +29 -5
- machineconfig/setup_linux/__init__.py +0 -1
- machineconfig/setup_linux/web_shortcuts/interactive.sh +12 -10
- machineconfig/setup_mac/__init__.py +2 -3
- machineconfig/setup_windows/__init__.py +0 -3
- machineconfig/setup_windows/web_shortcuts/interactive.ps1 +12 -10
- machineconfig/setup_windows/web_shortcuts/quick_init.ps1 +16 -0
- machineconfig/utils/code.py +2 -2
- machineconfig/utils/files/headers.py +2 -2
- machineconfig/utils/installer_utils/installer_class.py +42 -40
- machineconfig/utils/installer_utils/{installer.py → installer_cli.py} +61 -101
- machineconfig/utils/installer_utils/{installer_abc.py → installer_locator_utils.py} +0 -68
- machineconfig/utils/{installer.py → installer_utils/installer_runner.py} +11 -51
- machineconfig/utils/io.py +0 -1
- machineconfig/utils/meta.py +29 -15
- machineconfig/utils/options.py +1 -1
- machineconfig/utils/path_extended.py +40 -19
- machineconfig/utils/path_helper.py +75 -21
- machineconfig/utils/schemas/layouts/layout_types.py +1 -1
- machineconfig/utils/ssh.py +3 -3
- machineconfig-7.64.dist-info/METADATA +124 -0
- {machineconfig-7.49.dist-info → machineconfig-7.64.dist-info}/RECORD +84 -87
- machineconfig/jobs/installer/linux_scripts/pgsql.sh +0 -41
- machineconfig/jobs/installer/linux_scripts/timescaledb.sh +0 -71
- machineconfig/jobs/installer/powershell_scripts/archive_pygraphviz.ps1 +0 -12
- machineconfig/scripts/python/nw/add_ssh_key.py +0 -148
- machineconfig/settings/lf/linux/exe/fzf_nano.sh +0 -16
- machineconfig/setup_linux/apps.sh +0 -66
- machineconfig/setup_mac/apps.sh +0 -73
- machineconfig/setup_windows/apps.ps1 +0 -62
- machineconfig-7.49.dist-info/METADATA +0 -92
- /machineconfig/jobs/installer/linux_scripts/{warp-cli.sh → cloudflare_warp_cli.sh} +0 -0
- /machineconfig/{jobs/installer/powershell_scripts → setup_windows/ssh}/openssh-server_add_key.ps1 +0 -0
- /machineconfig/{jobs/installer/powershell_scripts → setup_windows/ssh}/openssh-server_copy-ssh-id.ps1 +0 -0
- {machineconfig-7.49.dist-info → machineconfig-7.64.dist-info}/WHEEL +0 -0
- {machineconfig-7.49.dist-info → machineconfig-7.64.dist-info}/entry_points.txt +0 -0
- {machineconfig-7.49.dist-info → machineconfig-7.64.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
GUI = [
|
|
3
|
+
"brave",
|
|
4
|
+
"code",
|
|
5
|
+
"git",
|
|
6
|
+
"wezterm",
|
|
7
|
+
]
|
|
2
8
|
|
|
3
9
|
# AI/LLM Tools - AI-powered coding and chat assistants
|
|
4
10
|
AGENTS = [
|
|
@@ -18,6 +24,7 @@ AGENTS = [
|
|
|
18
24
|
"kilocode",
|
|
19
25
|
"cline",
|
|
20
26
|
"auggie",
|
|
27
|
+
# "gorilla",
|
|
21
28
|
]
|
|
22
29
|
|
|
23
30
|
|
|
@@ -55,9 +62,14 @@ PACKAGES_CODE_EDITORS = [
|
|
|
55
62
|
# Database Tools - Database clients and visualizers
|
|
56
63
|
PACKAGES_DATABASE = [
|
|
57
64
|
"SqliteBrowser",
|
|
65
|
+
"sqlite3",
|
|
66
|
+
"redis",
|
|
67
|
+
"redis-cli",
|
|
68
|
+
"postgresql-client",
|
|
69
|
+
"duckdb",
|
|
58
70
|
"DBeaver",
|
|
59
71
|
"rainfrog",
|
|
60
|
-
|
|
72
|
+
|
|
61
73
|
]
|
|
62
74
|
|
|
63
75
|
|
|
@@ -137,21 +149,23 @@ PACKAGES_PRODUCTIVITY = [
|
|
|
137
149
|
"hx",
|
|
138
150
|
]
|
|
139
151
|
|
|
140
|
-
|
|
141
|
-
|
|
152
|
+
|
|
153
|
+
# sudo nala install cowsay -y || true
|
|
154
|
+
# sudo nala install lolcat -y || true
|
|
155
|
+
# sudo nala install boxes -y || true
|
|
156
|
+
# sudo nala install figlet -y || true
|
|
157
|
+
# sudo nala install fortune -y || true
|
|
158
|
+
# sudo nala install toilet -y || true
|
|
159
|
+
TERMINAL_EYE_CANDY = [
|
|
142
160
|
"lolcatjs",
|
|
143
161
|
"figlet-cli",
|
|
144
162
|
"boxes",
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
"
|
|
150
|
-
"
|
|
151
|
-
"obsidian",
|
|
152
|
-
"istio",
|
|
153
|
-
"cointop",
|
|
154
|
-
"nnn",
|
|
163
|
+
# "transmission",
|
|
164
|
+
# "bytehound",
|
|
165
|
+
# "xcrawl3r",
|
|
166
|
+
# "obsidian",
|
|
167
|
+
# "istio",
|
|
168
|
+
# "cointop",
|
|
155
169
|
]
|
|
156
170
|
|
|
157
171
|
|
|
@@ -190,6 +204,7 @@ PACKAGES_FILE = [
|
|
|
190
204
|
# "xplr",
|
|
191
205
|
# "joshuto",
|
|
192
206
|
# "lf",
|
|
207
|
+
# "nnn",
|
|
193
208
|
"yazi",
|
|
194
209
|
"tere",
|
|
195
210
|
# "exa",
|
|
@@ -207,6 +222,7 @@ PACKAGES_TERMINAL_SHELL = [
|
|
|
207
222
|
"zellij",
|
|
208
223
|
"mprocs",
|
|
209
224
|
"mcfly",
|
|
225
|
+
"atuin",
|
|
210
226
|
"starship",
|
|
211
227
|
"gotty",
|
|
212
228
|
"ttyd",
|
|
@@ -216,74 +232,24 @@ PACKAGES_TERMINAL_SHELL = [
|
|
|
216
232
|
|
|
217
233
|
|
|
218
234
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
"
|
|
223
|
-
"
|
|
224
|
-
"
|
|
225
|
-
"
|
|
226
|
-
"
|
|
227
|
-
"
|
|
228
|
-
"
|
|
229
|
-
"
|
|
230
|
-
"
|
|
231
|
-
"
|
|
232
|
-
"
|
|
233
|
-
"
|
|
234
|
-
"
|
|
235
|
-
"
|
|
236
|
-
"
|
|
237
|
-
"
|
|
238
|
-
"MISC_DEV",
|
|
239
|
-
"SYSTEM_MONITORS",
|
|
240
|
-
"FILE_TOOLS",
|
|
241
|
-
"FILE_VIEWERS",
|
|
242
|
-
"SEARCH",
|
|
243
|
-
"TERMINAL_SHELL",
|
|
244
|
-
"CLOUD_UTILS",
|
|
245
|
-
"WEB_TERMINAL",
|
|
246
|
-
]
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
# Main ESSENTIAL package list - combines all subgroups
|
|
251
|
-
ESSENTIAL = [
|
|
252
|
-
*PACKAGES_CODE_ANALYSIS,
|
|
253
|
-
*PACKAGES_SYSTEM_MONITORS,
|
|
254
|
-
*PACKAGES_TERMINAL_SHELL,
|
|
255
|
-
*PACKAGES_FILE,
|
|
256
|
-
]
|
|
257
|
-
DEV = [
|
|
258
|
-
*PACKAGES_TERMINAL_EMULATORS,
|
|
259
|
-
*PACKAGES_BROWSERS,
|
|
260
|
-
*PACKAGES_CODE_EDITORS,
|
|
261
|
-
*PACKAGES_DATABASE,
|
|
262
|
-
*PACKAGES_MEDIA,
|
|
263
|
-
*PACKAGES_FILE_SHARING,
|
|
264
|
-
*PACKAGES_DEV_UTILS,
|
|
265
|
-
*PACKAGES_CODE_ANALYSIS,
|
|
266
|
-
*PACKAGES_PRODUCTIVITY,
|
|
267
|
-
*PACKAGES_MISC_DEV,
|
|
268
|
-
]
|
|
269
|
-
|
|
270
|
-
PACKAGE_GROUP2NAMES: dict[PACKAGE_GROUPS, list[str]] = {
|
|
271
|
-
"ESSENTIAL": ESSENTIAL,
|
|
272
|
-
"DEV": DEV,
|
|
273
|
-
"AGENTS": AGENTS,
|
|
274
|
-
"TERMINAL_EMULATORS": PACKAGES_TERMINAL_EMULATORS,
|
|
275
|
-
"BROWSERS": PACKAGES_BROWSERS,
|
|
276
|
-
"CODE_EDITORS": PACKAGES_CODE_EDITORS,
|
|
277
|
-
"DATABASE": PACKAGES_DATABASE,
|
|
278
|
-
"MEDIA": PACKAGES_MEDIA,
|
|
279
|
-
"FILE_SHARING": PACKAGES_FILE_SHARING,
|
|
280
|
-
"DEV_UTILS": PACKAGES_DEV_UTILS,
|
|
281
|
-
"CODE_ANALYSIS": PACKAGES_CODE_ANALYSIS,
|
|
282
|
-
"PRODUCTIVITY": PACKAGES_PRODUCTIVITY,
|
|
283
|
-
"MISC_DEV": PACKAGES_MISC_DEV,
|
|
284
|
-
"SYSTEM_MONITORS": PACKAGES_SYSTEM_MONITORS,
|
|
285
|
-
"SEARCH": PACKAGES_FILE,
|
|
286
|
-
"TERMINAL_SHELL": PACKAGES_TERMINAL_SHELL,
|
|
235
|
+
PACKAGE_GROUP2NAMES: dict[str, list[str]] = {
|
|
236
|
+
"sysabc": ["sysabc"],
|
|
237
|
+
"termabc": [*PACKAGES_CODE_ANALYSIS, *PACKAGES_SYSTEM_MONITORS, *PACKAGES_TERMINAL_SHELL, *PACKAGES_FILE,],
|
|
238
|
+
"gui": GUI,
|
|
239
|
+
"dev": [*PACKAGES_TERMINAL_EMULATORS, *PACKAGES_BROWSERS, *PACKAGES_CODE_EDITORS, *PACKAGES_DATABASE, *PACKAGES_MEDIA, *PACKAGES_FILE_SHARING, *PACKAGES_DEV_UTILS, *PACKAGES_CODE_ANALYSIS, *PACKAGES_PRODUCTIVITY, *TERMINAL_EYE_CANDY,],
|
|
240
|
+
"dev-utils": PACKAGES_DEV_UTILS,
|
|
241
|
+
"term-eye-candy": TERMINAL_EYE_CANDY,
|
|
242
|
+
"agents": AGENTS,
|
|
243
|
+
"terminal-emulator": PACKAGES_TERMINAL_EMULATORS,
|
|
244
|
+
"shell": PACKAGES_TERMINAL_SHELL,
|
|
245
|
+
"browsers": PACKAGES_BROWSERS,
|
|
246
|
+
"code-editors": PACKAGES_CODE_EDITORS,
|
|
247
|
+
"code-analysis": PACKAGES_CODE_ANALYSIS,
|
|
248
|
+
"db": PACKAGES_DATABASE,
|
|
249
|
+
"media": PACKAGES_MEDIA,
|
|
250
|
+
"file-sharing": PACKAGES_FILE_SHARING,
|
|
251
|
+
"productivity": PACKAGES_PRODUCTIVITY,
|
|
252
|
+
"sys-monitor": PACKAGES_SYSTEM_MONITORS,
|
|
253
|
+
"search": PACKAGES_FILE,
|
|
287
254
|
}
|
|
288
255
|
|
|
289
|
-
_ = Union, Literal
|
machineconfig/logger.py
CHANGED
|
@@ -15,13 +15,18 @@ ON_CONFLICT_MAPPER: dict[str, ON_CONFLICT_STRICT] = {
|
|
|
15
15
|
"os": "overwrite-self-managed",
|
|
16
16
|
"bs": "backup-self-managed",
|
|
17
17
|
"od": "overwrite-default-path",
|
|
18
|
-
"bd": "backup-default-path"
|
|
18
|
+
"bd": "backup-default-path",
|
|
19
|
+
"throw-error": "throw-error",
|
|
20
|
+
"overwrite-self-managed": "overwrite-self-managed",
|
|
21
|
+
"backup-self-managed": "backup-self-managed",
|
|
22
|
+
"overwrite-default-path": "overwrite-default-path",
|
|
23
|
+
"backup-default-path": "backup-default-path",
|
|
19
24
|
}
|
|
20
25
|
|
|
21
26
|
|
|
22
27
|
def main_public_from_parser(method: Annotated[Literal["symlink", "s", "copy", "c"], typer.Option(..., "--method", "-m", help="Method to use for setting up the config file.")],
|
|
23
28
|
on_conflict: Annotated[ON_CONFLICT_LOOSE, typer.Option(..., "--on-conflict", "-o", help="Action to take on conflict")] = "throw-error",
|
|
24
|
-
which: Annotated[Optional[str], typer.Option(..., "--which", "-w", help="Specific items to process
|
|
29
|
+
which: Annotated[Optional[str], typer.Option(..., "--which", "-w", help="Specific items to process")] = "all",
|
|
25
30
|
interactive: Annotated[bool, typer.Option(..., "--interactive", "-i", help="Run in interactive mode")] = False):
|
|
26
31
|
"""Terminology:
|
|
27
32
|
SOURCE = Self-Managed-Config-File-Path
|
|
@@ -59,22 +64,31 @@ def main_public_from_parser(method: Annotated[Literal["symlink", "s", "copy", "c
|
|
|
59
64
|
|
|
60
65
|
def main_private_from_parser(method: Annotated[Literal["symlink", "s", "copy", "c"], typer.Option(..., help="Method to use for linking files")],
|
|
61
66
|
on_conflict: Annotated[ON_CONFLICT_LOOSE, typer.Option(..., help="Action to take on conflict")] = "throw-error",
|
|
62
|
-
which: Annotated[Optional[str], typer.Option(..., help="Specific items to process")] =
|
|
63
|
-
interactive: Annotated[bool, typer.Option(..., help="Run in interactive mode")] = False):
|
|
67
|
+
which: Annotated[Optional[str], typer.Option(..., "--which", "-w", help="Specific items to process")] = "all",
|
|
68
|
+
interactive: Annotated[bool, typer.Option(..., "--interactive", "-i", help="Run in interactive mode")] = False):
|
|
64
69
|
from machineconfig.profile.create_links import ConfigMapper, read_mapper
|
|
65
70
|
mapper_full = read_mapper()["private"]
|
|
66
71
|
if which is None:
|
|
67
|
-
|
|
72
|
+
if interactive is False:
|
|
73
|
+
typer.echo("[red]Error:[/] --which must be provided when not running in interactive mode.")
|
|
74
|
+
typer.Exit(code=1)
|
|
75
|
+
return
|
|
68
76
|
from machineconfig.utils.options import choose_from_options
|
|
69
77
|
items_chosen = choose_from_options(msg="Which symlink to create?", options=list(mapper_full.keys()), fzf=True, multi=True)
|
|
70
78
|
else:
|
|
71
|
-
|
|
79
|
+
if interactive is True:
|
|
80
|
+
typer.echo("[yellow]Warning:[/] --which is provided, but its not allowed to be used together with --interactive. Ignoring --interactive flag.")
|
|
81
|
+
typer.Exit(code=0)
|
|
82
|
+
return
|
|
72
83
|
if which == "all":
|
|
73
84
|
items_chosen = list(mapper_full.keys())
|
|
74
85
|
else:
|
|
75
86
|
items_chosen = which.split(",")
|
|
76
87
|
items_objections: dict[str, list[ConfigMapper]] = {item: mapper_full[item] for item in items_chosen if item in mapper_full}
|
|
77
|
-
|
|
88
|
+
if len(items_objections) == 0:
|
|
89
|
+
typer.echo("[red]Error:[/] No valid items selected.")
|
|
90
|
+
typer.Exit(code=1)
|
|
91
|
+
return
|
|
78
92
|
from machineconfig.profile.create_links import apply_mapper
|
|
79
93
|
method_map: dict[str, Literal["symlink", "copy"]] = {
|
|
80
94
|
"s": "symlink",
|
|
@@ -33,9 +33,6 @@ config2 = {this = '~/.cli-m365-all-connections.json', to_this = '~/dotfiles/cred
|
|
|
33
33
|
config3 = {this = '~/.cli-m365-connection.json', to_this = '~/dotfiles/creds/tokens/.cli-m365-connection.json'}
|
|
34
34
|
# config2 = {this = '~/.cli-m365-tokens.json', to_this = '~/dotfiles/creds/tokens/.cli-m365-tokens.json'}
|
|
35
35
|
|
|
36
|
-
# [bash_linux]
|
|
37
|
-
# bashrc = {this = '~/.inputrc', to_this = '~/dotfiles/shells/bash/.inputrc'}
|
|
38
|
-
|
|
39
36
|
[remmina]
|
|
40
37
|
data = {this = '~/.var/app/org.remmina.Remmina/data/remmina', to_this = '~/dotfiles/creds/RDP/remmina/data/remmina'}
|
|
41
38
|
|
|
@@ -166,7 +163,7 @@ config = {this = '~/.config/pudb/pudb.cfg', to_this = 'CONFIG_ROOT/settings/pudb
|
|
|
166
163
|
# AllUsersCurrentHost = {this = 'C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.PowerShell_profile.ps1', to_this = '~/dotfiles/shells/powershell/AllUsersCurrentHost/Microsoft.PowerShell_profile.ps1'}
|
|
167
164
|
# AllUsersAllHosts = {this = 'C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1', to_this = '~/dotfiles/shells/windows_powershell/AllUsersAllHosts/profile.ps1'}
|
|
168
165
|
|
|
169
|
-
[pwsh_windows]
|
|
166
|
+
# [pwsh_windows]
|
|
170
167
|
# CurrentUserCurrentHost = {this = '~/Documents/PowerShell/Microsoft.PowerShell_profile.ps1', to_this = 'CONFIG_ROOT/settings/shells/pwsh/init.ps1'}
|
|
171
168
|
# CurrentUserAllHosts = {this = '~/Documents/PowerShell/profile.ps1', to_this = 'CONFIG_ROOT/settings/shells/pwsh/profile.ps1'}
|
|
172
169
|
# AllUsersCurrentHost = {this = 'C:\Program Files\PowerShell\7\Microsoft.PowerShell_profile.ps1', to_this = 'CONFIG_ROOT/settings/shells/pwsh/init.ps1'}
|
|
@@ -13,7 +13,7 @@ wrap_in_shell_script() {
|
|
|
13
13
|
|
|
14
14
|
local command="$1"
|
|
15
15
|
shift
|
|
16
|
-
local RANDOM_NAME=$(
|
|
16
|
+
local RANDOM_NAME=$(uuidgen | tr -d '-' | head -c 16)
|
|
17
17
|
local OP_DIR="$HOME/tmp_results/tmp_scripts/machineconfig"
|
|
18
18
|
local OP_PROGRAM_PATH="$OP_DIR/${RANDOM_NAME}.sh"
|
|
19
19
|
export OP_PROGRAM_PATH
|
|
@@ -2,30 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
"""
|
|
4
4
|
croshell
|
|
5
|
+
|
|
5
6
|
"""
|
|
6
7
|
|
|
7
8
|
from typing import Annotated, Optional
|
|
8
9
|
import typer
|
|
9
10
|
|
|
10
11
|
|
|
11
|
-
|
|
12
12
|
def croshell(
|
|
13
13
|
path: Annotated[Optional[str], typer.Argument(help="path of file to read.")] = None,
|
|
14
14
|
python: Annotated[bool, typer.Option("--python", "-p", help="flag to use python over IPython.")] = False,
|
|
15
15
|
profile: Annotated[Optional[str], typer.Option("--profile", "-P", help="ipython profile to use, defaults to default profile.")] = None,
|
|
16
16
|
jupyter: Annotated[bool, typer.Option("--jupyter", "-j", help="run in jupyter interactive console")] = False,
|
|
17
17
|
vscode: Annotated[bool, typer.Option("--vscode", "-c", help="open the script in vscode")] = False,
|
|
18
|
-
streamlit_viewer: Annotated[bool, typer.Option("--streamlit", "-s", help="view in streamlit app")] = False,
|
|
18
|
+
# streamlit_viewer: Annotated[bool, typer.Option("--streamlit", "-s", help="view in streamlit app")] = False,
|
|
19
19
|
visidata: Annotated[bool, typer.Option("--visidata", "-v", help="open data file in visidata")] = False,
|
|
20
20
|
marimo: Annotated[bool, typer.Option("--marimo", "-m", help="open the notebook using marimo if available")] = False,
|
|
21
21
|
) -> None:
|
|
22
|
-
from machineconfig.scripts.python.helpers_croshell.crosh import
|
|
22
|
+
from machineconfig.scripts.python.helpers_croshell.crosh import get_read_python_file_pycode, get_read_data_pycode
|
|
23
23
|
from machineconfig.utils.meta import lambda_to_python_script
|
|
24
|
+
from machineconfig.utils.path_helper import get_choice_file
|
|
24
25
|
from machineconfig.utils.path_extended import PathExtended
|
|
25
26
|
from pathlib import Path
|
|
26
27
|
from machineconfig.utils.accessories import randstr
|
|
27
28
|
import json
|
|
28
|
-
from machineconfig.utils.options import choose_from_options
|
|
29
29
|
from rich.console import Console
|
|
30
30
|
from rich.panel import Panel
|
|
31
31
|
console = Console()
|
|
@@ -35,41 +35,18 @@ def croshell(
|
|
|
35
35
|
interactivity = "-i"
|
|
36
36
|
interpreter = "python" if python else "ipython"
|
|
37
37
|
ipython_profile: Optional[str] = profile
|
|
38
|
-
file_obj =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
elif path != "" and path is not None:
|
|
51
|
-
if streamlit_viewer:
|
|
52
|
-
# text = "📊 STARTING STREAMLIT VIEWER"
|
|
53
|
-
# console.print(Panel(text, title="[bold blue]Info[/bold blue]"))
|
|
54
|
-
# from machineconfig.scripts.python.viewer import run
|
|
55
|
-
# py_file_path = run(data_path=args.read, data=None, get_figure=None)
|
|
56
|
-
# final_program = f"""
|
|
57
|
-
# #!/bin/bash
|
|
58
|
-
# streamlit run {py_file_path}
|
|
59
|
-
# """
|
|
60
|
-
# PROGRAM_PATH.write_text(data=final_program, encoding="utf-8")
|
|
61
|
-
print("Streamlit viewer is not yet implemented in this version.")
|
|
62
|
-
return None
|
|
63
|
-
file_obj = PathExtended(str(path).lstrip()).expanduser().absolute()
|
|
64
|
-
program = lambda_to_python_script(lambda: get_read_data_pycode(path=str(file_obj)), in_global=True, import_module=False)
|
|
65
|
-
text = f"📄 Reading data from: {file_obj.name}"
|
|
66
|
-
console.print(Panel(text, title="[bold blue]Info[/bold blue]"))
|
|
38
|
+
file_obj = Path.cwd() # initialization value, could be modified according to args.
|
|
39
|
+
if path is not None:
|
|
40
|
+
choice_file = get_choice_file(path=path, suffixes={".*"})
|
|
41
|
+
if choice_file.suffix == ".py":
|
|
42
|
+
program = choice_file.read_text(encoding="utf-8")
|
|
43
|
+
text = f"📄 Selected file: {choice_file.name}"
|
|
44
|
+
console.print(Panel(text, title="[bold blue]Info[/bold blue]"))
|
|
45
|
+
else:
|
|
46
|
+
program = lambda_to_python_script(lambda: get_read_data_pycode(path=str(choice_file)), in_global=True, import_module=False)
|
|
47
|
+
text = f"📄 Reading data from: {file_obj.name}"
|
|
48
|
+
console.print(Panel(text, title="[bold blue]Info[/bold blue]"))
|
|
67
49
|
else: # if nothing is specified, then run in interactive mode.
|
|
68
|
-
# text = "⌨️ Entering interactive mode"
|
|
69
|
-
# console.print(Panel(text, title="[bold blue]Info[/bold blue]"))
|
|
70
|
-
# from machineconfig.scripts.python.croshell import InteractiveShell
|
|
71
|
-
# InteractiveShell().run()
|
|
72
|
-
# return None
|
|
73
50
|
program = ""
|
|
74
51
|
preprogram = """
|
|
75
52
|
#%%
|
|
@@ -91,7 +68,7 @@ def croshell(
|
|
|
91
68
|
pyfile.parent.mkdir(parents=True, exist_ok=True)
|
|
92
69
|
|
|
93
70
|
title = "Reading Data"
|
|
94
|
-
def_code = lambda_to_python_script(lambda:
|
|
71
|
+
def_code = lambda_to_python_script(lambda: get_read_python_file_pycode(path=str(pyfile), title=title), in_global=False, import_module=False)
|
|
95
72
|
# print(def_code)
|
|
96
73
|
python_program = preprogram + "\n\n" + def_code + program
|
|
97
74
|
pyfile.write_text(python_program, encoding="utf-8")
|
|
@@ -130,7 +107,7 @@ def croshell(
|
|
|
130
107
|
fire_line = f"uv run --python 3.14 --with visidata,pyarrow vd {str(file_obj)}"
|
|
131
108
|
elif marimo:
|
|
132
109
|
if Path.home().joinpath("code/machineconfig").exists(): requirements = f"""--with marimo --project "{str(Path.home().joinpath("code/machineconfig"))}" """
|
|
133
|
-
else: requirements = """--python 3.14 --with "marimo,machineconfig[plot]>=7.
|
|
110
|
+
else: requirements = """--python 3.14 --with "marimo,cowsay,machineconfig[plot]>=7.64" """
|
|
134
111
|
fire_line = f"""
|
|
135
112
|
cd {str(pyfile.parent)}
|
|
136
113
|
uv run --python 3.14 --with "marimo" marimo convert {pyfile.name} -o marimo_nb.py
|
|
@@ -138,14 +115,14 @@ uv run {requirements} marimo edit --host 0.0.0.0 marimo_nb.py
|
|
|
138
115
|
"""
|
|
139
116
|
elif jupyter:
|
|
140
117
|
if Path.home().joinpath("code/machineconfig").exists(): requirements = f"""--project "{str(Path.home().joinpath("code/machineconfig"))}" --with jupyterlab """
|
|
141
|
-
else: requirements = """--with "machineconfig[plot]>=7.
|
|
118
|
+
else: requirements = """--with "cowsay,machineconfig[plot]>=7.64" """
|
|
142
119
|
fire_line = f"uv run {requirements} jupyter-lab {str(nb_target)}"
|
|
143
120
|
elif vscode:
|
|
144
121
|
fire_line = f"""
|
|
145
122
|
cd {str(pyfile.parent)}
|
|
146
123
|
uv init --python 3.14
|
|
147
124
|
uv venv
|
|
148
|
-
uv add "machineconfig[plot]>=7.
|
|
125
|
+
uv add "cowsay,machineconfig[plot]>=7.64"
|
|
149
126
|
# code serve-web
|
|
150
127
|
code --new-window {str(pyfile)}
|
|
151
128
|
"""
|
|
@@ -153,7 +130,7 @@ code --new-window {str(pyfile)}
|
|
|
153
130
|
if interpreter == "ipython": profile = f" --profile {ipython_profile} --no-banner"
|
|
154
131
|
else: profile = ""
|
|
155
132
|
if Path.home().joinpath("code/machineconfig").exists(): ve_line = f"""--project "{str(Path.home().joinpath("code/machineconfig"))}" """
|
|
156
|
-
else: ve_line = """--python 3.14 --with "machineconfig[plot]>=7.
|
|
133
|
+
else: ve_line = """--python 3.14 --with "cowsay,machineconfig[plot]>=7.64" """
|
|
157
134
|
# ve_path_maybe, ipython_profile_maybe = get_ve_path_and_ipython_profile(Path.cwd())
|
|
158
135
|
# --python 3.14
|
|
159
136
|
fire_line = f"uv run {ve_line} {interpreter} {interactivity} {profile} {str(pyfile)}"
|
|
@@ -12,17 +12,16 @@ import machineconfig.scripts.python.helpers_devops.cli_nw as cli_network
|
|
|
12
12
|
|
|
13
13
|
def install(which: Annotated[Optional[str], typer.Argument(..., help="Comma-separated list of program names to install, or group name if --group flag is set.")] = None,
|
|
14
14
|
group: Annotated[bool, typer.Option(..., "--group", "-g", help="Treat 'which' as a group name. A group is bundle of apps.")] = False,
|
|
15
|
-
interactive: Annotated[bool, typer.Option(..., "--interactive", "-
|
|
15
|
+
interactive: Annotated[bool, typer.Option(..., "--interactive", "-i", help="Interactive selection of programs to install.")] = False,
|
|
16
16
|
) -> None:
|
|
17
|
-
"""📦 Install
|
|
18
|
-
import machineconfig.utils.installer_utils.
|
|
17
|
+
"""📦 Install packages"""
|
|
18
|
+
import machineconfig.utils.installer_utils.installer_cli as installer_entry_point
|
|
19
19
|
installer_entry_point.main(which=which, group=group, interactive=interactive)
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
def get_app():
|
|
23
23
|
app = typer.Typer(help="🛠️ DevOps operations", no_args_is_help=True, add_help_option=False,
|
|
24
24
|
add_completion=False)
|
|
25
|
-
_ = install
|
|
26
25
|
app.command("install", no_args_is_help=True, help="🛠️ [i] Install essential packages")(install)
|
|
27
26
|
app.command("i", no_args_is_help=True, help="Install essential packages", hidden=True)(install)
|
|
28
27
|
app_repos = cli_repos.get_app()
|