tamarind-cli 0.5.0__tar.gz → 0.5.1__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 (138) hide show
  1. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/PKG-INFO +1 -1
  2. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/pyproject.toml +1 -1
  3. tamarind_cli-0.5.1/src/tamarind/catalog.py +160 -0
  4. tamarind_cli-0.5.1/tests/test_catalog_examples.py +110 -0
  5. tamarind_cli-0.5.0/src/tamarind/catalog.py +0 -70
  6. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/.github/workflows/ci.yml +0 -0
  7. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/.github/workflows/publish.yml +0 -0
  8. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/.gitignore +0 -0
  9. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/LICENSE +0 -0
  10. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/README.md +0 -0
  11. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/docs/architecture.md +0 -0
  12. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/docs/custom-tools.md +0 -0
  13. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/install.sh +0 -0
  14. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/openapi/openapi-python-client.json +0 -0
  15. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/openapi/pipelines-openapi-python-client.json +0 -0
  16. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/openapi/pipelines-v1.json +0 -0
  17. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/openapi/pipelines-v1.lock.json +0 -0
  18. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/openapi/public-v1.json +0 -0
  19. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/openapi/public-v1.lock.json +0 -0
  20. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/scripts/check_custom_tools_provenance.py +0 -0
  21. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/scripts/sync_custom_tools_contract.py +0 -0
  22. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/scripts/sync_pipelines_contract.py +0 -0
  23. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/__init__.py +0 -0
  24. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/attribution.py +0 -0
  25. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/cli/__init__.py +0 -0
  26. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/cli/commands/__init__.py +0 -0
  27. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/cli/commands/auth.py +0 -0
  28. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/cli/commands/catalog.py +0 -0
  29. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/cli/commands/custom_tools.py +0 -0
  30. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/cli/commands/files.py +0 -0
  31. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/cli/commands/jobs.py +0 -0
  32. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/cli/guidance.py +0 -0
  33. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/cli/inputs.py +0 -0
  34. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/cli/main.py +0 -0
  35. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/cli/output.py +0 -0
  36. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/config.py +0 -0
  37. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/__init__.py +0 -0
  38. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_contract.py +0 -0
  39. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/__init__.py +0 -0
  40. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/api/__init__.py +0 -0
  41. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/api/custom_tools/__init__.py +0 -0
  42. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/api/custom_tools/build_custom_tool.py +0 -0
  43. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/api/custom_tools/cancel_custom_tool_build.py +0 -0
  44. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/api/custom_tools/create_custom_tool.py +0 -0
  45. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/api/custom_tools/create_custom_tool_upload.py +0 -0
  46. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/api/custom_tools/delete_custom_tool.py +0 -0
  47. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/api/custom_tools/get_custom_tool.py +0 -0
  48. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/api/custom_tools/list_custom_tool_build_logs.py +0 -0
  49. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/api/custom_tools/list_custom_tool_versions.py +0 -0
  50. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/api/custom_tools/list_custom_tools.py +0 -0
  51. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/api/custom_tools/publish_custom_tool.py +0 -0
  52. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/api/custom_tools/update_custom_tool.py +0 -0
  53. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/client.py +0 -0
  54. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/errors.py +0 -0
  55. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/__init__.py +0 -0
  56. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_build_error.py +0 -0
  57. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_build_event.py +0 -0
  58. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_build_log_page.py +0 -0
  59. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_build_result.py +0 -0
  60. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_build_result_action.py +0 -0
  61. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_create_custom_tool_request.py +0 -0
  62. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_create_custom_tool_request_gputype.py +0 -0
  63. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_create_custom_tool_request_memory.py +0 -0
  64. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_create_version_request.py +0 -0
  65. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_custom_tool.py +0 -0
  66. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_custom_tool_detail.py +0 -0
  67. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_custom_tool_detail_gputype.py +0 -0
  68. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_custom_tool_detail_memory.py +0 -0
  69. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_custom_tool_gputype.py +0 -0
  70. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_custom_tool_memory.py +0 -0
  71. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_custom_tool_page.py +0 -0
  72. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_custom_tool_status.py +0 -0
  73. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_problem.py +0 -0
  74. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_problem_errors_type_0_item.py +0 -0
  75. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_update_custom_tool_request.py +0 -0
  76. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_update_custom_tool_request_gpu_type_type_0.py +0 -0
  77. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_update_custom_tool_request_memory_type_0.py +0 -0
  78. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_upload_session.py +0 -0
  79. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_upload_session_uploadheaders.py +0 -0
  80. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_version.py +0 -0
  81. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_version_page.py +0 -0
  82. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/models/public_version_status.py +0 -0
  83. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/_generated/types.py +0 -0
  84. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/client.py +0 -0
  85. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/packaging.py +0 -0
  86. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/resources.py +0 -0
  87. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/transport.py +0 -0
  88. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/custom_tools/validation.py +0 -0
  89. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/errors.py +0 -0
  90. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/http.py +0 -0
  91. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/jobs.py +0 -0
  92. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/pipelines/__init__.py +0 -0
  93. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/pipelines/_generated/__init__.py +0 -0
  94. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/pipelines/_generated/api/__init__.py +0 -0
  95. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/pipelines/_generated/api/pipelines_public/__init__.py +0 -0
  96. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/pipelines/_generated/api/pipelines_public/get_run.py +0 -0
  97. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/pipelines/_generated/api/pipelines_public/list_node_run_molecules.py +0 -0
  98. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/pipelines/_generated/client.py +0 -0
  99. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/pipelines/_generated/errors.py +0 -0
  100. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/pipelines/_generated/models/__init__.py +0 -0
  101. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/pipelines/_generated/models/node_run_status.py +0 -0
  102. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/pipelines/_generated/models/public_node_run.py +0 -0
  103. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/pipelines/_generated/models/public_node_run_molecule.py +0 -0
  104. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/pipelines/_generated/models/public_node_run_molecule_page.py +0 -0
  105. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/pipelines/_generated/models/public_node_run_molecule_scores.py +0 -0
  106. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/pipelines/_generated/models/public_problem.py +0 -0
  107. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/pipelines/_generated/models/public_problem_errors_type_0_item.py +0 -0
  108. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/pipelines/_generated/models/public_run.py +0 -0
  109. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/pipelines/_generated/models/public_run_inputs.py +0 -0
  110. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/pipelines/_generated/models/run_status.py +0 -0
  111. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/pipelines/_generated/models/source.py +0 -0
  112. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/pipelines/_generated/types.py +0 -0
  113. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/pipelines/resources.py +0 -0
  114. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/pipelines/transport.py +0 -0
  115. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/py.typed +0 -0
  116. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/resources.py +0 -0
  117. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/rest.py +0 -0
  118. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/src/tamarind/uploads.py +0 -0
  119. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/tests/test_agent_contract.py +0 -0
  120. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/tests/test_attribution.py +0 -0
  121. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/tests/test_batch_prevalidate.py +0 -0
  122. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/tests/test_bugbash.py +0 -0
  123. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/tests/test_cli_commands.py +0 -0
  124. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/tests/test_config.py +0 -0
  125. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/tests/test_custom_tools_cli.py +0 -0
  126. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/tests/test_custom_tools_generation.py +0 -0
  127. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/tests/test_custom_tools_packaging.py +0 -0
  128. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/tests/test_custom_tools_sdk.py +0 -0
  129. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/tests/test_errors.py +0 -0
  130. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/tests/test_file_filters.py +0 -0
  131. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/tests/test_inputs.py +0 -0
  132. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/tests/test_jobs.py +0 -0
  133. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/tests/test_output.py +0 -0
  134. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/tests/test_pep561.py +0 -0
  135. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/tests/test_pipelines_sdk.py +0 -0
  136. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/tests/test_rest.py +0 -0
  137. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/tests/test_sdk_resources.py +0 -0
  138. {tamarind_cli-0.5.0 → tamarind_cli-0.5.1}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: tamarind-cli
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: Command-line interface AND Python SDK for the Tamarind Bio platform — submit, monitor, and download protein/molecule jobs from your terminal, scripts, or an AI agent.
5
5
  Project-URL: Homepage, https://tamarind.bio
