apheris-foundry-cli 2.1.1__tar.gz → 2.2.0__tar.gz

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.
Files changed (64) hide show
  1. {apheris_foundry_cli-2.1.1/src/apheris_foundry_cli.egg-info → apheris_foundry_cli-2.2.0}/PKG-INFO +8 -1
  2. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/README.md +7 -0
  3. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/pyproject.toml +1 -1
  4. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0/src/apheris_foundry_cli.egg-info}/PKG-INFO +8 -1
  5. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/commands/weights.py +5 -1
  6. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/core/hub_requests.py +8 -3
  7. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/skills/apheris-foundry-hub/SKILL.md +11 -0
  8. apheris_foundry_cli-2.2.0/src/apherisfold_cli/version.py +1 -0
  9. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/tests/test_cli.py +49 -7
  10. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/tests/test_hub_requests.py +41 -0
  11. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/tests/test_weights.py +32 -5
  12. apheris_foundry_cli-2.1.1/src/apherisfold_cli/version.py +0 -1
  13. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/LICENSE +0 -0
  14. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/setup.cfg +0 -0
  15. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apheris_foundry_cli.egg-info/SOURCES.txt +0 -0
  16. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apheris_foundry_cli.egg-info/dependency_links.txt +0 -0
  17. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apheris_foundry_cli.egg-info/entry_points.txt +0 -0
  18. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apheris_foundry_cli.egg-info/requires.txt +0 -0
  19. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apheris_foundry_cli.egg-info/top_level.txt +0 -0
  20. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/__init__.py +0 -0
  21. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/commands/__init__.py +0 -0
  22. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/commands/compounds.py +0 -0
  23. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/commands/foundry.py +0 -0
  24. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/commands/login.py +0 -0
  25. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/commands/settings.py +0 -0
  26. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/commands/skills.py +0 -0
  27. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/core/__init__.py +0 -0
  28. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/core/auth.py +0 -0
  29. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/core/config.py +0 -0
  30. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/core/context.py +0 -0
  31. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/core/documents.py +0 -0
  32. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/core/errors.py +0 -0
  33. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/core/input_archive.py +0 -0
  34. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/core/io.py +0 -0
  35. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/core/limits.py +0 -0
  36. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/core/login_profiles.py +0 -0
  37. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/core/msa.py +0 -0
  38. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/core/pubchem.py +0 -0
  39. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/core/render.py +0 -0
  40. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/core/result_artifacts.py +0 -0
  41. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/core/transient.py +0 -0
  42. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/handlers.py +0 -0
  43. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/src/apherisfold_cli/main.py +0 -0
  44. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/tests/test_auth.py +0 -0
  45. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/tests/test_auth_lifecycle.py +0 -0
  46. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/tests/test_benchmark_examples.py +0 -0
  47. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/tests/test_config.py +0 -0
  48. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/tests/test_documents.py +0 -0
  49. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/tests/test_dry_run_guard.py +0 -0
  50. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/tests/test_foundry_helpers.py +0 -0
  51. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/tests/test_foundry_warnings.py +0 -0
  52. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/tests/test_handlers.py +0 -0
  53. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/tests/test_input_archive.py +0 -0
  54. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/tests/test_io.py +0 -0
  55. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/tests/test_jobs_metadata.py +0 -0
  56. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/tests/test_jobs_update.py +0 -0
  57. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/tests/test_login_callback.py +0 -0
  58. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/tests/test_main.py +0 -0
  59. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/tests/test_model_discovery.py +0 -0
  60. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/tests/test_msa.py +0 -0
  61. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/tests/test_pubchem.py +0 -0
  62. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/tests/test_render.py +0 -0
  63. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/tests/test_result_artifacts.py +0 -0
  64. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.2.0}/tests/test_skills.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apheris-foundry-cli
3
- Version: 2.1.1
3
+ Version: 2.2.0
4
4
  Summary: Command-line interface for Apheris Foundry workflows.
