machineconfig 1.97__py3-none-any.whl → 2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of machineconfig might be problematic. Click here for more details.
- machineconfig/cluster/cloud_manager.py +22 -26
- machineconfig/cluster/data_transfer.py +2 -2
- machineconfig/cluster/distribute.py +0 -2
- machineconfig/cluster/file_manager.py +4 -4
- machineconfig/cluster/job_params.py +1 -1
- machineconfig/cluster/loader_runner.py +8 -8
- machineconfig/cluster/remote_machine.py +4 -4
- machineconfig/cluster/script_execution.py +2 -2
- machineconfig/cluster/sessions_managers/archive/create_zellij_template.py +1 -1
- machineconfig/cluster/sessions_managers/enhanced_command_runner.py +23 -23
- machineconfig/cluster/sessions_managers/wt_local.py +78 -76
- machineconfig/cluster/sessions_managers/wt_local_manager.py +91 -91
- machineconfig/cluster/sessions_managers/wt_remote.py +39 -39
- machineconfig/cluster/sessions_managers/wt_remote_manager.py +94 -91
- machineconfig/cluster/sessions_managers/wt_utils/layout_generator.py +56 -54
- machineconfig/cluster/sessions_managers/wt_utils/process_monitor.py +49 -49
- machineconfig/cluster/sessions_managers/wt_utils/remote_executor.py +18 -18
- machineconfig/cluster/sessions_managers/wt_utils/session_manager.py +42 -42
- machineconfig/cluster/sessions_managers/wt_utils/status_reporter.py +36 -36
- machineconfig/cluster/sessions_managers/zellij_local.py +43 -46
- machineconfig/cluster/sessions_managers/zellij_local_manager.py +139 -120
- machineconfig/cluster/sessions_managers/zellij_remote.py +35 -35
- machineconfig/cluster/sessions_managers/zellij_remote_manager.py +33 -33
- machineconfig/cluster/sessions_managers/zellij_utils/example_usage.py +15 -15
- machineconfig/cluster/sessions_managers/zellij_utils/layout_generator.py +25 -26
- machineconfig/cluster/sessions_managers/zellij_utils/process_monitor.py +49 -49
- machineconfig/cluster/sessions_managers/zellij_utils/remote_executor.py +5 -5
- machineconfig/cluster/sessions_managers/zellij_utils/session_manager.py +15 -15
- machineconfig/cluster/sessions_managers/zellij_utils/status_reporter.py +11 -11
- machineconfig/cluster/templates/utils.py +3 -3
- machineconfig/jobs/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python/__pycache__/python_ve_symlink.cpython-311.pyc +0 -0
- machineconfig/jobs/python/check_installations.py +8 -9
- machineconfig/jobs/python/python_cargo_build_share.py +2 -2
- machineconfig/jobs/python/vscode/link_ve.py +7 -7
- machineconfig/jobs/python/vscode/select_interpreter.py +7 -7
- machineconfig/jobs/python/vscode/sync_code.py +5 -5
- machineconfig/jobs/python_custom_installers/archive/ngrok.py +2 -2
- machineconfig/jobs/python_custom_installers/dev/aider.py +3 -3
- machineconfig/jobs/python_custom_installers/dev/alacritty.py +3 -3
- machineconfig/jobs/python_custom_installers/dev/brave.py +3 -3
- machineconfig/jobs/python_custom_installers/dev/bypass_paywall.py +5 -5
- machineconfig/jobs/python_custom_installers/dev/code.py +3 -3
- machineconfig/jobs/python_custom_installers/dev/cursor.py +9 -9
- machineconfig/jobs/python_custom_installers/dev/docker_desktop.py +4 -4
- machineconfig/jobs/python_custom_installers/dev/espanso.py +4 -4
- machineconfig/jobs/python_custom_installers/dev/goes.py +4 -4
- machineconfig/jobs/python_custom_installers/dev/lvim.py +4 -4
- machineconfig/jobs/python_custom_installers/dev/nerdfont.py +3 -3
- machineconfig/jobs/python_custom_installers/dev/redis.py +3 -3
- machineconfig/jobs/python_custom_installers/dev/wezterm.py +3 -3
- machineconfig/jobs/python_custom_installers/dev/winget.py +27 -27
- machineconfig/jobs/python_custom_installers/docker.py +3 -3
- machineconfig/jobs/python_custom_installers/gh.py +7 -7
- machineconfig/jobs/python_custom_installers/hx.py +1 -1
- machineconfig/jobs/python_custom_installers/warp-cli.py +3 -3
- machineconfig/jobs/python_generic_installers/config.json +412 -389
- machineconfig/jobs/python_windows_installers/dev/config.json +1 -1
- machineconfig/logger.py +50 -0
- machineconfig/profile/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/profile/__pycache__/create.cpython-311.pyc +0 -0
- machineconfig/profile/__pycache__/shell.cpython-311.pyc +0 -0
- machineconfig/profile/create.py +23 -16
- machineconfig/profile/create_hardlinks.py +8 -8
- machineconfig/profile/shell.py +41 -37
- machineconfig/scripts/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/linux/devops +2 -2
- machineconfig/scripts/linux/fire +1 -0
- machineconfig/scripts/linux/fire_agents +0 -1
- machineconfig/scripts/linux/mcinit +1 -1
- machineconfig/scripts/python/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/croshell.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_agents.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_jobs.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/repos.cpython-311.pyc +0 -0
- machineconfig/scripts/python/ai/__pycache__/init.cpython-311.pyc +0 -0
- machineconfig/scripts/python/ai/__pycache__/mcinit.cpython-311.pyc +0 -0
- machineconfig/scripts/python/ai/chatmodes/Thinking-Beast-Mode.chatmode.md +337 -0
- machineconfig/scripts/python/ai/chatmodes/Ultimate-Transparent-Thinking-Beast-Mode.chatmode.md +644 -0
- machineconfig/scripts/python/ai/chatmodes/deepResearch.chatmode.md +81 -0
- machineconfig/scripts/python/ai/configs/.gemini/settings.json +81 -0
- machineconfig/scripts/python/ai/instructions/python/dev.instructions.md +45 -0
- machineconfig/scripts/python/ai/mcinit.py +103 -0
- machineconfig/scripts/python/ai/prompts/allLintersAndTypeCheckers.prompt.md +5 -0
- machineconfig/scripts/python/ai/prompts/research-report-skeleton.prompt.md +38 -0
- machineconfig/scripts/python/ai/scripts/lint_and_type_check.sh +47 -0
- machineconfig/scripts/python/archive/tmate_conn.py +5 -5
- machineconfig/scripts/python/archive/tmate_start.py +3 -3
- machineconfig/scripts/python/choose_wezterm_theme.py +2 -2
- machineconfig/scripts/python/cloud_copy.py +19 -18
- machineconfig/scripts/python/cloud_mount.py +9 -7
- machineconfig/scripts/python/cloud_repo_sync.py +11 -11
- machineconfig/scripts/python/cloud_sync.py +1 -1
- machineconfig/scripts/python/croshell.py +14 -14
- machineconfig/scripts/python/devops.py +6 -6
- machineconfig/scripts/python/devops_add_identity.py +8 -6
- machineconfig/scripts/python/devops_add_ssh_key.py +18 -18
- machineconfig/scripts/python/devops_backup_retrieve.py +13 -13
- machineconfig/scripts/python/devops_devapps_install.py +3 -3
- machineconfig/scripts/python/devops_update_repos.py +1 -1
- machineconfig/scripts/python/dotfile.py +2 -2
- machineconfig/scripts/python/fire_agents.py +183 -41
- machineconfig/scripts/python/fire_jobs.py +17 -17
- machineconfig/scripts/python/ftpx.py +2 -2
- machineconfig/scripts/python/gh_models.py +94 -94
- machineconfig/scripts/python/helpers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/cloud_helpers.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/helpers2.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/helpers4.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/cloud_helpers.py +3 -3
- machineconfig/scripts/python/helpers/helpers2.py +1 -1
- machineconfig/scripts/python/helpers/helpers4.py +8 -6
- machineconfig/scripts/python/helpers/helpers5.py +7 -7
- machineconfig/scripts/python/helpers/repo_sync_helpers.py +1 -1
- machineconfig/scripts/python/mount_nfs.py +3 -2
- machineconfig/scripts/python/mount_nw_drive.py +4 -4
- machineconfig/scripts/python/mount_ssh.py +3 -2
- machineconfig/scripts/python/repos.py +8 -8
- machineconfig/scripts/python/scheduler.py +1 -1
- machineconfig/scripts/python/start_slidev.py +8 -7
- machineconfig/scripts/python/start_terminals.py +1 -1
- machineconfig/scripts/python/viewer.py +40 -40
- machineconfig/scripts/python/wifi_conn.py +65 -66
- machineconfig/scripts/python/wsl_windows_transfer.py +1 -1
- machineconfig/scripts/windows/mcinit.ps1 +1 -1
- machineconfig/settings/linters/.ruff.toml +2 -2
- machineconfig/settings/shells/ipy/profiles/default/startup/playext.py +71 -71
- machineconfig/settings/shells/wt/settings.json +8 -8
- machineconfig/setup_linux/web_shortcuts/tmp.sh +2 -0
- machineconfig/setup_windows/wt_and_pwsh/set_pwsh_theme.py +10 -7
- machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py +9 -7
- machineconfig/utils/ai/browser_user_wrapper.py +5 -5
- machineconfig/utils/ai/generate_file_checklist.py +11 -12
- machineconfig/utils/ai/url2md.py +1 -1
- machineconfig/utils/cloud/onedrive/setup_oauth.py +4 -4
- machineconfig/utils/cloud/onedrive/transaction.py +129 -129
- machineconfig/utils/code.py +13 -6
- machineconfig/utils/installer.py +51 -53
- machineconfig/utils/installer_utils/installer_abc.py +21 -10
- machineconfig/utils/installer_utils/installer_class.py +42 -16
- machineconfig/utils/io_save.py +3 -15
- machineconfig/utils/options.py +10 -3
- machineconfig/utils/path.py +5 -0
- machineconfig/utils/path_reduced.py +201 -149
- machineconfig/utils/procs.py +23 -23
- machineconfig/utils/scheduling.py +11 -12
- machineconfig/utils/ssh.py +270 -0
- machineconfig/utils/terminal.py +180 -0
- machineconfig/utils/utils.py +1 -2
- machineconfig/utils/utils2.py +43 -0
- machineconfig/utils/utils5.py +163 -34
- machineconfig/utils/ve.py +2 -2
- {machineconfig-1.97.dist-info → machineconfig-2.0.dist-info}/METADATA +13 -8
- {machineconfig-1.97.dist-info → machineconfig-2.0.dist-info}/RECORD +163 -149
- machineconfig/cluster/self_ssh.py +0 -57
- machineconfig/scripts/python/ai/init.py +0 -56
- machineconfig/scripts/python/ai/rules/python/dev.md +0 -31
- {machineconfig-1.97.dist-info → machineconfig-2.0.dist-info}/WHEEL +0 -0
- {machineconfig-1.97.dist-info → machineconfig-2.0.dist-info}/top_level.txt +0 -0
|
@@ -3,21 +3,22 @@ from typing import Any, Callable, Optional
|
|
|
3
3
|
import inspect
|
|
4
4
|
import os
|
|
5
5
|
# import argparse
|
|
6
|
-
from crocodile.core import Display
|
|
7
6
|
from machineconfig.utils.path_reduced import P as PathExtended
|
|
8
7
|
# from machineconfig.utils.utils import choose_ssh_host
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
def search_for_files_of_interest(path_obj: PathExtended):
|
|
12
11
|
if path_obj.joinpath(".venv").exists():
|
|
13
|
-
path_objects = path_obj.search("*", not_in=[".venv"])
|
|
12
|
+
path_objects = path_obj.search("*", not_in=[".venv"])
|
|
14
13
|
files: list[PathExtended] = []
|
|
15
14
|
for a_path_obj in path_objects:
|
|
16
15
|
files += search_for_files_of_interest(path_obj=a_path_obj)
|
|
17
16
|
return files
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
if path_obj.is_file():
|
|
18
|
+
return [path_obj]
|
|
19
|
+
py_files = path_obj.search(pattern="*.py", not_in=["__init__.py"], r=True)
|
|
20
|
+
ps_files = path_obj.search(pattern="*.ps1", r=True)
|
|
21
|
+
sh_files = path_obj.search(pattern="*.sh", r=True)
|
|
21
22
|
files = py_files + ps_files + sh_files
|
|
22
23
|
return files
|
|
23
24
|
|
|
@@ -50,7 +51,8 @@ def parse_pyfile(file_path: str):
|
|
|
50
51
|
if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef))
|
|
51
52
|
]
|
|
52
53
|
module__doc__ = ast.get_docstring(parsed_ast)
|
|
53
|
-
|
|
54
|
+
# from crocodile.core import Display
|
|
55
|
+
main_option = f"RUN AS MAIN -- {module__doc__ if module__doc__ is not None else 'NoDocs'}"
|
|
54
56
|
options = [main_option]
|
|
55
57
|
for function in functions:
|
|
56
58
|
if function.name.startswith('__') and function.name.endswith('__'): continue
|
|
@@ -41,10 +41,10 @@ def get_jupyter_notebook(python_code: str):
|
|
|
41
41
|
return template
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
def create_jupyter_notebook(py_script: str) -> None:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
# def create_jupyter_notebook(py_script: str) -> None:
|
|
45
|
+
# import nbformat as nbf
|
|
46
|
+
# from nbformat.notebooknode import NotebookNode
|
|
47
|
+
# nb: NotebookNode = nbf.v4.new_notebook()
|
|
48
|
+
# nb.cells.append(nbf.v4.new_code_cell(py_script))
|
|
49
|
+
# with open("new_notebook.ipynb", mode="w", encoding="utf-8") as f:
|
|
50
|
+
# nbf.write(nb,f)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from machineconfig.utils.path_reduced import P as PathExtended
|
|
2
|
-
from
|
|
2
|
+
from machineconfig.utils.terminal import Terminal
|
|
3
3
|
from machineconfig.scripts.python.get_zellij_cmd import get_zellij_cmd
|
|
4
4
|
from machineconfig.utils.utils import CONFIG_PATH, DEFAULTS_PATH
|
|
5
5
|
from machineconfig.utils.utils2 import read_ini
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
"""
|
|
3
3
|
|
|
4
4
|
from machineconfig.utils.path_reduced import P as PathExtended
|
|
5
|
-
from
|
|
5
|
+
from machineconfig.utils.ssh import SSH
|
|
6
|
+
from machineconfig.utils.terminal import Terminal
|
|
6
7
|
from machineconfig.utils.utils import display_options, PROGRAM_PATH, choose_ssh_host
|
|
7
8
|
import platform
|
|
8
9
|
|
|
@@ -73,7 +74,7 @@ $driveLetter = "{driver_letter}"
|
|
|
73
74
|
|
|
74
75
|
print("\n📄 Configuration File Content:")
|
|
75
76
|
print("-" * 50)
|
|
76
|
-
print(PROGRAM_PATH.read_text())
|
|
77
|
+
print(PROGRAM_PATH.read_text(encoding="utf-8"))
|
|
77
78
|
print("-" * 50 + "\n")
|
|
78
79
|
|
|
79
80
|
print("🎉 NFS Mounting Process Completed Successfully!\n")
|
|
@@ -10,11 +10,11 @@ def main():
|
|
|
10
10
|
drive_location = input("🔗 Enter the network drive location (e.g., //192.168.1.100/Share): ")
|
|
11
11
|
machine_name = drive_location.split("//")[1].split("/")[0]
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
if
|
|
13
|
+
mount_point_input = input(f"📂 Enter the mount point directory (e.g., /mnt/network) [Default: ~/data/mount_nw/{machine_name}]: ")
|
|
14
|
+
if mount_point_input == "":
|
|
15
15
|
mount_point = Path.home().joinpath(fr"data/mount_nw/{machine_name}")
|
|
16
16
|
else:
|
|
17
|
-
mount_point = Path(
|
|
17
|
+
mount_point = Path(mount_point_input).expanduser()
|
|
18
18
|
|
|
19
19
|
print(f"\n🌐 Network Drive Location: {drive_location}")
|
|
20
20
|
print(f"📁 Mount Point: {mount_point}\n")
|
|
@@ -30,7 +30,7 @@ mount_point='{mount_point}'
|
|
|
30
30
|
username='{username}'
|
|
31
31
|
password='{password}'
|
|
32
32
|
|
|
33
|
-
""")
|
|
33
|
+
""", encoding="utf-8")
|
|
34
34
|
print("✅ Configuration saved successfully!\n")
|
|
35
35
|
|
|
36
36
|
elif platform.system() == "Windows":
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
"""
|
|
3
3
|
|
|
4
4
|
from platform import system
|
|
5
|
-
from
|
|
5
|
+
from machineconfig.utils.ssh import SSH
|
|
6
|
+
from machineconfig.utils.terminal import Terminal
|
|
6
7
|
from machineconfig.utils.path_reduced import P as PathExtended
|
|
7
8
|
from machineconfig.utils.utils import PROGRAM_PATH, choose_ssh_host
|
|
8
9
|
|
|
@@ -50,7 +51,7 @@ fusermount -u /mnt/dbhdd
|
|
|
50
51
|
else:
|
|
51
52
|
raise ValueError(f"❌ Not implemented for this system: {system()}")
|
|
52
53
|
|
|
53
|
-
PROGRAM_PATH.write_text(txt)
|
|
54
|
+
PROGRAM_PATH.write_text(txt, encoding="utf-8")
|
|
54
55
|
print("✅ Configuration saved successfully!\n")
|
|
55
56
|
|
|
56
57
|
print("🎉 SSHFS Mounting Process Completed!\n")
|
|
@@ -172,7 +172,7 @@ def install_repos(specs_path: str, clone: bool=True, checkout_to_recorded_commit
|
|
|
172
172
|
for repo in repos:
|
|
173
173
|
parent_dir = PathExtended(repo["parent_dir"]).expanduser().absolute()
|
|
174
174
|
parent_dir.mkdir(parents=True, exist_ok=True)
|
|
175
|
-
|
|
175
|
+
|
|
176
176
|
# Handle cloning and remote setup
|
|
177
177
|
if clone:
|
|
178
178
|
# Select the remote to use for cloning
|
|
@@ -185,30 +185,30 @@ def install_repos(specs_path: str, clone: bool=True, checkout_to_recorded_commit
|
|
|
185
185
|
remote_url = repo["remotes"][preferred_remote]
|
|
186
186
|
elif preferred_remote is not None:
|
|
187
187
|
print(f"⚠️ `{preferred_remote=}` not found in {repo['remotes']}.")
|
|
188
|
-
|
|
188
|
+
|
|
189
189
|
# Clone with the selected remote
|
|
190
190
|
program += f"\ncd {parent_dir.collapseuser().as_posix()}; git clone {remote_url} --origin {remote_name} --depth 2"
|
|
191
191
|
program += f"\ncd {parent_dir.collapseuser().as_posix()}/{repo['name']}; git remote set-url {remote_name} {remote_url}"
|
|
192
|
-
|
|
192
|
+
|
|
193
193
|
# Add any additional remotes
|
|
194
194
|
for other_remote_name, other_remote_url in repo["remotes"].items():
|
|
195
195
|
if other_remote_name != remote_name:
|
|
196
196
|
program += f"\ncd {parent_dir.collapseuser().as_posix()}/{repo['name']}; git remote add {other_remote_name} {other_remote_url}"
|
|
197
|
-
|
|
197
|
+
|
|
198
198
|
# Handle checkout operations (after all remotes are set up)
|
|
199
199
|
if checkout_to_recorded_commit:
|
|
200
200
|
commit = repo['version']['commit']
|
|
201
|
-
if isinstance(commit, str):
|
|
201
|
+
if isinstance(commit, str):
|
|
202
202
|
program += f"\ncd {parent_dir.collapseuser().as_posix()}/{repo['name']}; git checkout {commit}"
|
|
203
|
-
else:
|
|
203
|
+
else:
|
|
204
204
|
print(f"Skipping {repo['parent_dir']} because it doesn't have a commit recorded. Found {commit}")
|
|
205
205
|
elif checkout_to_branch:
|
|
206
206
|
program += f"\ncd {parent_dir.collapseuser().as_posix()}/{repo['name']}; git checkout {repo['current_branch']}"
|
|
207
|
-
|
|
207
|
+
|
|
208
208
|
# Handle editable install
|
|
209
209
|
if editable_install:
|
|
210
210
|
program += f"\ncd {parent_dir.collapseuser().as_posix()}/{repo['name']}; uv pip install -e ."
|
|
211
|
-
|
|
211
|
+
|
|
212
212
|
program += "\n"
|
|
213
213
|
pprint(program)
|
|
214
214
|
return program
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
# if args.report:
|
|
31
31
|
# print("📊 Generating report...")
|
|
32
32
|
# reports: list[Report] = [Report.from_path(read_task_from_dir(x).report_path) for x in PathExtended(root).search("*").filter(lambda path: path.joinpath("task.py").exists())]
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
# # Format as markdown table
|
|
35
35
|
# report_data = [r.__dict__ for r in reports]
|
|
36
36
|
# if report_data:
|
|
@@ -4,7 +4,7 @@ slidev
|
|
|
4
4
|
|
|
5
5
|
from machineconfig.utils.utils import CONFIG_PATH, PROGRAM_PATH, print_code
|
|
6
6
|
from machineconfig.utils.path_reduced import P as PathExtended
|
|
7
|
-
from
|
|
7
|
+
from machineconfig.utils.terminal import Terminal
|
|
8
8
|
import subprocess
|
|
9
9
|
import platform
|
|
10
10
|
|
|
@@ -27,7 +27,7 @@ def jupyter_to_markdown(file: PathExtended):
|
|
|
27
27
|
# assert isinstance(nb, nbformat.notebooknode.NotebookNode), f"{file} is not a notebook"
|
|
28
28
|
# e = MarkdownExporter(exclude_input=True, exclude_input_prompt=True, exclude_output_prompt=True)
|
|
29
29
|
# body, resources = e.from_notebook_node(nb=nb)
|
|
30
|
-
# op_dir.joinpath("slides_raw.md").write_text(body)
|
|
30
|
+
# op_dir.joinpath("slides_raw.md").write_text(body, encoding="utf-8")
|
|
31
31
|
# for key, value in resources['outputs'].items():
|
|
32
32
|
|
|
33
33
|
cmd = f"jupyter nbconvert --to markdown --no-prompt --no-input --output-dir {op_dir} --output slides_raw.md {file}"
|
|
@@ -37,9 +37,9 @@ def jupyter_to_markdown(file: PathExtended):
|
|
|
37
37
|
|
|
38
38
|
op_file = op_dir.joinpath("slides_raw.md")
|
|
39
39
|
slide_separator = '\n\n---\n\n'
|
|
40
|
-
md = op_file.read_text().replace('\n\n\n\n', slide_separator)
|
|
40
|
+
md = op_file.read_text(encoding="utf-8").replace('\n\n\n\n', slide_separator)
|
|
41
41
|
md = slide_separator.join([item for item in md.split(slide_separator) if bool(item.strip())])
|
|
42
|
-
op_file.with_name("slides.md").write_text(md)
|
|
42
|
+
op_file.with_name("slides.md").write_text(md, encoding="utf-8")
|
|
43
43
|
print(f"✅ Conversion completed! Check the results at: {op_dir}\n")
|
|
44
44
|
|
|
45
45
|
return op_dir
|
|
@@ -74,12 +74,13 @@ def main() -> None:
|
|
|
74
74
|
if not md_file.exists():
|
|
75
75
|
res = report_dir.search("*.md")
|
|
76
76
|
if len(res) == 1:
|
|
77
|
-
md_file = res
|
|
77
|
+
md_file = res[0]
|
|
78
78
|
else:
|
|
79
79
|
raise FileNotFoundError(f"❌ slides.md not found in {report_dir}")
|
|
80
80
|
|
|
81
81
|
print("📂 Copying files to Slidev repository...")
|
|
82
|
-
report_dir.search()
|
|
82
|
+
for item in report_dir.search():
|
|
83
|
+
item.copy(folder=SLIDEV_REPO, overwrite=True)
|
|
83
84
|
if md_file.name != "slides.md":
|
|
84
85
|
SLIDEV_REPO.joinpath(md_file.name).with_name(name="slides.md", inplace=True, overwrite=True)
|
|
85
86
|
|
|
@@ -96,7 +97,7 @@ def main() -> None:
|
|
|
96
97
|
print(f" - http://{local_ip_v4}:{port}\n")
|
|
97
98
|
|
|
98
99
|
program = "npm run dev slides.md -- --remote"
|
|
99
|
-
PROGRAM_PATH.write_text(program)
|
|
100
|
+
PROGRAM_PATH.write_text(program, encoding="utf-8")
|
|
100
101
|
print_code(code=program, lexer="bash", desc="Run the following command to start the presentation")
|
|
101
102
|
|
|
102
103
|
if __name__ == '__main__':
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
from pathlib import Path
|
|
2
|
-
from machineconfig.utils.path_reduced import P as PathExtended
|
|
3
|
-
from machineconfig.utils.io_save import save_pickle
|
|
4
|
-
from plotly import graph_objects as go
|
|
5
|
-
import plotly.express as px
|
|
6
|
-
from typing import Callable, Iterable, Any, Optional
|
|
1
|
+
# from pathlib import Path
|
|
2
|
+
# from machineconfig.utils.path_reduced import P as PathExtended
|
|
3
|
+
# from machineconfig.utils.io_save import save_pickle
|
|
4
|
+
# from plotly import graph_objects as go
|
|
5
|
+
# import plotly.express as px
|
|
6
|
+
# from typing import Callable, Iterable, Any, Optional
|
|
7
7
|
|
|
8
|
-
def default_get_figure(data: Any) -> go.Figure:
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
# def default_get_figure(data: Any) -> go.Figure:
|
|
9
|
+
# print("📊 Generating default figure using Plotly...")
|
|
10
|
+
# return px.line(data)
|
|
11
11
|
|
|
12
|
-
default_streamlit_config = """
|
|
12
|
+
# default_streamlit_config = """
|
|
13
13
|
|
|
14
|
-
[server]
|
|
15
|
-
headless = true
|
|
16
|
-
port = 4614
|
|
14
|
+
# [server]
|
|
15
|
+
# headless = true
|
|
16
|
+
# port = 4614
|
|
17
17
|
|
|
18
|
-
"""
|
|
18
|
+
# """
|
|
19
19
|
|
|
20
|
-
def run(data: Optional[Iterable[Any]], data_path: Optional[str],
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
# def run(data: Optional[Iterable[Any]], data_path: Optional[str],
|
|
21
|
+
# get_figure: Optional[Callable[[Any], go.Figure]]):
|
|
22
|
+
# print("\n" + "=" * 50)
|
|
23
|
+
# print("👁️ Welcome to the Data Viewer Tool")
|
|
24
|
+
# print("=" * 50 + "\n")
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
# print("📂 Preparing viewer application...")
|
|
27
|
+
# code = PathExtended(__file__).parent.joinpath("viewer_template.py").read_text(encoding='utf-8')
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
# code_dir = PathExtended.tmpdir(prefix="viewer")
|
|
30
|
+
# code_dir.joinpath(".streamlit").mkdir(parents=True, exist_ok=False)
|
|
31
|
+
# code_dir.joinpath(".streamlit/config.toml").write_text(default_streamlit_config, encoding='utf-8')
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
# if data_path is None:
|
|
34
|
+
# print("💾 Saving data to temporary path...")
|
|
35
|
+
# data_path = str(save_pickle(obj=data, path=code_dir.joinpath("data.pkl")))
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
# code = code.replace("""data_path = \"get_figure_placeholder.pkl\" """, f"""data_path = r"{data_path}" """)
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
# import inspect
|
|
40
|
+
# if get_figure is None:
|
|
41
|
+
# print("📊 Using default figure generation function.")
|
|
42
|
+
# get_figure = default_get_figure
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
# code_func = inspect.getsource(get_figure)
|
|
45
|
+
# code_parts = code.split("# get_figure_placeholder")
|
|
46
|
+
# code = code_parts[0] + code_func + f"""\nget_figure = {get_figure.__name__}""" + code_parts[-1]
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
# code_path = code_dir.joinpath("viewer_app.py")
|
|
49
|
+
# Path(code_path).write_text(code, encoding='utf-8')
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
# print("✅ Viewer application prepared successfully!")
|
|
52
|
+
# print(f"📂 Application files saved to: {code_dir}\n")
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
# return code_path
|