machineconfig 8.12__py3-none-any.whl → 8.45__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/remote/run_cluster.py +1 -1
- machineconfig/cluster/remote/run_remote.py +1 -1
- machineconfig/cluster/sessions_managers/utils/maker.py +10 -8
- machineconfig/cluster/sessions_managers/wt_local.py +1 -1
- machineconfig/cluster/sessions_managers/wt_local_manager.py +1 -1
- machineconfig/cluster/sessions_managers/zellij_local.py +1 -1
- machineconfig/cluster/sessions_managers/zellij_local_manager.py +1 -1
- machineconfig/jobs/installer/checks/check_installations.py +133 -0
- machineconfig/jobs/installer/checks/install_utils.py +132 -0
- machineconfig/jobs/installer/checks/report_utils.py +39 -0
- machineconfig/jobs/installer/checks/vt_utils.py +89 -0
- machineconfig/jobs/installer/installer_data.json +225 -140
- machineconfig/jobs/installer/linux_scripts/docker.sh +6 -9
- machineconfig/jobs/installer/package_groups.py +10 -9
- machineconfig/jobs/installer/python_scripts/boxes.py +1 -2
- machineconfig/jobs/installer/python_scripts/code.py +10 -8
- machineconfig/jobs/installer/python_scripts/hx.py +30 -13
- machineconfig/jobs/installer/python_scripts/nerfont_windows_helper.py +6 -5
- machineconfig/jobs/installer/python_scripts/sysabc.py +25 -19
- machineconfig/jobs/installer/python_scripts/yazi.py +33 -17
- machineconfig/jobs/scripts/powershell_scripts/cmatrix.ps1 +52 -0
- machineconfig/jobs/scripts/powershell_scripts/mount_ssh.ps1 +1 -1
- machineconfig/jobs/scripts_dynamic/a.py +413 -10
- machineconfig/profile/create_links.py +77 -20
- machineconfig/profile/create_links_export.py +40 -51
- machineconfig/profile/mapper_data.toml +30 -0
- machineconfig/profile/mapper_dotfiles.toml +253 -0
- machineconfig/scripts/python/agents.py +70 -172
- machineconfig/scripts/python/ai/initai.py +3 -1
- machineconfig/scripts/python/ai/scripts/__init__.py +1 -0
- machineconfig/scripts/python/ai/scripts/lint_and_type_check.ps1 +2 -0
- machineconfig/scripts/python/ai/scripts/lint_and_type_check.sh +7 -5
- machineconfig/scripts/python/ai/solutions/claude/claude.py +1 -1
- machineconfig/scripts/python/ai/solutions/cline/cline.py +1 -1
- machineconfig/scripts/python/ai/solutions/copilot/github_copilot.py +1 -1
- machineconfig/scripts/python/ai/solutions/copilot/instructions/python/dev.instructions.md +29 -0
- machineconfig/scripts/python/ai/solutions/crush/crush.py +1 -1
- machineconfig/scripts/python/ai/solutions/cursor/cursors.py +1 -1
- machineconfig/scripts/python/ai/solutions/gemini/gemini.py +1 -1
- machineconfig/scripts/python/ai/solutions/gemini/settings.json +3 -0
- machineconfig/scripts/python/ai/{solutions → utils}/generic.py +2 -15
- machineconfig/scripts/python/ai/utils/vscode_tasks.py +6 -3
- machineconfig/scripts/python/cloud.py +58 -11
- machineconfig/scripts/python/croshell.py +4 -156
- machineconfig/scripts/python/devops.py +57 -40
- machineconfig/scripts/python/devops_navigator.py +17 -3
- machineconfig/scripts/python/fire_jobs.py +8 -207
- machineconfig/scripts/python/ftpx.py +5 -225
- machineconfig/scripts/python/graph/cli_graph.json +8743 -0
- machineconfig/scripts/python/{env_manager → helper_env}/path_manager_tui.py +2 -2
- machineconfig/scripts/python/{env_manager → helpers/helper_env}/env_manager_tui.py +1 -1
- machineconfig/scripts/python/helpers/helper_env/path_manager_tui.py +228 -0
- machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_crush.py +1 -1
- machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_cursor_agents.py +1 -1
- machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_gemini.py +1 -1
- machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_qwen.py +1 -1
- machineconfig/scripts/python/helpers/helpers_agents/agents_impl.py +168 -0
- machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/fire_agents_help_launch.py +5 -5
- machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/cloud_copy.py +6 -6
- machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/cloud_mount.py +10 -5
- machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/cloud_sync.py +3 -3
- machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/helpers2.py +1 -1
- machineconfig/scripts/python/helpers/helpers_croshell/croshell_impl.py +225 -0
- machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/scheduler.py +4 -4
- machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/start_slidev.py +7 -6
- machineconfig/scripts/python/helpers/helpers_devops/backup_config.py +149 -0
- machineconfig/scripts/python/helpers/helpers_devops/cli_backup_retrieve.py +267 -0
- machineconfig/scripts/python/helpers/helpers_devops/cli_config.py +98 -0
- machineconfig/scripts/python/helpers/helpers_devops/cli_config_dotfile.py +274 -0
- machineconfig/scripts/python/helpers/helpers_devops/cli_data.py +76 -0
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_nw.py +52 -72
- machineconfig/scripts/python/helpers/helpers_devops/cli_repos.py +265 -0
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_self.py +45 -21
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_share_file.py +44 -30
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_share_server.py +26 -43
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_share_terminal.py +12 -6
- machineconfig/scripts/python/helpers/helpers_devops/cli_ssh.py +167 -0
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/devops_status.py +12 -6
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/devops_update_repos.py +1 -1
- machineconfig/scripts/python/{interactive.py → helpers/helpers_devops/interactive.py} +69 -45
- machineconfig/scripts/python/helpers/helpers_devops/run_script.py +197 -0
- machineconfig/scripts/python/helpers/helpers_devops/themes/choose_starship_theme.ps1 +41 -0
- machineconfig/scripts/python/helpers/helpers_devops/themes/choose_starship_theme.sh +48 -0
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/themes/choose_wezterm_theme.py +3 -3
- machineconfig/scripts/python/helpers/helpers_fire_command/fire_jobs_impl.py +233 -0
- machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/fire_jobs_route_helper.py +3 -3
- machineconfig/scripts/python/helpers/helpers_msearch/msearch_impl.py +248 -0
- machineconfig/scripts/python/{helpers_msearch → helpers/helpers_msearch}/scripts_linux/fzfg +4 -3
- machineconfig/scripts/python/helpers/helpers_msearch/scripts_linux/search_with_context.sh +48 -0
- machineconfig/scripts/python/{helpers_msearch → helpers/helpers_msearch}/scripts_windows/fzfg.ps1 +1 -1
- machineconfig/scripts/python/helpers/helpers_navigator/__init__.py +20 -0
- machineconfig/scripts/python/helpers/helpers_navigator/cli_graph_loader.py +234 -0
- machineconfig/scripts/python/{helpers_navigator → helpers/helpers_navigator}/command_builder.py +61 -13
- machineconfig/scripts/python/helpers/helpers_navigator/command_detail.py +153 -0
- machineconfig/scripts/python/helpers/helpers_navigator/command_tree.py +45 -0
- machineconfig/scripts/python/{helpers_navigator → helpers/helpers_navigator}/data_models.py +18 -11
- machineconfig/scripts/python/{helpers_navigator → helpers/helpers_navigator}/main_app.py +5 -5
- machineconfig/scripts/python/helpers/helpers_network/__init__.py +0 -0
- machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/address.py +15 -17
- machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/address_switch.py +1 -1
- machineconfig/scripts/python/helpers/helpers_network/ftpx_impl.py +276 -0
- machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/mount_ssh.py +2 -2
- machineconfig/scripts/python/helpers/helpers_network/ssh_add_identity.py +73 -0
- machineconfig/scripts/python/helpers/helpers_network/ssh_add_ssh_key.py +175 -0
- machineconfig/scripts/python/helpers/helpers_network/ssh_debug_linux.py +319 -0
- machineconfig/scripts/python/helpers/helpers_network/ssh_debug_windows.py +275 -0
- machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/action.py +3 -3
- machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/action_helper.py +3 -3
- machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/cloud_repo_sync.py +116 -33
- machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/grource.py +3 -2
- machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/record.py +33 -13
- machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/repo_analyzer_2.py +63 -19
- machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/update.py +0 -6
- machineconfig/scripts/python/helpers/helpers_search/script_help.py +81 -0
- machineconfig/scripts/python/helpers/helpers_sessions/__init__.py +0 -0
- machineconfig/scripts/python/helpers/helpers_sessions/sessions_impl.py +177 -0
- machineconfig/scripts/python/{helpers_sessions → helpers/helpers_sessions}/sessions_multiprocess.py +1 -1
- machineconfig/scripts/python/helpers/helpers_terminal/__init__.py +0 -0
- machineconfig/scripts/python/helpers/helpers_terminal/terminal_impl.py +96 -0
- machineconfig/scripts/python/{helpers_utils → helpers/helpers_utils}/download.py +1 -1
- machineconfig/scripts/python/{helpers_utils → helpers/helpers_utils}/python.py +49 -29
- machineconfig/scripts/python/helpers/helpers_utils/specs.py +246 -0
- machineconfig/scripts/python/mcfg_entry.py +133 -48
- machineconfig/scripts/python/msearch.py +15 -61
- machineconfig/scripts/python/sessions.py +59 -194
- machineconfig/scripts/python/terminal.py +18 -96
- machineconfig/scripts/python/utils.py +101 -20
- machineconfig/settings/atuin/config.toml +294 -0
- machineconfig/settings/atuin/themes/catppuccin-mocha-mauve.toml +12 -0
- machineconfig/settings/linters/.ruff.toml +1 -0
- machineconfig/settings/mprocs/windows/mprocs.yaml +2 -2
- machineconfig/settings/shells/bash/init.sh +6 -3
- machineconfig/settings/shells/pwsh/init.ps1 +69 -1
- machineconfig/settings/shells/pwsh/search_pwsh_history.ps1 +99 -0
- machineconfig/settings/shells/wezterm/wezterm.lua +4 -1
- machineconfig/settings/shells/wt/settings.json +20 -7
- machineconfig/settings/shells/zsh/init.sh +34 -4
- machineconfig/settings/television/cable_unix/bash-history.toml +1 -1
- machineconfig/settings/television/cable_windows/pwsh-history.toml +1 -1
- machineconfig/settings/tv/config.toml +234 -0
- machineconfig/settings/tv/themes/catppuccin-mocha-sky.toml +22 -0
- machineconfig/settings/wsl/.wslconfig +5 -30
- machineconfig/settings/yazi/yazi_linux.toml +18 -8
- machineconfig/settings/zellij/layouts/st.kdl +2 -2
- machineconfig/settings/zellij/layouts/st2.kdl +1 -1
- machineconfig/setup_linux/web_shortcuts/interactive.sh +10 -10
- machineconfig/setup_linux/web_shortcuts/live_from_github.sh +3 -0
- machineconfig/setup_mac/__init__.py +0 -2
- machineconfig/setup_windows/__init__.py +0 -1
- machineconfig/setup_windows/web_shortcuts/interactive.ps1 +14 -13
- machineconfig/setup_windows/web_shortcuts/live_from_github.ps1 +4 -3
- machineconfig/setup_windows/web_shortcuts/quick_init.ps1 +3 -3
- machineconfig/type_hinting/sql/__init__.py +1 -0
- machineconfig/type_hinting/sql/base.py +216 -0
- machineconfig/type_hinting/sql/core_schema.py +64 -0
- machineconfig/type_hinting/sql/core_schema_typeddict.py +41 -0
- machineconfig/type_hinting/sql/typeddict_codegen.py +222 -0
- machineconfig/type_hinting/typedict/__init__.py +1 -0
- machineconfig/type_hinting/typedict/ast_utils.py +130 -0
- machineconfig/type_hinting/typedict/generator_helpers.py +319 -0
- machineconfig/type_hinting/typedict/generators.py +231 -0
- machineconfig/type_hinting/typedict/polars_schema.py +24 -0
- machineconfig/type_hinting/typedict/polars_schema_typeddict.py +63 -0
- machineconfig/utils/accessories.py +24 -0
- machineconfig/utils/code.py +79 -37
- machineconfig/utils/files/ascii_art.py +10 -14
- machineconfig/utils/files/headers.py +3 -5
- machineconfig/utils/files/read.py +8 -1
- machineconfig/utils/installer_utils/github_release_bulk.py +1 -0
- machineconfig/utils/installer_utils/install_from_url.py +1 -1
- machineconfig/utils/installer_utils/installer_class.py +12 -4
- machineconfig/utils/installer_utils/installer_cli.py +1 -15
- machineconfig/utils/installer_utils/installer_helper.py +2 -2
- machineconfig/utils/installer_utils/installer_locator_utils.py +13 -13
- machineconfig/utils/installer_utils/installer_runner.py +4 -4
- machineconfig/utils/meta.py +6 -4
- machineconfig/utils/options.py +49 -19
- machineconfig/utils/options_utils/__init__.py +0 -0
- machineconfig/utils/options_utils/options_tv_linux.py +211 -0
- machineconfig/utils/options_utils/options_tv_windows.py +88 -0
- machineconfig/utils/options_utils/tv_options.py +37 -0
- machineconfig/utils/path_extended.py +6 -6
- machineconfig/utils/scheduler.py +8 -2
- machineconfig/utils/schemas/fire_agents/fire_agents_input.py +1 -1
- machineconfig/utils/source_of_truth.py +6 -1
- machineconfig/utils/ssh.py +73 -22
- machineconfig/utils/ssh_utils/abc.py +1 -1
- machineconfig/utils/ssh_utils/copy_from_here.py +2 -2
- machineconfig/utils/ssh_utils/utils.py +2 -2
- machineconfig/utils/ssh_utils/wsl.py +107 -170
- machineconfig/utils/ssh_utils/wsl_helper.py +217 -0
- machineconfig/utils/upgrade_packages.py +4 -8
- {machineconfig-8.12.dist-info → machineconfig-8.45.dist-info}/METADATA +29 -22
- {machineconfig-8.12.dist-info → machineconfig-8.45.dist-info}/RECORD +249 -211
- machineconfig/jobs/installer/check_installations.py +0 -248
- machineconfig/jobs/scripts/bash_scripts/mint_keyboard_shortcuts.sh +0 -30
- machineconfig/profile/backup.toml +0 -49
- machineconfig/profile/mapper.toml +0 -263
- machineconfig/scripts/python/helpers_devops/cli_config.py +0 -105
- machineconfig/scripts/python/helpers_devops/cli_config_dotfile.py +0 -89
- machineconfig/scripts/python/helpers_devops/cli_data.py +0 -25
- machineconfig/scripts/python/helpers_devops/cli_repos.py +0 -208
- machineconfig/scripts/python/helpers_devops/devops_backup_retrieve.py +0 -80
- machineconfig/scripts/python/helpers_devops/run_script.py +0 -168
- machineconfig/scripts/python/helpers_devops/themes/choose_starship_theme.bash +0 -3
- machineconfig/scripts/python/helpers_navigator/__init__.py +0 -20
- machineconfig/scripts/python/helpers_navigator/command_detail.py +0 -44
- machineconfig/scripts/python/helpers_navigator/command_tree.py +0 -620
- machineconfig/scripts/python/helpers_network/ssh_add_identity.py +0 -116
- machineconfig/scripts/python/helpers_network/ssh_add_ssh_key.py +0 -153
- machineconfig/scripts/python/helpers_network/ssh_debug_linux.py +0 -391
- machineconfig/scripts/python/helpers_network/ssh_debug_windows.py +0 -338
- machineconfig/scripts/python/helpers_repos/entrypoint.py +0 -77
- machineconfig/setup_mac/ssh/openssh_setup.sh +0 -114
- machineconfig/setup_windows/ssh/add-sshkey.ps1 +0 -29
- machineconfig/setup_windows/ssh/openssh-server.ps1 +0 -37
- machineconfig/utils/options_tv.py +0 -119
- machineconfig/utils/tst.py +0 -20
- /machineconfig/{scripts/python/helpers_agents → jobs/installer/checks}/__init__.py +0 -0
- /machineconfig/scripts/python/ai/{solutions/_shared.py → utils/shared.py} +0 -0
- /machineconfig/scripts/python/{helpers_agents/agentic_frameworks → graph}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers_cloud → helpers}/__init__.py +0 -0
- /machineconfig/scripts/python/{env_manager → helpers/helper_env}/__init__.py +0 -0
- /machineconfig/scripts/python/{env_manager → helpers/helper_env}/path_manager_backend.py +0 -0
- /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_agents}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers_devops → helpers/helpers_agents/agentic_frameworks}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_crush.json +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/fire_agents_help_search.py +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/fire_agents_helper_types.py +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/fire_agents_load_balancer.py +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/aichat/config.yaml +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/aider/.aider.conf.yml +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/copilot/config.yml +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/crush/crush.json +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/gemini/settings.json +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/privacy.py +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/templates/prompt.txt +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/templates/template.ps1 +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/templates/template.sh +0 -0
- /machineconfig/scripts/python/{helpers_devops/themes → helpers/helpers_cloud}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/cloud_helpers.py +0 -0
- /machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/helpers5.py +0 -0
- /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_croshell}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/crosh.py +0 -0
- /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/pomodoro.py +0 -0
- /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/viewer.py +0 -0
- /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/viewer_template.py +0 -0
- /machineconfig/scripts/python/{helpers_network → helpers/helpers_devops}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers_sessions → helpers/helpers_devops/themes}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/themes/choose_pwsh_theme.ps1 +0 -0
- /machineconfig/scripts/python/{helpers_devops/themes/choose_starship_theme.ps1 → helpers/helpers_fire_command/__init__.py} +0 -0
- /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/cloud_manager.py +0 -0
- /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/f.py +0 -0
- /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/file_wrangler.py +0 -0
- /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/fire_jobs_args_helper.py +0 -0
- /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/fire_jobs_streamlit_helper.py +0 -0
- /machineconfig/scripts/python/{helpers_msearch → helpers/helpers_msearch}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers_navigator → helpers/helpers_navigator}/search_bar.py +0 -0
- /machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/mount_nfs.py +0 -0
- /machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/mount_nw_drive.py +0 -0
- /machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/onetimeshare.py +0 -0
- /machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/wifi_conn.py +0 -0
- /machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/clone.py +0 -0
- /machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/repo_analyzer_1.py +0 -0
- /machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/sync.py +0 -0
- /machineconfig/scripts/python/helpers/{ast_search.py → helpers_search/ast_search.py} +0 -0
- /machineconfig/scripts/python/helpers/{qr_code.py → helpers_search/qr_code.py} +0 -0
- /machineconfig/scripts/python/helpers/{repo_rag.py → helpers_search/repo_rag.py} +0 -0
- /machineconfig/scripts/python/helpers/{symantic_search.py → helpers_search/symantic_search.py} +0 -0
- /machineconfig/scripts/python/{helpers_utils → helpers/helpers_utils}/pdf.py +0 -0
- {machineconfig-8.12.dist-info → machineconfig-8.45.dist-info}/WHEEL +0 -0
- {machineconfig-8.12.dist-info → machineconfig-8.45.dist-info}/entry_points.txt +0 -0
- {machineconfig-8.12.dist-info → machineconfig-8.45.dist-info}/top_level.txt +0 -0
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env -S uv run --no-dev --project
|
|
2
2
|
|
|
3
|
-
"""
|
|
4
|
-
croshell
|
|
5
|
-
|
|
6
|
-
"""
|
|
3
|
+
"""croshell - Cross-shell command execution."""
|
|
7
4
|
|
|
8
5
|
from typing import Annotated, Optional
|
|
9
6
|
import typer
|
|
@@ -17,156 +14,12 @@ def croshell(
|
|
|
17
14
|
jupyter: Annotated[bool, typer.Option("--jupyter", "-j", help="run in jupyter interactive console")] = False,
|
|
18
15
|
vscode: Annotated[bool, typer.Option("--vscode", "-c", help="open the script in vscode")] = False,
|
|
19
16
|
visidata: Annotated[bool, typer.Option("--visidata", "-v", help="open data file in visidata")] = False,
|
|
20
|
-
# streamlit_viewer: Annotated[bool, typer.Option("--streamlit", "-s", help="view in streamlit app")] = False,
|
|
21
17
|
python: Annotated[bool, typer.Option("--python", "-P", help="flag to use python over IPython.")] = False,
|
|
22
18
|
profile: Annotated[Optional[str], typer.Option("--profile", "-r", help="ipython profile to use, defaults to default profile.")] = None,
|
|
23
|
-
|
|
24
19
|
) -> None:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if project_path is not None:
|
|
29
|
-
uv_project_line = f'--project {project_path}'
|
|
30
|
-
uv_python_line = ""
|
|
31
|
-
else:
|
|
32
|
-
uv_project_line = ""
|
|
33
|
-
uv_python_line = "--python 3.14"
|
|
34
|
-
|
|
35
|
-
from machineconfig.scripts.python.helpers_croshell.crosh import get_read_python_file_pycode, get_read_data_pycode
|
|
36
|
-
from machineconfig.utils.meta import lambda_to_python_script
|
|
37
|
-
from pathlib import Path
|
|
38
|
-
from machineconfig.utils.accessories import randstr
|
|
39
|
-
from machineconfig.utils.ve import get_ve_path_and_ipython_profile
|
|
40
|
-
import json
|
|
41
|
-
from rich.console import Console
|
|
42
|
-
from rich.panel import Panel
|
|
43
|
-
console = Console()
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
# ==================================================================================
|
|
47
|
-
# flags processing
|
|
48
|
-
interactivity = "-i"
|
|
49
|
-
interpreter = "python" if python else "ipython"
|
|
50
|
-
ipython_profile: Optional[str] = profile
|
|
51
|
-
file_obj = Path.cwd() # initialization value, could be modified according to args.
|
|
52
|
-
if path is not None:
|
|
53
|
-
from machineconfig.utils.path_helper import get_choice_file
|
|
54
|
-
choice_file = get_choice_file(path=path, suffixes={".*"})
|
|
55
|
-
if project_path is None:
|
|
56
|
-
ve_path, _ = get_ve_path_and_ipython_profile(choice_file)
|
|
57
|
-
if ve_path is not None:
|
|
58
|
-
ve_path_obj = Path(ve_path)
|
|
59
|
-
uv_project_line = f'--project {ve_path_obj.parent}'
|
|
60
|
-
uv_python_line = ""
|
|
61
|
-
if choice_file.suffix == ".py":
|
|
62
|
-
program = choice_file.read_text(encoding="utf-8")
|
|
63
|
-
text = f"📄 Selected file: {choice_file.name}"
|
|
64
|
-
console.print(Panel(text, title="[bold blue]Info[/bold blue]"))
|
|
65
|
-
else:
|
|
66
|
-
program = lambda_to_python_script(lambda: get_read_data_pycode(path=str(choice_file)),
|
|
67
|
-
in_global=True, import_module=False)
|
|
68
|
-
text = f"📄 Reading data from: {file_obj.name}"
|
|
69
|
-
console.print(Panel(text, title="[bold blue]Info[/bold blue]"))
|
|
70
|
-
else: # if nothing is specified, then run in interactive mode.
|
|
71
|
-
program = ""
|
|
72
|
-
|
|
73
|
-
if Path.home().joinpath("code/machineconfig").exists() and uv_project_line == "":
|
|
74
|
-
uv_project_line = f'--project "{str(Path.home().joinpath("code/machineconfig"))}"'
|
|
75
|
-
|
|
76
|
-
preprogram = """
|
|
77
|
-
#%%
|
|
78
|
-
"""
|
|
79
|
-
def preprogram_func():
|
|
80
|
-
from machineconfig.utils.files.headers import print_header, print_logo
|
|
81
|
-
print_header()
|
|
82
|
-
print_logo("Machineconfig")
|
|
83
|
-
from pathlib import Path
|
|
84
|
-
from machineconfig.utils.path_extended import PathExtended
|
|
85
|
-
_ = Path, PathExtended # avoid unused import warnings
|
|
86
|
-
import inspect
|
|
87
|
-
import textwrap
|
|
88
|
-
from types import FunctionType
|
|
89
|
-
def get_body_simple_function_no_args(f: FunctionType):
|
|
90
|
-
return textwrap.dedent("\n".join(inspect.getsource(f).splitlines()[1:]))
|
|
91
|
-
preprogram += get_body_simple_function_no_args(preprogram_func)
|
|
92
|
-
|
|
93
|
-
from pathlib import Path
|
|
94
|
-
pyfile = Path.home().joinpath(f"tmp_results/tmp_scripts/python/croshell/{randstr()}/script.py")
|
|
95
|
-
pyfile.parent.mkdir(parents=True, exist_ok=True)
|
|
96
|
-
title = "Reading Data"
|
|
97
|
-
def_code = lambda_to_python_script(lambda: get_read_python_file_pycode(path=str(pyfile), title=title),
|
|
98
|
-
in_global=False, import_module=False)
|
|
99
|
-
# print(def_code)
|
|
100
|
-
python_program = preprogram + "\n\n" + def_code + program
|
|
101
|
-
pyfile.write_text(python_program, encoding="utf-8")
|
|
102
|
-
# ve_root_from_file, ipython_profile = get_ve_path_and_ipython_profile(PathExtended(file))
|
|
103
|
-
ipython_profile = ipython_profile if ipython_profile is not None else "default"
|
|
104
|
-
# ve_activateion_line = get_ve_activate_line(ve_name=args.ve or ve_profile_suggested, a_path=str(PathExtended.cwd()))
|
|
105
|
-
|
|
106
|
-
# prepare notebook target path (avoid relying on locals())
|
|
107
|
-
nb_target = pyfile.with_suffix(".ipynb")
|
|
108
|
-
if jupyter:
|
|
109
|
-
try:
|
|
110
|
-
nb_path = pyfile.with_suffix(".ipynb")
|
|
111
|
-
nb_content = {
|
|
112
|
-
"cells": [
|
|
113
|
-
{
|
|
114
|
-
"cell_type": "code",
|
|
115
|
-
"metadata": {"language": "python"},
|
|
116
|
-
"source": [python_program],
|
|
117
|
-
"outputs": [],
|
|
118
|
-
"execution_count": None,
|
|
119
|
-
}
|
|
120
|
-
],
|
|
121
|
-
"metadata": {},
|
|
122
|
-
"nbformat": 4,
|
|
123
|
-
"nbformat_minor": 5,
|
|
124
|
-
}
|
|
125
|
-
nb_path.write_text(json.dumps(nb_content), encoding="utf-8")
|
|
126
|
-
nb_target = nb_path
|
|
127
|
-
except Exception:
|
|
128
|
-
# if writing fails, fall back to the default nb_target already set
|
|
129
|
-
pass
|
|
130
|
-
if visidata:
|
|
131
|
-
if file_obj.suffix == ".json":
|
|
132
|
-
fire_line = f"uv run {uv_python_line} {user_uv_with_line} {uv_project_line} --with visidata vd {str(file_obj)}"
|
|
133
|
-
else:
|
|
134
|
-
fire_line = f"uv run {uv_python_line} {user_uv_with_line} {uv_project_line} --with visidata,pyarrow vd {str(file_obj)}"
|
|
135
|
-
elif marimo:
|
|
136
|
-
if Path.home().joinpath("code/machineconfig").exists():
|
|
137
|
-
requirements = f"""{user_uv_with_line} {uv_project_line} --with marimo """
|
|
138
|
-
else: requirements = f"""{uv_python_line} {user_uv_with_line} {uv_project_line} --with "marimo,cowsay,machineconfig[plot]>=8.12" """
|
|
139
|
-
fire_line = f"""
|
|
140
|
-
cd {str(pyfile.parent)}
|
|
141
|
-
uv run {uv_python_line} --with "marimo" marimo convert {pyfile.name} -o marimo_nb.py
|
|
142
|
-
uv run {requirements} marimo edit --host 0.0.0.0 marimo_nb.py
|
|
143
|
-
"""
|
|
144
|
-
elif jupyter:
|
|
145
|
-
if Path.home().joinpath("code/machineconfig").exists():
|
|
146
|
-
requirements = f"""{user_uv_with_line} {uv_project_line} --with jupyterlab """
|
|
147
|
-
else: requirements = f"""{user_uv_with_line} {uv_project_line} --with "cowsay,machineconfig[plot]>=8.12" """
|
|
148
|
-
fire_line = f"uv run {requirements} {uv_project_line} jupyter-lab {str(nb_target)}"
|
|
149
|
-
elif vscode:
|
|
150
|
-
user_uv_add = f"uv add {uv_with}" if uv_with is not None else ""
|
|
151
|
-
fire_line = f"""
|
|
152
|
-
cd {str(pyfile.parent)}
|
|
153
|
-
uv init {uv_python_line}
|
|
154
|
-
uv venv
|
|
155
|
-
uv add "cowsay,machineconfig[plot]>=8.12"
|
|
156
|
-
uv add {user_uv_add}
|
|
157
|
-
# code serve-web
|
|
158
|
-
code --new-window {str(pyfile)}
|
|
159
|
-
"""
|
|
160
|
-
else:
|
|
161
|
-
if interpreter == "ipython": profile = f" --profile {ipython_profile} --no-banner"
|
|
162
|
-
else: profile = ""
|
|
163
|
-
if Path.home().joinpath("code/machineconfig").exists():
|
|
164
|
-
ve_line = f"""{user_uv_with_line} {uv_project_line} """
|
|
165
|
-
else: ve_line = f"""{uv_python_line} {user_uv_with_line} {uv_project_line} --with "cowsay,machineconfig[plot]>=8.12" """
|
|
166
|
-
fire_line = f"uv run {ve_line} {interpreter} {interactivity} {profile} {str(pyfile)}"
|
|
167
|
-
|
|
168
|
-
from machineconfig.utils.code import exit_then_run_shell_script
|
|
169
|
-
exit_then_run_shell_script(fire_line, strict=False)
|
|
20
|
+
"""Cross-shell command execution."""
|
|
21
|
+
from machineconfig.scripts.python.helpers.helpers_croshell.croshell_impl import croshell as impl
|
|
22
|
+
impl(path=path, project_path=project_path, uv_with=uv_with, marimo=marimo, jupyter=jupyter, vscode=vscode, visidata=visidata, python=python, profile=profile)
|
|
170
23
|
|
|
171
24
|
|
|
172
25
|
def main() -> None:
|
|
@@ -174,9 +27,4 @@ def main() -> None:
|
|
|
174
27
|
|
|
175
28
|
|
|
176
29
|
if __name__ == "__main__":
|
|
177
|
-
# def func(flag: Annotated[bool, typer.Option("--flag/-nf", help="dummy flag for debugging", flag_value=False, is_flag=True)]=True):
|
|
178
|
-
# console.print(f"flag: {flag}")
|
|
179
|
-
# app = typer.Typer()
|
|
180
|
-
# app.command()(func)
|
|
181
|
-
# app()
|
|
182
30
|
main()
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
"""devops with emojis"""
|
|
1
|
+
"""devops with emojis - lazy loading subcommands."""
|
|
2
2
|
|
|
3
3
|
import typer
|
|
4
|
-
from typing import Optional, Annotated
|
|
4
|
+
from typing import Optional, Annotated, Literal
|
|
5
5
|
|
|
6
|
-
import machineconfig.scripts.python.helpers_devops.cli_repos as cli_repos
|
|
7
|
-
import machineconfig.scripts.python.helpers_devops.cli_config as cli_config
|
|
8
|
-
import machineconfig.scripts.python.helpers_devops.cli_self as cli_self
|
|
9
|
-
import machineconfig.scripts.python.helpers_devops.cli_data as cli_data
|
|
10
|
-
import machineconfig.scripts.python.helpers_devops.cli_nw as cli_network
|
|
11
|
-
import machineconfig.scripts.python.helpers_devops.run_script as run_py_script_module
|
|
12
6
|
|
|
13
7
|
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
8
|
group: Annotated[bool, typer.Option(..., "--group", "-g", help="Treat 'which' as a group name. A group is bundle of apps.")] = False,
|
|
@@ -19,46 +13,69 @@ def install(which: Annotated[Optional[str], typer.Argument(..., help="Comma-sepa
|
|
|
19
13
|
installer_entry_point.main_installer_cli(which=which, group=group, interactive=interactive)
|
|
20
14
|
|
|
21
15
|
|
|
16
|
+
def repos(ctx: typer.Context) -> None:
|
|
17
|
+
"""📁 [r] Manage development repositories"""
|
|
18
|
+
import machineconfig.scripts.python.helpers.helpers_devops.cli_repos as cli_repos
|
|
19
|
+
cli_repos.get_app()(ctx.args, standalone_mode=False)
|
|
22
20
|
|
|
23
|
-
# def get_app():
|
|
24
|
-
# app = typer.Typer(add_completion=False, no_args_is_help=True)
|
|
25
|
-
# app.command(name="scripts", help="define all scripts", no_args_is_help=False)(define_scripts)
|
|
26
|
-
# return app
|
|
27
21
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
def config(ctx: typer.Context) -> None:
|
|
23
|
+
"""⚙️ [c] Configuration management"""
|
|
24
|
+
import machineconfig.scripts.python.helpers.helpers_devops.cli_config as cli_config
|
|
25
|
+
cli_config.get_app()(ctx.args, standalone_mode=False)
|
|
32
26
|
|
|
33
|
-
# define_app = get_define_app()
|
|
34
27
|
|
|
28
|
+
def data(ctx: typer.Context) -> None:
|
|
29
|
+
"""💾 [d] Data management"""
|
|
30
|
+
import machineconfig.scripts.python.helpers.helpers_devops.cli_data as cli_data
|
|
31
|
+
cli_data.get_app()(ctx.args, standalone_mode=False)
|
|
35
32
|
|
|
36
|
-
def get_app():
|
|
37
33
|
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
def self_cmd(ctx: typer.Context) -> None:
|
|
35
|
+
"""🔧 [s] Self management"""
|
|
36
|
+
import machineconfig.scripts.python.helpers.helpers_devops.cli_self as cli_self
|
|
37
|
+
cli_self.get_app()(ctx.args, standalone_mode=False)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def network(ctx: typer.Context) -> None:
|
|
41
|
+
"""🌐 [n] Network management"""
|
|
42
|
+
import machineconfig.scripts.python.helpers.helpers_devops.cli_nw as cli_network
|
|
43
|
+
cli_network.get_app()(ctx.args, standalone_mode=False)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def execute(
|
|
47
|
+
ctx: typer.Context,
|
|
48
|
+
name: Annotated[str, typer.Argument(help="Name of script to run, e.g., 'a' for a.py, or command to execute")] = "",
|
|
49
|
+
where: Annotated[Literal["all", "a", "private", "p", "public", "b", "library", "l", "dynamic", "d", "custom", "c"], typer.Option("--where", "-w", help="Where to look for the script")] = "all",
|
|
50
|
+
interactive: Annotated[bool, typer.Option(..., "--interactive", "-i", help="Interactive selection of scripts to run")] = False,
|
|
51
|
+
command: Annotated[Optional[bool], typer.Option(..., "--command", "-c", help="Run as command")] = False,
|
|
52
|
+
list_scripts: Annotated[bool, typer.Option(..., "--list", "-l", help="List available scripts in all locations")] = False,
|
|
53
|
+
) -> None:
|
|
54
|
+
"""🚀 Execute python/shell scripts from pre-defined directories or as command."""
|
|
55
|
+
import machineconfig.scripts.python.helpers.helpers_devops.run_script as run_py_script_module
|
|
56
|
+
run_py_script_module.run_py_script(ctx=ctx, name=name, where=where, interactive=interactive, command=command, list_scripts=list_scripts)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def get_app() -> typer.Typer:
|
|
60
|
+
cli_app = typer.Typer(help="🛠️ DevOps operations", no_args_is_help=True, add_help_option=True, add_completion=False)
|
|
61
|
+
ctx_settings: dict[str, object] = {"allow_extra_args": True, "allow_interspersed_args": True, "ignore_unknown_options": True, "help_option_names": []}
|
|
62
|
+
|
|
63
|
+
cli_app.command("install", no_args_is_help=True, help=install.__doc__, short_help="🛠️ [i] Install essential packages")(install)
|
|
40
64
|
cli_app.command("i", no_args_is_help=True, help=install.__doc__, hidden=True)(install)
|
|
41
65
|
|
|
42
|
-
|
|
43
|
-
cli_app.
|
|
44
|
-
cli_app.
|
|
45
|
-
|
|
46
|
-
cli_app.
|
|
47
|
-
cli_app.
|
|
48
|
-
|
|
49
|
-
cli_app.
|
|
50
|
-
cli_app.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
cli_app.
|
|
54
|
-
|
|
55
|
-
cli_app.add_typer(app_nw, name="network")
|
|
56
|
-
cli_app.add_typer(app_nw, name="n", hidden=True)
|
|
57
|
-
|
|
58
|
-
cli_app.command("execute", no_args_is_help=True, help=run_py_script_module.__doc__,
|
|
59
|
-
short_help="▶️ [e] Execute python/shell scripts from pre-defined directories or as command",
|
|
60
|
-
context_settings={"show_help_on_error": True})(run_py_script_module.run_py_script)
|
|
61
|
-
cli_app.command("e", no_args_is_help=True, help=run_py_script_module.__doc__, hidden=True)(run_py_script_module.run_py_script)
|
|
66
|
+
cli_app.command("repos", help="📁 [r] Manage development repositories", context_settings=ctx_settings)(repos)
|
|
67
|
+
cli_app.command("r", hidden=True, context_settings=ctx_settings)(repos)
|
|
68
|
+
cli_app.command("config", help="🔩 [c] Configuration management", context_settings=ctx_settings)(config)
|
|
69
|
+
cli_app.command("c", hidden=True, context_settings=ctx_settings)(config)
|
|
70
|
+
cli_app.command("data", help="💾 [d] Data management", context_settings=ctx_settings)(data)
|
|
71
|
+
cli_app.command("d", hidden=True, context_settings=ctx_settings)(data)
|
|
72
|
+
cli_app.command("self", help="🔧 [s] Self management", context_settings=ctx_settings)(self_cmd)
|
|
73
|
+
cli_app.command("s", hidden=True, context_settings=ctx_settings)(self_cmd)
|
|
74
|
+
cli_app.command("network", help="🌐 [n] Network management", context_settings=ctx_settings)(network)
|
|
75
|
+
cli_app.command("n", hidden=True, context_settings=ctx_settings)(network)
|
|
76
|
+
|
|
77
|
+
cli_app.command("execute", no_args_is_help=True, short_help="🚀 [e] Execute python/shell scripts from pre-defined directories or as command")(execute)
|
|
78
|
+
cli_app.command("e", no_args_is_help=True, hidden=True)(execute)
|
|
62
79
|
|
|
63
80
|
return cli_app
|
|
64
81
|
|
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env -S uv run --script
|
|
2
|
+
# /// script
|
|
3
|
+
# requires-python = ">=3.13"
|
|
4
|
+
# dependencies = [
|
|
5
|
+
# "machineconfig>=8.45",
|
|
6
|
+
# "textual",
|
|
7
|
+
# ]
|
|
8
|
+
# ///
|
|
9
|
+
|
|
10
|
+
"""Textual TUI for navigating `machineconfig` command structure."""
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def main() -> None:
|
|
14
|
+
from machineconfig.scripts.python.helpers.helpers_navigator.main_app import CommandNavigatorApp
|
|
15
|
+
|
|
16
|
+
CommandNavigatorApp().run()
|
|
2
17
|
|
|
3
18
|
|
|
4
19
|
if __name__ == "__main__":
|
|
5
|
-
|
|
6
|
-
app.run()
|
|
20
|
+
main()
|
|
@@ -1,201 +1,9 @@
|
|
|
1
|
-
"""
|
|
2
|
-
fire
|
|
3
|
-
|
|
4
|
-
# https://github.com/pallets/click combine with fire. Consider
|
|
5
|
-
# https://github.com/ceccopierangiolieugenio/pyTermTk for choose_from_options build TUI
|
|
6
|
-
# https://github.com/chriskiehl/Gooey build commandline interface
|
|
7
|
-
|
|
8
|
-
"""
|
|
1
|
+
"""fire - Fire and manage jobs."""
|
|
9
2
|
|
|
10
3
|
from typing import Optional, Annotated
|
|
11
4
|
import typer
|
|
12
5
|
|
|
13
6
|
|
|
14
|
-
def route(args: "FireJobArgs", fire_args: str = "") -> None:
|
|
15
|
-
from pathlib import Path
|
|
16
|
-
from machineconfig.utils.path_helper import get_choice_file
|
|
17
|
-
from machineconfig.utils.accessories import get_repo_root, randstr
|
|
18
|
-
choice_file = get_choice_file(args.path, suffixes=None)
|
|
19
|
-
repo_root = get_repo_root(choice_file)
|
|
20
|
-
print(f"💾 Selected file: {choice_file}.\nRepo root: {repo_root}")
|
|
21
|
-
if args.marimo:
|
|
22
|
-
print(f"🧽 Preparing to launch Marimo notebook for `{choice_file}`...")
|
|
23
|
-
tmp_dir = Path.home().joinpath(f"tmp_results/tmp_scripts/marimo/{choice_file.stem}_{randstr()}")
|
|
24
|
-
tmp_dir.mkdir(parents=True, exist_ok=True)
|
|
25
|
-
script = f"""
|
|
26
|
-
cd {tmp_dir}
|
|
27
|
-
uv run --python 3.14 --with marimo marimo convert {choice_file} -o marimo_nb.py
|
|
28
|
-
uv run --project {repo_root} --with marimo marimo edit --host 0.0.0.0 marimo_nb.py
|
|
29
|
-
"""
|
|
30
|
-
from machineconfig.utils.code import exit_then_run_shell_script
|
|
31
|
-
print(f"🚀 Launching Marimo notebook for `{choice_file}`...")
|
|
32
|
-
exit_then_run_shell_script(script)
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
# ========================= preparing kwargs_dict
|
|
36
|
-
if choice_file.suffix == ".py":
|
|
37
|
-
from machineconfig.scripts.python.helpers_fire_command.fire_jobs_args_helper import extract_kwargs
|
|
38
|
-
kwargs_dict = extract_kwargs(args) # This now returns empty dict, but kept for compatibility
|
|
39
|
-
else:
|
|
40
|
-
kwargs_dict = {}
|
|
41
|
-
|
|
42
|
-
# ========================= choosing function to run
|
|
43
|
-
choice_function: Optional[str] = None # Initialize to avoid unbound variable
|
|
44
|
-
if args.choose_function:
|
|
45
|
-
from machineconfig.scripts.python.helpers_fire_command.fire_jobs_route_helper import choose_function_or_lines
|
|
46
|
-
|
|
47
|
-
choice_function, choice_file, kwargs_dict = choose_function_or_lines(choice_file, kwargs_dict)
|
|
48
|
-
else:
|
|
49
|
-
choice_function = args.function
|
|
50
|
-
|
|
51
|
-
if choice_file.suffix == ".py":
|
|
52
|
-
module_line = "-m" if args.module else ""
|
|
53
|
-
with_project = f"--project {repo_root} " if repo_root is not None else ""
|
|
54
|
-
interactive_line = "-i" if args.interactive else ""
|
|
55
|
-
if args.interactive:
|
|
56
|
-
from machineconfig.utils.ve import get_ve_path_and_ipython_profile
|
|
57
|
-
_ve_root_from_file, ipy_profile = get_ve_path_and_ipython_profile(init_path=choice_file)
|
|
58
|
-
if ipy_profile is None:
|
|
59
|
-
ipy_profile = "default"
|
|
60
|
-
ipython_line = f"--no-banner --profile {ipy_profile} "
|
|
61
|
-
else:
|
|
62
|
-
ipython_line = ""
|
|
63
|
-
|
|
64
|
-
if args.streamlit:
|
|
65
|
-
from machineconfig.scripts.python.helpers_fire_command.fire_jobs_route_helper import get_command_streamlit
|
|
66
|
-
interpreter_line = get_command_streamlit(choice_file=choice_file, environment=args.environment, repo_root=repo_root)
|
|
67
|
-
elif args.jupyter:
|
|
68
|
-
interpreter_line = "jupyter-lab"
|
|
69
|
-
else:
|
|
70
|
-
interpreter_line = "python" if not args.interactive else "ipython"
|
|
71
|
-
|
|
72
|
-
exe_line = f"uv run {with_project} {interpreter_line} {interactive_line} {module_line} {ipython_line}"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
elif choice_file.suffix == ".ps1" or choice_file.suffix == ".sh":
|
|
76
|
-
exe_line = "."
|
|
77
|
-
elif choice_file.suffix == "":
|
|
78
|
-
exe_line = ""
|
|
79
|
-
else:
|
|
80
|
-
raise NotImplementedError(f"File type {choice_file.suffix} not supported, in the sense that I don't know how to fire it.")
|
|
81
|
-
|
|
82
|
-
if args.module and choice_file.suffix == ".py":
|
|
83
|
-
if repo_root is not None:
|
|
84
|
-
choice_file_adjusted = ".".join(Path(choice_file).relative_to(repo_root).parts).replace(".py", "")
|
|
85
|
-
else:
|
|
86
|
-
choice_file_adjusted = ".".join(Path(choice_file).relative_to(Path.cwd()).parts).replace(".py", "")
|
|
87
|
-
else:
|
|
88
|
-
choice_file_adjusted = str(choice_file)
|
|
89
|
-
|
|
90
|
-
if args.script or (args.debug and args.choose_function):
|
|
91
|
-
# because debugging tools do not support choosing functions and don't interplay with fire module. So the only way to have debugging and choose function options is to import the file as a module into a new script and run the function of interest there and debug the new script.
|
|
92
|
-
assert choice_file.suffix == ".py", f"File must be a python file to be imported as a module. Got {choice_file}"
|
|
93
|
-
from machineconfig.scripts.python.helpers_fire_command.file_wrangler import get_import_module_code, wrap_import_in_try_except
|
|
94
|
-
from machineconfig.utils.meta import lambda_to_python_script
|
|
95
|
-
from machineconfig.utils.code import print_code
|
|
96
|
-
|
|
97
|
-
import_code = get_import_module_code(str(choice_file))
|
|
98
|
-
import_code_robust = lambda_to_python_script(
|
|
99
|
-
lambda: wrap_import_in_try_except(
|
|
100
|
-
import_line=import_code, pyfile=str(choice_file), repo_root=str(repo_root) if repo_root is not None else None
|
|
101
|
-
),
|
|
102
|
-
in_global=True,
|
|
103
|
-
import_module=False,
|
|
104
|
-
)
|
|
105
|
-
# print(f"🧩 Preparing import code for module import:\n{import_code}")
|
|
106
|
-
code_printing = lambda_to_python_script(
|
|
107
|
-
lambda: print_code(code=import_code_robust, lexer="python", desc="import as module code"),
|
|
108
|
-
in_global=True, import_module=False
|
|
109
|
-
)
|
|
110
|
-
print(f"🧩 Preparing import code for module import:\n{import_code}")
|
|
111
|
-
if choice_function is not None:
|
|
112
|
-
calling = f"""res = {choice_function}({("**" + str(kwargs_dict)) if kwargs_dict else ""})"""
|
|
113
|
-
else:
|
|
114
|
-
calling = """# No function selected to call. You can add your code here."""
|
|
115
|
-
choice_file = Path.home().joinpath(f"tmp_results/tmp_scripts/python/{Path(choice_file).parent.name}_{Path(choice_file).stem}_{randstr()}.py")
|
|
116
|
-
choice_file.parent.mkdir(parents=True, exist_ok=True)
|
|
117
|
-
choice_file.write_text(import_code_robust + "\n" + code_printing + "\n" + calling, encoding="utf-8")
|
|
118
|
-
|
|
119
|
-
if args.debug:
|
|
120
|
-
import platform
|
|
121
|
-
if platform.system() == "Windows":
|
|
122
|
-
command = f"{exe_line} -m ipdb {choice_file_adjusted} " # pudb is not available on windows machines, use poor man's debugger instead.
|
|
123
|
-
elif platform.system() in ["Linux", "Darwin"]:
|
|
124
|
-
command = f"{exe_line} -m pudb {choice_file_adjusted} " # TODO: functions not supported yet in debug mode.
|
|
125
|
-
else:
|
|
126
|
-
raise NotImplementedError(f"Platform {platform.system()} not supported.")
|
|
127
|
-
elif args.module:
|
|
128
|
-
# both selected function and kwargs are mentioned in the made up script, therefore no need for fire module.
|
|
129
|
-
command = f"{exe_line} {choice_file_adjusted} "
|
|
130
|
-
elif choice_function is not None and choice_file.suffix == ".py":
|
|
131
|
-
command = f"{exe_line} -m fire {choice_file_adjusted} {choice_function} {fire_args}"
|
|
132
|
-
elif args.streamlit:
|
|
133
|
-
# for .streamlit config to work, it needs to be in the current directory.
|
|
134
|
-
if args.holdDirectory:
|
|
135
|
-
command = f"{exe_line} {choice_file}"
|
|
136
|
-
else:
|
|
137
|
-
command = f"cd {choice_file.parent}\n{exe_line} {choice_file.name}\ncd {Path.cwd()}"
|
|
138
|
-
elif args.cmd:
|
|
139
|
-
command = rf""" cd /d {choice_file.parent} & {exe_line} {choice_file.name} """
|
|
140
|
-
else:
|
|
141
|
-
if choice_file.suffix == "":
|
|
142
|
-
command = f"{exe_line} {choice_file} {fire_args}"
|
|
143
|
-
else:
|
|
144
|
-
command = f"{exe_line} {choice_file} "
|
|
145
|
-
|
|
146
|
-
if not args.cmd:
|
|
147
|
-
pass
|
|
148
|
-
else:
|
|
149
|
-
new_line = "\n"
|
|
150
|
-
command = rf"""start cmd -Argument "/k {command.replace(new_line, " & ")} " """ # this works from powershell
|
|
151
|
-
if args.submit_to_cloud:
|
|
152
|
-
command = f"""uv run python -m machineconfig.cluster.templates.cli_click --file {choice_file} """
|
|
153
|
-
if choice_function is not None:
|
|
154
|
-
command += f"--function {choice_function} "
|
|
155
|
-
|
|
156
|
-
if args.optimized:
|
|
157
|
-
command = command.replace("python ", "python -OO ")
|
|
158
|
-
|
|
159
|
-
from rich.panel import Panel
|
|
160
|
-
from rich.console import Console
|
|
161
|
-
from rich.syntax import Syntax
|
|
162
|
-
|
|
163
|
-
console = Console()
|
|
164
|
-
if args.zellij_tab is not None:
|
|
165
|
-
comman_path__ = Path.home().joinpath(f"tmp_results/tmp_scripts/zellij_commands/{choice_file.stem}_{randstr()}.sh")
|
|
166
|
-
comman_path__.parent.mkdir(parents=True, exist_ok=True)
|
|
167
|
-
comman_path__.write_text(command, encoding="utf-8")
|
|
168
|
-
console.print(Panel(Syntax(command, lexer="shell"), title=f"🔥 fire command @ {comman_path__}: "), style="bold red")
|
|
169
|
-
import subprocess
|
|
170
|
-
|
|
171
|
-
existing_tab_names = subprocess.run(["zellij", "action", "query-tab-names"], capture_output=True, text=True, check=True).stdout.splitlines()
|
|
172
|
-
if args.zellij_tab in existing_tab_names:
|
|
173
|
-
print(f"⚠️ Tab name `{args.zellij_tab}` already exists. Please choose a different name.")
|
|
174
|
-
args.zellij_tab += f"_{randstr(3)}"
|
|
175
|
-
from machineconfig.cluster.sessions_managers.zellij_local import run_command_in_zellij_tab
|
|
176
|
-
|
|
177
|
-
command = run_command_in_zellij_tab(command=str(comman_path__), tab_name=args.zellij_tab, cwd=None)
|
|
178
|
-
if args.watch:
|
|
179
|
-
command = "watchexec --restart --exts py,sh,ps1 " + command
|
|
180
|
-
if args.git_pull:
|
|
181
|
-
command = f"\ngit -C {choice_file.parent} pull\n" + command
|
|
182
|
-
if args.PathExport:
|
|
183
|
-
from machineconfig.scripts.python.helpers_fire_command.file_wrangler import add_to_path
|
|
184
|
-
|
|
185
|
-
export_line = add_to_path(path_variable="PYTHONPATH", directory=str(repo_root))
|
|
186
|
-
command = export_line + "\n" + command
|
|
187
|
-
if args.loop:
|
|
188
|
-
import platform
|
|
189
|
-
if platform.system() in ["Linux", "Darwin"]:
|
|
190
|
-
command = command + "\nsleep 0.5"
|
|
191
|
-
elif platform.system() == "Windows":
|
|
192
|
-
command = "$ErrorActionPreference = 'SilentlyContinue';\n" + command + "\nStart-Sleep -Seconds 0.5"
|
|
193
|
-
else:
|
|
194
|
-
raise NotImplementedError(f"Platform {platform.system()} not supported.")
|
|
195
|
-
from machineconfig.utils.code import exit_then_run_shell_script
|
|
196
|
-
exit_then_run_shell_script(script=command, strict=False)
|
|
197
|
-
|
|
198
|
-
|
|
199
7
|
def fire(
|
|
200
8
|
ctx: typer.Context,
|
|
201
9
|
path: Annotated[str, typer.Argument(help="Path to the Python file to run")] = ".",
|
|
@@ -216,17 +24,15 @@ def fire(
|
|
|
216
24
|
remote: Annotated[bool, typer.Option("--remote", "-r", help="Launch on a remote machine")] = False,
|
|
217
25
|
streamlit: Annotated[bool, typer.Option("--streamlit", "-S", help="Run as streamlit app")] = False,
|
|
218
26
|
environment: Annotated[str, typer.Option("--environment", "-E", help="Choose ip, localhost, hostname or arbitrary url")] = "",
|
|
219
|
-
holdDirectory: Annotated[
|
|
220
|
-
bool, typer.Option("--holdDirectory", "-D", help="Hold current directory and avoid cd'ing to the script directory")
|
|
221
|
-
] = False,
|
|
27
|
+
holdDirectory: Annotated[bool, typer.Option("--holdDirectory", "-D", help="Hold current directory and avoid cd'ing to the script directory")] = False,
|
|
222
28
|
PathExport: Annotated[bool, typer.Option("--PathExport", "-P", help="Augment the PYTHONPATH with repo root")] = False,
|
|
223
29
|
git_pull: Annotated[bool, typer.Option("--git-pull", "-g", help="Start by pulling the git repo")] = False,
|
|
224
30
|
watch: Annotated[bool, typer.Option("--watch", "-w", help="Watch the file for changes")] = False,
|
|
225
31
|
) -> None:
|
|
226
32
|
"""Main function to process fire jobs arguments."""
|
|
33
|
+
from machineconfig.scripts.python.helpers.helpers_fire_command.fire_jobs_args_helper import FireJobArgs, parse_fire_args_from_context
|
|
34
|
+
from machineconfig.scripts.python.helpers.helpers_fire_command.fire_jobs_impl import route
|
|
227
35
|
|
|
228
|
-
# Get Fire arguments from context
|
|
229
|
-
from machineconfig.scripts.python.helpers_fire_command.fire_jobs_args_helper import FireJobArgs, parse_fire_args_from_context
|
|
230
36
|
fire_args = parse_fire_args_from_context(ctx)
|
|
231
37
|
|
|
232
38
|
args = FireJobArgs(
|
|
@@ -256,28 +62,23 @@ def fire(
|
|
|
256
62
|
try:
|
|
257
63
|
route(args, fire_args)
|
|
258
64
|
except SystemExit:
|
|
259
|
-
# Re-raise SystemExit to preserve exit codes and allow clean exits
|
|
260
65
|
raise
|
|
261
66
|
except Exception as e:
|
|
262
|
-
# For other exceptions, print clean error message and exit
|
|
263
67
|
import sys
|
|
264
|
-
|
|
265
68
|
print(f"❌ Error: {e}", file=sys.stderr)
|
|
266
69
|
sys.exit(1)
|
|
267
70
|
|
|
268
71
|
|
|
269
|
-
def get_app():
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
app = Typer(add_completion=False)
|
|
72
|
+
def get_app() -> typer.Typer:
|
|
73
|
+
app = typer.Typer(add_completion=False)
|
|
273
74
|
app.command(context_settings={"allow_extra_args": True, "allow_interspersed_args": False})(fire)
|
|
274
75
|
return app
|
|
275
76
|
|
|
276
77
|
|
|
277
|
-
def main():
|
|
78
|
+
def main() -> None:
|
|
278
79
|
app = get_app()
|
|
279
80
|
app()
|
|
280
81
|
|
|
281
82
|
|
|
282
83
|
if __name__ == "__main__":
|
|
283
|
-
|
|
84
|
+
pass
|