5
5
  Author: Apheris
6
6
  License-Expression: LicenseRef-Apheris-Foundry-Software-License
@@ -445,6 +445,13 @@ identity and ownership. `--dry-run true weights enable ...` prints the request
445
445
  without submission. Verify selection in the target workflow's model catalog
446
446
  before reuse.
447
447
 
448
+ Enabling weights can take several minutes while Hub copies and verifies large
449
+ checkpoints. The HTTP timeout defaults to 300 seconds; use `--timeout 1800` to
450
+ allow 30 minutes, or another positive integer number of seconds (minimum: 1).
451
+ This setting applies only to the enable request and cannot override a shorter server or
452
+ network timeout. If the outcome is uncertain, check `weights list --run-id`
453
+ before retrying; the CLI does not automatically retry the write.
454
+
448
455
  **Sharing.** Enabled weights are private. `--public` shares a weight with every
449
456
  authenticated user of this Hub; they can list, inspect and run with it, but only
450
457
  the owner can update or delete it. Hub fixes visibility when enabling: to stop
@@ -419,6 +419,13 @@ identity and ownership. `--dry-run true weights enable ...` prints the request
419
419
  without submission. Verify selection in the target workflow's model catalog
420
420
  before reuse.
421
421
 
422
+ Enabling weights can take several minutes while Hub copies and verifies large
423
+ checkpoints. The HTTP timeout defaults to 300 seconds; use `--timeout 1800` to
424
+ allow 30 minutes, or another positive integer number of seconds (minimum: 1).
425
+ This setting applies only to the enable request and cannot override a shorter server or
426
+ network timeout. If the outcome is uncertain, check `weights list --run-id`
427
+ before retrying; the CLI does not automatically retry the write.
428
+
422
429
  **Sharing.** Enabled weights are private. `--public` shares a weight with every
423
430
  authenticated user of this Hub; they can list, inspect and run with it, but only
424
431
  the owner can update or delete it. Hub fixes visibility when enabling: to stop
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "apheris-foundry-cli"
7
- version = "2.1.1"
7
+ version = "2.2.0"
8
8
  description = "Command-line interface for Apheris Foundry workflows."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apheris-foundry-cli
3
- Version: 2.1.1
3
+ Version: 2.2.0
4
4
  Summary: Command-line interface for Apheris Foundry workflows.
5
5
  Author: Apheris
6
6
  License-Expression: LicenseRef-Apheris-Foundry-Software-License
@@ -445,6 +445,13 @@ identity and ownership. `--dry-run true weights enable ...` prints the request
445
445
  without submission. Verify selection in the target workflow's model catalog
446
446
  before reuse.
447
447
 
448
+ Enabling weights can take several minutes while Hub copies and verifies large
449
+ checkpoints. The HTTP timeout defaults to 300 seconds; use `--timeout 1800` to
450
+ allow 30 minutes, or another positive integer number of seconds (minimum: 1).
451
+ This setting applies only to the enable request and cannot override a shorter server or
452
+ network timeout. If the outcome is uncertain, check `weights list --run-id`
453
+ before retrying; the CLI does not automatically retry the write.
454
+
448
455
  **Sharing.** Enabled weights are private. `--public` shares a weight with every
449
456
  authenticated user of this Hub; they can list, inspect and run with it, but only
450
457
  the owner can update or delete it. Hub fixes visibility when enabling: to stop
@@ -234,6 +234,10 @@ def enable_weight(
234
234
  help="Share with every authenticated user of this Hub. Cannot be changed later; private by default.",
235
235
  ),
236
236
  ] = False,
237
+ timeout: Annotated[
238
+ int,
239
+ typer.Option("--timeout", min=1, help="HTTP timeout in seconds while Hub copies and registers the weights."),
240
+ ] = 300,
237
241
  json_output: Annotated[bool, typer.Option("--json")] = False,
238
242
  ) -> None:
