machineconfig 4.92__py3-none-any.whl → 4.93__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/scripts/python/fire_jobs.py +11 -10
- machineconfig/scripts/python/fire_jobs_args_helper.py +62 -4
- machineconfig/settings/linters/.ruff.toml +1 -1
- {machineconfig-4.92.dist-info → machineconfig-4.93.dist-info}/METADATA +1 -1
- {machineconfig-4.92.dist-info → machineconfig-4.93.dist-info}/RECORD +8 -8
- {machineconfig-4.92.dist-info → machineconfig-4.93.dist-info}/WHEEL +0 -0
- {machineconfig-4.92.dist-info → machineconfig-4.93.dist-info}/entry_points.txt +0 -0
- {machineconfig-4.92.dist-info → machineconfig-4.93.dist-info}/top_level.txt +0 -0
|
@@ -45,11 +45,11 @@ def route(args: FireJobArgs, fire_args: str = "") -> None:
|
|
|
45
45
|
ipy_profile = "default"
|
|
46
46
|
|
|
47
47
|
if choice_file.suffix == ".py":
|
|
48
|
-
|
|
48
|
+
kwargs_dict = extract_kwargs(args) # This now returns empty dict, but kept for compatibility
|
|
49
49
|
activate_ve_line = get_ve_activate_line(ve_root=args.ve or ve_root_from_file or "$HOME/code/machineconfig/.venv")
|
|
50
50
|
else:
|
|
51
51
|
activate_ve_line = ""
|
|
52
|
-
|
|
52
|
+
kwargs_dict = {}
|
|
53
53
|
|
|
54
54
|
# ========================= choosing function to run
|
|
55
55
|
choice_function: Optional[str] = None # Initialize to avoid unbound variable
|
|
@@ -64,9 +64,9 @@ def route(args: FireJobArgs, fire_args: str = "") -> None:
|
|
|
64
64
|
|
|
65
65
|
if choice_function == "RUN AS MAIN":
|
|
66
66
|
choice_function = None
|
|
67
|
-
if len(choice_function_args) > 0 and len(
|
|
67
|
+
if len(choice_function_args) > 0 and len(kwargs_dict) == 0:
|
|
68
68
|
for item in choice_function_args:
|
|
69
|
-
|
|
69
|
+
kwargs_dict[item.name] = input(f"Please enter a value for argument `{item.name}` (type = {item.type}) (default = {item.default}) : ") or item.default
|
|
70
70
|
elif choice_file.suffix == ".sh": # in this case, we choos lines.
|
|
71
71
|
options = []
|
|
72
72
|
for line in choice_file.read_text(encoding="utf-8").splitlines():
|
|
@@ -88,6 +88,7 @@ def route(args: FireJobArgs, fire_args: str = "") -> None:
|
|
|
88
88
|
if choice_file.suffix == ".py":
|
|
89
89
|
if args.streamlit:
|
|
90
90
|
import socket
|
|
91
|
+
|
|
91
92
|
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
92
93
|
try:
|
|
93
94
|
s.connect(("8.8.8.8", 1))
|
|
@@ -153,9 +154,7 @@ def route(args: FireJobArgs, fire_args: str = "") -> None:
|
|
|
153
154
|
else:
|
|
154
155
|
raise NotImplementedError(f"File type {choice_file.suffix} not supported, in the sense that I don't know how to fire it.")
|
|
155
156
|
|
|
156
|
-
if (
|
|
157
|
-
args.module or (args.debug and args.choose_function)
|
|
158
|
-
): # 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.
|
|
157
|
+
if args.module or (args.debug and args.choose_function): # 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.
|
|
159
158
|
assert choice_file.suffix == ".py", f"File must be a python file to be imported as a module. Got {choice_file}"
|
|
160
159
|
import_line = get_import_module_code(str(choice_file))
|
|
161
160
|
if repo_root is not None:
|
|
@@ -178,7 +177,7 @@ except (ImportError, ModuleNotFoundError) as ex:
|
|
|
178
177
|
txt = (
|
|
179
178
|
txt
|
|
180
179
|
+ f"""
|
|
181
|
-
res = {choice_function}({("**" + str(
|
|
180
|
+
res = {choice_function}({("**" + str(kwargs_dict)) if kwargs_dict else ""})
|
|
182
181
|
"""
|
|
183
182
|
)
|
|
184
183
|
|
|
@@ -346,10 +345,10 @@ def main(
|
|
|
346
345
|
watch: Annotated[bool, typer.Option("--watch", "-w", help="Watch the file for changes")] = False,
|
|
347
346
|
) -> None:
|
|
348
347
|
"""Main function to process fire jobs arguments."""
|
|
349
|
-
|
|
348
|
+
|
|
350
349
|
# Get Fire arguments from context
|
|
351
350
|
fire_args = parse_fire_args_from_context(ctx)
|
|
352
|
-
|
|
351
|
+
|
|
353
352
|
args = FireJobArgs(
|
|
354
353
|
path=path,
|
|
355
354
|
function=function,
|
|
@@ -381,6 +380,7 @@ def main(
|
|
|
381
380
|
except Exception as e:
|
|
382
381
|
# For other exceptions, print clean error message and exit
|
|
383
382
|
import sys
|
|
383
|
+
|
|
384
384
|
print(f"❌ Error: {e}", file=sys.stderr)
|
|
385
385
|
sys.exit(1)
|
|
386
386
|
|
|
@@ -389,6 +389,7 @@ def main_from_parser():
|
|
|
389
389
|
# from trogon.typer import init_tui
|
|
390
390
|
# from trogon.typer import init_tui
|
|
391
391
|
from typer import Typer
|
|
392
|
+
|
|
392
393
|
app = Typer(add_completion=False)
|
|
393
394
|
app.command(context_settings={"allow_extra_args": True, "allow_interspersed_args": False})(main)
|
|
394
395
|
# typer.run(main)
|
|
@@ -30,12 +30,70 @@ class FireJobArgs:
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
def extract_kwargs(args: FireJobArgs) -> dict[str, object]:
|
|
33
|
-
"""Extract kwargs from command line
|
|
33
|
+
"""Extract kwargs from command line arguments in Fire format.
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
Parses Fire-like arguments (e.g., --a=2, --name=value) from sys.argv
|
|
36
|
+
and returns them as a dictionary.
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
Dictionary mapping argument names to their values
|
|
37
40
|
"""
|
|
38
|
-
|
|
41
|
+
import sys
|
|
42
|
+
|
|
43
|
+
kwargs: dict[str, object] = {}
|
|
44
|
+
|
|
45
|
+
# Look for Fire-style arguments in sys.argv
|
|
46
|
+
for arg in sys.argv:
|
|
47
|
+
# Match patterns like --key=value or --key value (but we'll focus on --key=value)
|
|
48
|
+
if arg.startswith('--') and '=' in arg:
|
|
49
|
+
key, value = arg[2:].split('=', 1) # Remove -- prefix and split on first =
|
|
50
|
+
|
|
51
|
+
# Try to convert value to appropriate type
|
|
52
|
+
kwargs[key] = _convert_value_type(value)
|
|
53
|
+
elif arg.startswith('--') and '=' not in arg:
|
|
54
|
+
# Handle boolean flags like --debug
|
|
55
|
+
key = arg[2:] # Remove -- prefix
|
|
56
|
+
# Check if next argument exists and doesn't start with --
|
|
57
|
+
arg_index = sys.argv.index(arg)
|
|
58
|
+
if arg_index + 1 < len(sys.argv) and not sys.argv[arg_index + 1].startswith('--'):
|
|
59
|
+
# Next argument is the value
|
|
60
|
+
value = sys.argv[arg_index + 1]
|
|
61
|
+
kwargs[key] = _convert_value_type(value)
|
|
62
|
+
else:
|
|
63
|
+
# It's a boolean flag
|
|
64
|
+
kwargs[key] = True
|
|
65
|
+
|
|
66
|
+
return kwargs
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _convert_value_type(value: str) -> object:
|
|
70
|
+
"""Convert string value to appropriate Python type."""
|
|
71
|
+
# Try to convert to int
|
|
72
|
+
try:
|
|
73
|
+
if '.' not in value and 'e' not in value.lower():
|
|
74
|
+
return int(value)
|
|
75
|
+
except ValueError:
|
|
76
|
+
pass
|
|
77
|
+
|
|
78
|
+
# Try to convert to float
|
|
79
|
+
try:
|
|
80
|
+
return float(value)
|
|
81
|
+
except ValueError:
|
|
82
|
+
pass
|
|
83
|
+
|
|
84
|
+
# Try to convert boolean strings
|
|
85
|
+
if value.lower() in ('true', '1', 'yes', 'on'):
|
|
86
|
+
return True
|
|
87
|
+
elif value.lower() in ('false', '0', 'no', 'off'):
|
|
88
|
+
return False
|
|
89
|
+
|
|
90
|
+
# Try to parse as list (comma-separated values)
|
|
91
|
+
if ',' in value:
|
|
92
|
+
items = [_convert_value_type(item.strip()) for item in value.split(',')]
|
|
93
|
+
return items
|
|
94
|
+
|
|
95
|
+
# Return as string if no conversion possible
|
|
96
|
+
return value
|
|
39
97
|
|
|
40
98
|
|
|
41
99
|
def parse_fire_args_from_argv() -> str:
|
|
@@ -158,8 +158,8 @@ machineconfig/scripts/python/fire_agents_help_launch.py,sha256=1ymWiszfjCyPv3ofi
|
|
|
158
158
|
machineconfig/scripts/python/fire_agents_help_search.py,sha256=qIfSS_su2YJ1Gb0_lu4cbjlJlYMBw0v52NTGiSrGjk8,2991
|
|
159
159
|
machineconfig/scripts/python/fire_agents_helper_types.py,sha256=zKu8Vr6iucaGSkCm_Tkt_WrYU7-6Nript3coYyzTXzY,295
|
|
160
160
|
machineconfig/scripts/python/fire_agents_load_balancer.py,sha256=mpqx3uaQdBXYieuvhdK-qsvLepf9oIMo3pwPj9mSEDI,1079
|
|
161
|
-
machineconfig/scripts/python/fire_jobs.py,sha256=
|
|
162
|
-
machineconfig/scripts/python/fire_jobs_args_helper.py,sha256=
|
|
161
|
+
machineconfig/scripts/python/fire_jobs.py,sha256=bad66rJK0_hsSzInXpXp_R-eXNyDMRvVV14zA5nANMg,20271
|
|
162
|
+
machineconfig/scripts/python/fire_jobs_args_helper.py,sha256=VZIQ6ShZBt2WLcqa1fpl1419AGa0k7Xg-EzzrKpDIqw,4029
|
|
163
163
|
machineconfig/scripts/python/fire_jobs_streamlit_helper.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
164
164
|
machineconfig/scripts/python/ftpx.py,sha256=l_gdJS0QB2wVZErubtZvm4HJD9HZAJxSP68sbY73xwo,10278
|
|
165
165
|
machineconfig/scripts/python/get_zellij_cmd.py,sha256=e35-18hoXM9N3PFbvbizfkNY_-63iMicieWE3TbGcCQ,576
|
|
@@ -306,7 +306,7 @@ machineconfig/settings/lf/windows/autocall/rename.ps1,sha256=47DEQpj8HBSa-_TImW-
|
|
|
306
306
|
machineconfig/settings/linters/.flake8,sha256=1By04Qwy5saCudYKOw2bKHSNQg4N128SJudwD3SVGhQ,1958
|
|
307
307
|
machineconfig/settings/linters/.mypy.ini,sha256=BNxVtNuliJZVeFpCRRIQpSWFDQYuKqKtcVKYcZ-sApc,811
|
|
308
308
|
machineconfig/settings/linters/.pylintrc,sha256=_hYrPgtMvQc877u5NTU_HlkJMZwuDrmB6Yt3u5zg3-c,3593
|
|
309
|
-
machineconfig/settings/linters/.ruff.toml,sha256=
|
|
309
|
+
machineconfig/settings/linters/.ruff.toml,sha256=5C-8Fkj9mdZxs3ajeideTNUOKRSo31dDYW1VQmDzK6w,1655
|
|
310
310
|
machineconfig/settings/lvim/linux/config.lua,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
311
311
|
machineconfig/settings/lvim/windows/config.lua,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
312
312
|
machineconfig/settings/lvim/windows/archive/config_additional.lua,sha256=zj-VDn-Av4IomJ3EqM1gf_6VsZ9ieG815O9QK1slyPI,792
|
|
@@ -404,8 +404,8 @@ machineconfig/utils/schemas/fire_agents/fire_agents_input.py,sha256=pTxvLzIpD5RF
|
|
|
404
404
|
machineconfig/utils/schemas/installer/installer_types.py,sha256=QClRY61QaduBPJoSpdmTIdgS9LS-RvE-QZ-D260tD3o,1214
|
|
405
405
|
machineconfig/utils/schemas/layouts/layout_types.py,sha256=TcqlZdGVoH8htG5fHn1KWXhRdPueAcoyApppZsPAPto,2020
|
|
406
406
|
machineconfig/utils/schemas/repos/repos_types.py,sha256=ECVr-3IVIo8yjmYmVXX2mnDDN1SLSwvQIhx4KDDQHBQ,405
|
|
407
|
-
machineconfig-4.
|
|
408
|
-
machineconfig-4.
|
|
409
|
-
machineconfig-4.
|
|
410
|
-
machineconfig-4.
|
|
411
|
-
machineconfig-4.
|
|
407
|
+
machineconfig-4.93.dist-info/METADATA,sha256=04GF2cymQW0SDxwA0oGIroHpIP-TFvPJyz6zmgaCTrI,7061
|
|
408
|
+
machineconfig-4.93.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
409
|
+
machineconfig-4.93.dist-info/entry_points.txt,sha256=LcwklRJPY_uKBvStgtOJn5G_pmFCEdpgRNzUUc6twAQ,1134
|
|
410
|
+
machineconfig-4.93.dist-info/top_level.txt,sha256=porRtB8qms8fOIUJgK-tO83_FeH6Bpe12oUVC670teA,14
|
|
411
|
+
machineconfig-4.93.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|