6
6
  Project-URL: Documentation, https://app.tamarind.bio/api-docs
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tamarind-cli"
3
- version = "0.5.0"
3
+ version = "0.5.1"
4
4
  description = "Command-line interface AND Python SDK for the Tamarind Bio platform — submit, monitor, and download protein/molecule jobs from your terminal, scripts, or an AI agent."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -0,0 +1,160 @@
1
+ """Discovery / catalog client.
2
+
3
+ The tool catalog and per-tool schemas are gated by per-org visibility logic
4
+ that runs server-side, so the CLI consumes them over HTTP from the catalog
5
+ service (the ``/catalog/*`` routes) rather than reading the database directly.
6
+
7
+ These routes return exactly the JSON the MCP's discovery tools return
8
+ (``getAvailableTools``, ``listModalities``, ``listTags``, ``getJobSchema``),
9
+ because both are served by the same shared implementation. So whatever a tool
10
+ looks like in the MCP, it looks identical here.
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ from typing import Any
16
+
17
+ from .http import HTTPClient
18
+
19
+ CATALOG_PREFIX = "catalog"
20
+
21
+
22
+ def list_tools(
23
+ client: HTTPClient,
24
+ *,
25
+ modality: str | None = None,
26
+ function: str | None = None,
27
+ search: str | None = None,
28
+ custom: bool | None = None,
29
+ ) -> dict:
30
+ """GET /catalog/tools — the filtered tool catalog (mirrors getAvailableTools)."""
31
+ params = {
32
+ "modality": modality,
33
+ "function": function,
34
+ "search": search,
35
+ "custom": "true" if custom else None,
36
+ }
37
+ return client.get_json(f"{CATALOG_PREFIX}/tools", params=params)
38
+
39
+
40
+ def list_modalities(client: HTTPClient) -> dict:
41
+ """GET /catalog/modalities — molecule types you can filter by."""
42
+ return client.get_json(f"{CATALOG_PREFIX}/modalities")
43
+
44
+
45
+ def list_functions(client: HTTPClient) -> dict:
46
+ """GET /catalog/functions — functions (tags) you can filter by."""
47
+ return client.get_json(f"{CATALOG_PREFIX}/functions")
48
+
49
+
50
+ def get_schema(client: HTTPClient, job_type: str) -> dict:
51
+ """GET /catalog/tools/{jobType}/schema — full parameter schema + example job."""
52
+ return client.get_json(f"{CATALOG_PREFIX}/tools/{job_type}/schema")
53
+
54
+
55
+ # -- helpers for rendering / example extraction ---------------------------
56
+
57
+
58
+ def _conditional_true(conditionals: list[dict], values: dict[str, Any]) -> bool:
59
+ """Is a parameter's conditional gate satisfied by ``values``?
60
+
61
+ A direct port of `conditionalTrue` in the website's src/shared_utils.js, which is what
62
+ /submit-job enforces (via `inactiveSpecifiedFieldError`). The list is AND-ed, and a
63
+ controller missing from ``values`` fails the gate — same as there. Kept in step with
64
+ that function: a checkType it grows and we don't just means we prune nothing extra,
65
+ which is the safe direction (the server still rejects it) but is worth syncing.
66
+ """
67
+ for cond in conditionals:
68
+ other = cond.get("otherSettingName")
69
+ if other not in values:
70
+ return False
71
+ actual, expected = values[other], cond.get("otherSettingValue")
72
+ check = cond.get("checkType")
73
+ if check == "equals":
74
+ if actual != expected:
75
+ return False
76
+ elif check == "not-equals":
77
+ if actual == expected:
78
+ return False
79
+ elif check == "includes":
80
+ # An array `otherSettingValue` means "scalar is one of [...]"; otherwise the
81
+ # controller is a multiselect that must contain the value.
82
+ if isinstance(expected, list):
83
+ if actual not in expected:
84
+ return False
85
+ elif isinstance(actual, list) and expected not in actual:
86
+ return False
87
+ elif check == "greaterThan":
88
+ if not _as_float(actual) > _as_float(expected):
89
+ return False
90
+ elif check == "lessThan":
91
+ if not _as_float(actual) < _as_float(expected):
92
+ return False
93
+ elif check == "exists":
94
+ if not actual and actual != 0:
95
+ return False
96
+ elif check == "notEmpty":
97
+ if isinstance(actual, (list, str)):
98
+ if len(actual) == 0:
99
+ return False
100
+ else:
101
+ return False
102
+ # An unrecognized checkType is skipped, as the JS `default:` branch does.
103
+ return True
104
+
105
+
106
+ def _as_float(value: Any) -> float:
107
+ """JS `parseFloat` semantics: unparseable compares false, never raises."""
108
+ try:
109
+ return float(value)
110
+ except (TypeError, ValueError):
111
+ return float("nan")
112
+
113
+
114
+ def example_settings(schema: dict[str, Any]) -> dict[str, Any]:
115
+ """Pull a *submittable* ``settings`` dict out of a schema's exampleJob, if present.
116
+
117
+ The catalog builds `exampleJob.settings` by collecting every parameter's `example`,
118
+ including ones gated behind a `conditionals` controller it does not also set. Submitting
119
+ that verbatim is rejected — boltz's example carries `ligands`, `dna` and `rna` without
120
+ `addLigands`/`addDNA`/`addRNA`, and /submit-job answers `boltz field "ligands" can only
121
+ be set when addLigands equals true`. So drop the fields whose gate is not satisfied,
122
+ leaving an example that actually submits.
123
+
124
+ Gates are evaluated against the example merged over the schema's defaults, because the
125
+ server validates post-autofill settings: a field gated on `useMSA: true` is legitimately
126
+ active when `useMSA` defaults to true and nobody overrode it. Pruning repeats to a fixed
127
+ point, since a dropped field can itself be another field's controller (boltz
128
+ `version` -> `predictAffinity` -> `binderChain`).
129
+ """
130
+ example = schema.get("exampleJob") or {}
131
+ settings = dict(example.get("settings") or {})
132
+ if not settings:
133
+ return settings
134
+
135
+ params = [p for p in schema.get("parameters", []) if p.get("name")]
136
+ gated = {p["name"]: p["conditionals"] for p in params if p.get("conditionals")}
137
+ if not gated:
138
+ return settings
139
+ defaults = {p["name"]: p["default"] for p in params if "default" in p}
140
+
141
+ while True:
142
+ values = {**defaults, **settings}
143
+ dropped = [
144
+ name
145
+ for name in settings
146
+ if name in gated and not _conditional_true(gated[name], values)
147
+ ]
148
+ if not dropped:
149
+ return settings
150
+ for name in dropped:
151
+ del settings[name]
152
+
153
+
154
+ def required_param_names(schema: dict[str, Any]) -> list[str]:
155
+ """Names of parameters marked required (top-level; ignores task-gated ones)."""
156
+ out = []
157
+ for p in schema.get("parameters", []):
158
+ if p.get("required") and p.get("name"):
159
+ out.append(p["name"])
160
+ return out
@@ -0,0 +1,110 @@
1
+ """`example_settings` must return an example the API will actually accept.
2
+
3
+ The catalog builds `exampleJob.settings` from every parameter's `example`, including ones
4
+ gated behind a `conditionals` controller it does not also set — so the raw blob is rejected
5
+ by /submit-job. These cover the pruning that makes it submittable, against the real boltz
6
+ shape that first surfaced it (the /api-docs/sdk quickstart submitted this verbatim and 400'd
7
+ with `boltz field "ligands" can only be set when addLigands equals true`).
8
+ """
9
+
10
+ from tamarind import catalog
11
+
12
+
13
+ def _schema(parameters, settings):
14
+ return {"parameters": parameters, "exampleJob": {"settings": settings}}
15
+
16
+
17
+ def test_drops_field_whose_controller_is_absent():
18
+ schema = _schema(
19
+ [
20
+ {"name": "sequence"},
21
+ {"name": "addLigands", "default": False},
22
+ {
23
+ "name": "ligands",
24
+ "conditionals": [
25
+ {"checkType": "equals", "otherSettingName": "addLigands", "otherSettingValue": True}
26
+ ],
27
+ },
28
+ ],
29
+ {"sequence": "MKT", "ligands": ["SAH"]},
30
+ )
31
+ assert catalog.example_settings(schema) == {"sequence": "MKT"}
32
+
33
+
34
+ def test_keeps_field_whose_gate_a_default_satisfies():
35
+ # useMSA defaults to true, so msaDatabase is legitimately active even though the
36
+ # example never mentions useMSA. The server validates post-autofill settings too.
37
+ schema = _schema(
38
+ [
39
+ {"name": "useMSA", "default": True},
40
+ {
41
+ "name": "msaDatabase",
42
+ "conditionals": [
43
+ {"checkType": "equals", "otherSettingName": "useMSA", "otherSettingValue": True}
44
+ ],
45
+ },
46
+ ],
47
+ {"msaDatabase": "uniref"},
48
+ )
49
+ assert catalog.example_settings(schema) == {"msaDatabase": "uniref"}
50
+
51
+
52
+ def test_prunes_transitively_to_a_fixed_point():
53
+ # boltz's real chain: version -> predictAffinity -> binderChain. Dropping predictAffinity
54
+ # must also drop binderChain, which a single pass would leave behind.
55
+ schema = _schema(
56
+ [
57
+ {"name": "version", "default": "2.1.0"},
58
+ {
59
+ "name": "predictAffinity",
60
+ "conditionals": [
61
+ {"checkType": "equals", "otherSettingName": "version", "otherSettingValue": "2.2.1"}
62
+ ],
63
+ },
64
+ {
65
+ "name": "binderChain",
66
+ "conditionals": [
67
+ {"checkType": "equals", "otherSettingName": "predictAffinity", "otherSettingValue": True}
68
+ ],
69
+ },
70
+ ],
71
+ {"predictAffinity": True, "binderChain": "C"},
72
+ )
73
+ assert catalog.example_settings(schema) == {}
74
+
75
+
76
+ def test_supports_the_other_check_types_the_catalog_uses():
77
+ # not-equals and notEmpty both appear in live schemas (proteinmpnn/rfdiffusion
78
+ # verifyTopK, boltzgen scaffoldSubType).
79
+ schema = _schema(
80
+ [
81
+ {"name": "verify", "default": ""},
82
+ {
83
+ "name": "verifyTopK",
84
+ "conditionals": [
85
+ {"checkType": "notEmpty", "otherSettingName": "verify"},
86
+ {"checkType": "not-equals", "otherSettingName": "verify", "otherSettingValue": "none"},
87
+ ],
88
+ },
89
+ ],
90
+ {"verifyTopK": 5},
91
+ )
92
+ assert catalog.example_settings(schema) == {}
93
+
94
+ schema["exampleJob"]["settings"] = {"verify": "alphafold", "verifyTopK": 5}
95
+ assert catalog.example_settings(schema) == {"verify": "alphafold", "verifyTopK": 5}
96
+
97
+
98
+ def test_unknown_check_type_is_not_a_reason_to_prune():
99
+ # Matches the JS `default:` branch: an unrecognized checkType is skipped, so we keep the
100
+ # field and let the server decide rather than silently dropping a valid one.
101
+ schema = _schema(
102
+ [{"name": "x", "conditionals": [{"checkType": "someNewThing", "otherSettingName": "y"}]}, {"name": "y"}],
103
+ {"x": 1, "y": 2},
104
+ )
105
+ assert catalog.example_settings(schema) == {"x": 1, "y": 2}
106
+
107
+
108
+ def test_ungated_and_empty_examples_pass_through():
109
+ assert catalog.example_settings({"parameters": [{"name": "a"}], "exampleJob": {"settings": {"a": 1}}}) == {"a": 1}
110
+ assert catalog.example_settings({}) == {}
@@ -1,70 +0,0 @@
1
- """Discovery / catalog client.
2
-
3
- The tool catalog and per-tool schemas are gated by per-org visibility logic
4
- that runs server-side, so the CLI consumes them over HTTP from the catalog
5
- service (the ``/catalog/*`` routes) rather than reading the database directly.
6
-
7
- These routes return exactly the JSON the MCP's discovery tools return
8
- (``getAvailableTools``, ``listModalities``, ``listTags``, ``getJobSchema``),
9
- because both are served by the same shared implementation. So whatever a tool
10
- looks like in the MCP, it looks identical here.
11
- """
12
-
13
- from __future__ import annotations
14
-
15
- from typing import Any
16
-
17
- from .http import HTTPClient
18
-
19
- CATALOG_PREFIX = "catalog"
20
-
21
-
22
- def list_tools(
23
- client: HTTPClient,
24
- *,
25
- modality: str | None = None,
26
- function: str | None = None,
27
- search: str | None = None,
28
- custom: bool | None = None,
29
- ) -> dict:
30
- """GET /catalog/tools — the filtered tool catalog (mirrors getAvailableTools)."""
31
- params = {
32
- "modality": modality,
33
- "function": function,
34
- "search": search,
35
- "custom": "true" if custom else None,
36
- }
37
- return client.get_json(f"{CATALOG_PREFIX}/tools", params=params)
38
-
39
-
40
- def list_modalities(client: HTTPClient) -> dict:
41
- """GET /catalog/modalities — molecule types you can filter by."""
42
- return client.get_json(f"{CATALOG_PREFIX}/modalities")
43
-
44
-
45
- def list_functions(client: HTTPClient) -> dict:
46
- """GET /catalog/functions — functions (tags) you can filter by."""
47
- return client.get_json(f"{CATALOG_PREFIX}/functions")
48
-
49
-
50
- def get_schema(client: HTTPClient, job_type: str) -> dict:
51
- """GET /catalog/tools/{jobType}/schema — full parameter schema + example job."""
52
- return client.get_json(f"{CATALOG_PREFIX}/tools/{job_type}/schema")
53
-
54
-
55
- # -- helpers for rendering / example extraction ---------------------------
56
-
57
-
58
- def example_settings(schema: dict[str, Any]) -> dict[str, Any]:
59
- """Pull a runnable ``settings`` dict out of a schema's exampleJob, if present."""
60
- example = schema.get("exampleJob") or {}
61
- return dict(example.get("settings") or {})
62
-
63
-
64
- def required_param_names(schema: dict[str, Any]) -> list[str]:
65
- """Names of parameters marked required (top-level; ignores task-gated ones)."""
66
- out = []
67
- for p in schema.get("parameters", []):
68
- if p.get("required") and p.get("name"):
69
- out.append(p["name"])
70
- return out
File without changes
File without changes
File without changes
File without changes
File without changes