239
243
  """Enable weights from a job artifact in Hub's weight catalog; this does not run prediction.
@@ -265,7 +269,7 @@ def enable_weight(
265
269
  json_output=json_output,
266
270
  )
267
271
  return
268
- payload = deploy_model_weight(body)
272
+ payload = deploy_model_weight(body, timeout=timeout)
269
273
  if json_output:
270
274
  run_simple_listing(payload=payload)
271
275
  return
@@ -191,6 +191,7 @@ def _request_json(
191
191
  task: str,
192
192
  body: dict[str, Any] | None = None,
193
193
  content_type: str = "application/json",
194
+ timeout: float = 30,
194
195
  ) -> dict[str, Any]:
195
196
  url = _hub_url(path)
196
197
  payload: bytes | None = None
@@ -205,7 +206,7 @@ def _request_json(
205
206
  method=method,
206
207
  )
207
208
 
208
- raw = _read_with_auth_retry(build_request=build_request, timeout=30, task=task, url=url)
209
+ raw = _read_with_auth_retry(build_request=build_request, timeout=timeout, task=task, url=url)
209
210
  return _decode_json(raw, task=task, url=url)
210
211
 
211
212
 
@@ -511,9 +512,13 @@ def list_model_weights(
511
512
  return _request_json(path="/api/v1/weights" + suffix, method="GET", task="weights.list")
512
513
 
513
514
 
514
- def deploy_model_weight(body: dict[str, Any]) -> dict[str, Any]:
515
+ def deploy_model_weight(body: dict[str, Any], *, timeout: float = 300) -> dict[str, Any]:
515
516
  try:
516
- return _request_json(path="/api/v1/weights/deploy", method="POST", body=body, task="weights.deploy")
517
+ # Hub copies, hashes and syncs multi-GB checkpoints before responding.
518
+ # Allow a longer wait without extending ordinary API reads or retrying writes.
519
+ return _request_json(
520
+ path="/api/v1/weights/deploy", method="POST", body=body, task="weights.deploy", timeout=timeout
521
+ )
517
522
  except CLIError as exc:
518
523
  if (exc.details or {}).get("status_code") != 409:
519
524
  raise
@@ -329,6 +329,17 @@ apheris-foundry weights enable --name <unique-weight-name> --run-id <training-jo
329
329
  does not run prediction or upload local weights. On Hub versions containing
330
330
  hub#3142, enabled weights survive deletion of the producing job.
331
331
 
332
+ Hub copies and verifies the checkpoint before replying, so large weights may
333
+ need several minutes. `weights enable --timeout SECONDS` controls the CLI's
334
+ HTTP wait: the default is 300 seconds (five minutes), and the minimum is one second.
335
+ For larger weights, add `--timeout 1800` to allow 30 minutes; use a positive
336
+ integer number of seconds. Confirm the installed command exposes this option with
337
+ `weights enable --help`. A longer CLI timeout cannot override a shorter server
338
+ or network timeout. On a timeout or lost response, check
339
+ `weights list --run-id <training-job-id> --json` and the target model catalog
340
+ before retrying: Hub may have applied the request. The CLI does not automatically
341
+ retry an uncertain write.
342
+
332
343
  A 409 means inspect existing weights and the reported conflict before
333
344
  retrying. A listing alone does not prove backing files still exist. Deleted
334
345
  records (`--include-deleted`) are historical, not selectable weights.
@@ -0,0 +1 @@
1
+ __version__ = "2.2.0"
@@ -12,6 +12,7 @@ from typing import Any
12
12
  from unittest.mock import patch
13
13
 
14
14
  import pytest
15
+ from rich.console import Console
15
16
  from rich.text import Text
16
17
  from typer.testing import CliRunner
17
18
 
@@ -566,25 +567,66 @@ def _workflow_docs_payload(content: str = "# OpenFold3 Prediction\n\nPredict str
566
567
  }
567
568
 
568
569
 
569
- def test_foundry_workflows_docs_renders_the_package_readme(monkeypatch) -> None:
570
+ @pytest.fixture
571
+ def workflow_docs_markdown() -> str:
572
+ return """# Example workflow
573
+
574
+ ## Inputs
575
+
576
+ **Include both files.** Compute allocation is managed by Hub.
577
+
578
+ - Upload `input.csv`.
579
+ - Upload `config.json`.
580
+
581
+ | Setting | Meaning | Default |
582
+ | --- | --- | --- |
583
+ | `limit` | Maximum rows | 10 |
584
+
585
+ ```json
586
+ {"limit": 5}
587
+ ```
588
+
589
+ ## Results
590
+
591
+ 1. Download `result.json`.
592
+ 2. Inspect missing values.
593
+ """
594
+
595
+
596
+ @pytest.mark.parametrize("force_terminal", [False, True])
597
+ def test_foundry_workflows_docs_renders_the_package_readme(monkeypatch, workflow_docs_markdown, force_terminal) -> None:
570
598
  requested: list[str] = []
599
+ console = Console(force_terminal=force_terminal, color_system="standard", width=100)
600
+ monkeypatch.setattr("apherisfold_cli.handlers._CONSOLE", console)
571
601
 
572
602
  def fake_get_foundry_workflow_docs(workflow_id):
573
603
  requested.append(workflow_id)
574
- return _workflow_docs_payload()
604
+ return _workflow_docs_payload(workflow_docs_markdown)
575
605
 
576
606
  monkeypatch.setattr("apherisfold_cli.main.get_foundry_workflow_docs", fake_get_foundry_workflow_docs)
577
607
  result = runner.invoke(app, ["workflows", "docs", "--workflow", "predict"])
578
608
 
579
609
  assert result.exit_code == 0
580
- assert "OpenFold3 Prediction" in result.stdout
581
- assert "# OpenFold3" not in result.stdout
582
- assert "Predict structures." in result.stdout
610
+ rendered = Text.from_ansi(result.stdout)
611
+ output = rendered.plain
612
+ assert "Example workflow" in output
613
+ assert "Inputs" in output and "Results" in output
614
+ assert "Upload input.csv." in output and "Upload config.json." in output
615
+ assert "1 Download result.json." in output and "2 Inspect missing values." in output
616
+ assert "Setting" in output and "Meaning" in output and "Default" in output
617
+ assert "limit" in output and "Maximum rows" in output and "10" in output
618
+ assert '{"limit": 5}' in output
619
+ assert "Include both files." in output and "Compute allocation is managed by Hub." in output
620
+ for marker in ("# Example", "## Inputs", "**", "```", "| Setting |", "| --- |"):
621
+ assert marker not in output
622
+ if force_terminal:
623
+ assert rendered.get_style_at_offset(console, output.index("Include both files.")).bold
624
+ assert not rendered.get_style_at_offset(console, output.index("Compute allocation")).bold
583
625
  assert requested == ["predict"]
584
626
 
585
627
 
586
- def test_foundry_workflows_docs_json_output(monkeypatch) -> None:
587
- payload = _workflow_docs_payload()
628
+ def test_foundry_workflows_docs_json_output(monkeypatch, workflow_docs_markdown) -> None:
629
+ payload = _workflow_docs_payload(workflow_docs_markdown)
588
630
  monkeypatch.setattr("apherisfold_cli.main.get_foundry_workflow_docs", lambda workflow_id: payload)
589
631
  result = runner.invoke(app, ["workflows", "docs", "--workflow", "predict", "--json"])
590
632
 
@@ -14,6 +14,7 @@ from apherisfold_cli.core.errors import CLIError
14
14
  from apherisfold_cli.core.hub_requests import (
15
15
  _request_json,
16
16
  create_foundry_run,
17
+ deploy_model_weight,
17
18
  download_foundry_run_archive,
18
19
  download_foundry_run_artifact,
19
20
  get_foundry_run,
@@ -39,6 +40,46 @@ class FakeResponse:
39
40
  return self._payload
40
41
 
41
42
 
43
+ @pytest.mark.parametrize("timeout_kwargs, expected_timeout", [({}, 300), ({"timeout": 1800}, 1800)])
44
+ def test_enable_waits_for_large_checkpoint_copy_without_extending_normal_requests(
45
+ tmp_path, monkeypatch, timeout_kwargs, expected_timeout
46
+ ) -> None:
47
+ _save_refreshable_session(tmp_path, monkeypatch)
48
+ timeouts = []
49
+ body = {"runId": "run-1", "path": "output/finetune/checkpoints/epoch=227-step=456.ckpt", "name": "Ranked"}
50
+
51
+ def fake_urlopen(request, *, timeout, **_kwargs):
52
+ timeouts.append(timeout)
53
+ if request.get_method() == "POST":
54
+ assert request.full_url.endswith("/api/v1/weights/deploy")
55
+ assert json.loads(request.data) == body
56
+ if timeout < 60:
57
+ raise TimeoutError("Checkpoint copy takes longer than 30 seconds")
58
+ return FakeResponse(b'{"id":"weight-1"}')
59
+ return FakeResponse(b'{"id":"run-1"}')
60
+
61
+ monkeypatch.setattr("apherisfold_cli.core.hub_requests.urllib.request.urlopen", fake_urlopen)
62
+ assert deploy_model_weight(body, **timeout_kwargs) == {"id": "weight-1"}
63
+ assert get_foundry_run("run-1") == {"id": "run-1"}
64
+ assert timeouts == [expected_timeout, 30]
65
+
66
+
67
+ def test_enable_timeout_is_not_retried_and_preserves_uncertain_outcome(tmp_path, monkeypatch) -> None:
68
+ _save_refreshable_session(tmp_path, monkeypatch)
69
+ calls = []
70
+
71
+ def fake_urlopen(request, **_kwargs):
72
+ calls.append(request.get_method())
73
+ raise TimeoutError("Checkpoint storage did not respond")
74
+
75
+ monkeypatch.setattr("apherisfold_cli.core.hub_requests.urllib.request.urlopen", fake_urlopen)
76
+ with pytest.raises(CLIError) as failure:
77
+ deploy_model_weight({"runId": "run-1", "path": "output/last.ckpt", "name": "Last"})
78
+ assert calls == ["POST"]
79
+ assert failure.value.details["may_have_applied"] is True
80
+ assert "may still have applied" in failure.value.message
81
+
82
+
42
83
  def _save_refreshable_session(tmp_path: Path, monkeypatch) -> None:
43
84
  monkeypatch.setenv("APHERISFOLD_CONFIG_DIR", str(tmp_path))
44
85
  config = RuntimeAuthConfig(
@@ -48,7 +48,10 @@ def test_list_query_encodes_filters(monkeypatch):
48
48
  }
49
49
 
50
50
 
51
- def test_enable_uses_run_relative_bundle_and_server_identity(monkeypatch):
51
+ @pytest.mark.parametrize(
52
+ "timeout_args, expected_timeout", [([], 300), (["--timeout", "1800"], 1800), (["--timeout", "1"], 1)]
53
+ )
54
+ def test_enable_uses_run_relative_bundle_and_server_identity(monkeypatch, timeout_args, expected_timeout):
52
55
  calls = []
53
56
  response = {
54
57
  "id": "weight_test",
@@ -71,7 +74,8 @@ def test_enable_uses_run_relative_bundle_and_server_identity(monkeypatch):
71
74
  "--description",
72
75
  "Four epoch trial",
73
76
  "--json",
74
- ],
77
+ ]
78
+ + timeout_args,
75
79
  )
76
80
  assert result.exit_code == 0, result.output
77
81
  assert json.loads(result.stdout) == response
@@ -80,6 +84,7 @@ def test_enable_uses_run_relative_bundle_and_server_identity(monkeypatch):
80
84
  "path": "/api/v1/weights/deploy",
81
85
  "method": "POST",
82
86
  "task": "weights.deploy",
87
+ "timeout": expected_timeout,
83
88
  "body": {
84
89
  "name": "Affinity head trial",
85
90
  "runId": "foundry_test",
@@ -90,6 +95,28 @@ def test_enable_uses_run_relative_bundle_and_server_identity(monkeypatch):
90
95
  ]
91
96
 
92
97
 
98
+ @pytest.mark.parametrize("timeout", ["0", "-1", "1.5", "nan", "inf", "invalid"])
99
+ def test_enable_rejects_invalid_timeout_before_request(monkeypatch, timeout):
100
+ monkeypatch.setattr(hub_requests, "_request_json", lambda **_: pytest.fail("must not submit invalid timeout"))
101
+ result = runner.invoke(
102
+ app,
103
+ [
104
+ "weights",
105
+ "enable",
106
+ "--name",
107
+ "Trial",
108
+ "--run-id",
109
+ "foundry_test",
110
+ "--path",
111
+ "output/weights",
112
+ "--timeout",
113
+ timeout,
114
+ ],
115
+ )
116
+ assert result.exit_code == 2
117
+ assert "--timeout" in Text.from_ansi(result.output).plain
118
+
119
+
93
120
  @pytest.mark.parametrize(
94
121
  "path", ["/tmp/weights", "../weights", "output/../weights", "C:\\weights", "https://host/weights", " "]
95
122
  )
@@ -154,7 +181,7 @@ def test_enable_rejects_invalid_name_before_request(monkeypatch, name):
154
181
  @pytest.mark.parametrize("name", ["A", "é" * 255])
155
182
  def test_enable_accepts_name_character_boundaries(monkeypatch, name):
156
183
  calls = []
157
- monkeypatch.setattr(weights, "deploy_model_weight", lambda body: calls.append(body) or {"id": "weight_test"})
184
+ monkeypatch.setattr(weights, "deploy_model_weight", lambda body, **_: calls.append(body) or {"id": "weight_test"})
158
185
  result = runner.invoke(
159
186
  app, ["weights", "enable", "--name", name, "--run-id", "foundry_test", "--path", "output/weights", "--json"]
160
187
  )
@@ -553,7 +580,7 @@ def test_mutation_dry_runs_only_read(monkeypatch, args, expected):
553
580
 
554
581
  def test_enable_shares_and_tags_only_when_requested(monkeypatch):
555
582
  calls = []
556
- monkeypatch.setattr(weights, "deploy_model_weight", lambda body: calls.append(body) or {"id": "weight_test"})
583
+ monkeypatch.setattr(weights, "deploy_model_weight", lambda body, **_: calls.append(body) or {"id": "weight_test"})
557
584
  base = ["weights", "enable", "--name", "Trial", "--run-id", "foundry_test", "--path", "output/weights"]
558
585
  result = runner.invoke(app, [*base, "--tag", "benchmark", "--tag", "v1", "--public", "--json"])
559
586
  assert result.exit_code == 0, result.output
@@ -585,7 +612,7 @@ def test_help_documents_lifecycle():
585
612
 
586
613
 
587
614
  def test_enable_reports_success_in_ui_terms(monkeypatch):
588
- monkeypatch.setattr(weights, "deploy_model_weight", lambda body: {**WEIGHT, **body})
615
+ monkeypatch.setattr(weights, "deploy_model_weight", lambda body, **_: {**WEIGHT, **body})
589
616
  result = runner.invoke(
590
617
  app, ["weights", "enable", "--name", "Trial", "--run-id", "foundry_test", "--path", "output/weights"]
591
618
  )
@@ -1 +0,0 @@
1
- __version__ = "2.1.1"