sdcmodeler 4.3.0__tar.gz → 4.3.2__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 (21) hide show
  1. {sdcmodeler-4.3.0 → sdcmodeler-4.3.2}/PKG-INFO +1 -1
  2. {sdcmodeler-4.3.0 → sdcmodeler-4.3.2}/pyproject.toml +1 -1
  3. {sdcmodeler-4.3.0 → sdcmodeler-4.3.2}/src/sdcmodeler/__init__.py +1 -1
  4. {sdcmodeler-4.3.0 → sdcmodeler-4.3.2}/src/sdcmodeler/mcp_server.py +9 -1
  5. {sdcmodeler-4.3.0 → sdcmodeler-4.3.2}/src/sdcmodeler.egg-info/PKG-INFO +1 -1
  6. {sdcmodeler-4.3.0 → sdcmodeler-4.3.2}/tests/test_mcp_server.py +18 -0
  7. {sdcmodeler-4.3.0 → sdcmodeler-4.3.2}/LICENSE +0 -0
  8. {sdcmodeler-4.3.0 → sdcmodeler-4.3.2}/README.md +0 -0
  9. {sdcmodeler-4.3.0 → sdcmodeler-4.3.2}/setup.cfg +0 -0
  10. {sdcmodeler-4.3.0 → sdcmodeler-4.3.2}/src/sdcmodeler/cli.py +0 -0
  11. {sdcmodeler-4.3.0 → sdcmodeler-4.3.2}/src/sdcmodeler/client.py +0 -0
  12. {sdcmodeler-4.3.0 → sdcmodeler-4.3.2}/src/sdcmodeler/pricing.py +0 -0
  13. {sdcmodeler-4.3.0 → sdcmodeler-4.3.2}/src/sdcmodeler.egg-info/SOURCES.txt +0 -0
  14. {sdcmodeler-4.3.0 → sdcmodeler-4.3.2}/src/sdcmodeler.egg-info/dependency_links.txt +0 -0
  15. {sdcmodeler-4.3.0 → sdcmodeler-4.3.2}/src/sdcmodeler.egg-info/entry_points.txt +0 -0
  16. {sdcmodeler-4.3.0 → sdcmodeler-4.3.2}/src/sdcmodeler.egg-info/requires.txt +0 -0
  17. {sdcmodeler-4.3.0 → sdcmodeler-4.3.2}/src/sdcmodeler.egg-info/top_level.txt +0 -0
  18. {sdcmodeler-4.3.0 → sdcmodeler-4.3.2}/tests/test_cli.py +0 -0
  19. {sdcmodeler-4.3.0 → sdcmodeler-4.3.2}/tests/test_client.py +0 -0
  20. {sdcmodeler-4.3.0 → sdcmodeler-4.3.2}/tests/test_pricing.py +0 -0
  21. {sdcmodeler-4.3.0 → sdcmodeler-4.3.2}/tests/test_registry_launch.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sdcmodeler
3
- Version: 4.3.0
3
+ Version: 4.3.2
4
4
  Summary: The modeler's client for SDCStudio: search the catalog, estimate, assemble and publish SDC4 data models, generate applications; a CLI and an MCP server over one client
5
5
  Author: Axius SDC, Inc.
6
6
  License-Expression: Apache-2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "sdcmodeler"
7
- version = "4.3.0"
7
+ version = "4.3.2"
8
8
  description = "The modeler's client for SDCStudio: search the catalog, estimate, assemble and publish SDC4 data models, generate applications; a CLI and an MCP server over one client"
9
9
  license = "Apache-2.0"
10
10
  requires-python = ">=3.10"
@@ -17,7 +17,7 @@ servers: sdcvalidator validates, sdcgovernance governs, sdcreader reads,
17
17
  sdcmodeler models. It also names the concept SDCStudio already has: every user
18
18
  is a Modeler, and the Modeler's projects scope every call.
19
19
  """
20
- __version__ = "4.3.0"
20
+ __version__ = "4.3.2"
21
21
 
22
22
  from sdcmodeler.client import ( # noqa: E402
23
23
  AssemblyRefused,
@@ -265,6 +265,14 @@ def _policy_or_none() -> dict | None:
265
265
  return None
266
266
 
267
267
 
268
+ def _problem_text(problem: Any) -> str:
269
+ """A problem from the server's estimate is ``{path, ct_id?, reason}``; one from the local walk is a string (4.3.1)."""
270
+ if isinstance(problem, dict):
271
+ ct_id = f" ({problem['ct_id']})" if problem.get("ct_id") else ""
272
+ return f"{problem.get('path', '')}{ct_id}: {problem.get('reason', '')}".strip(": ")
273
+ return str(problem)
274
+
275
+
268
276
  def _handle_build_model(args: dict) -> Any:
269
277
  estimate_id = _string(args, "estimate_id", required=True)
270
278
  title = _string(args, "title", required=True)
@@ -277,7 +285,7 @@ def _handle_build_model(args: dict) -> Any:
277
285
  "in this session; run estimate_model, show the person the cost, then build."
278
286
  )
279
287
  if current["problems"]:
280
- raise ValueError("The tree has problems: " + "; ".join(current["problems"]))
288
+ raise ValueError("The tree has problems: " + "; ".join(_problem_text(p) for p in current["problems"]))
281
289
  remaining = None
282
290
  if current.get("source") == "server" and (current.get("key") or {}).get("remaining_credits") is not None:
283
291
  remaining = current["key"]["remaining_credits"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sdcmodeler
3
- Version: 4.3.0
3
+ Version: 4.3.2
4
4
  Summary: The modeler's client for SDCStudio: search the catalog, estimate, assemble and publish SDC4 data models, generate applications; a CLI and an MCP server over one client
5
5
  Author: Axius SDC, Inc.
6
6
  License-Expression: Apache-2.0
@@ -136,3 +136,21 @@ def test_download_package_builds_a_missing_package_first_unless_told_not_to(boun
136
136
  bound.on("POST", "/api/v1/dmgen/dms/m2/generate/", body=built)
137
137
  out, _ = call("download_package", {"ct_id": "m2"})
138
138
  assert out["built_now"] is True and (tmp_path / "dm-m2.zip").exists()
139
+
140
+
141
+ def test_a_problem_the_server_names_is_reported_and_nothing_is_built(bound):
142
+ """4.3.1: the server's estimate names problems as {path, ct_id, reason}; build_model joined them as strings
143
+ and failed with a TypeError, reported as a defect in this server instead of the problem."""
144
+ def server_estimate(request):
145
+ from sdcmodeler.pricing import estimate_tree
146
+ body = json.loads(request.content)
147
+ local = estimate_tree(body["data"], body["title"])
148
+ return {**local, "problems": [{"path": "data.components[0]", "ct_id": "abc123abc123abc123abc123",
149
+ "reason": "Component not found or not published"}],
150
+ "wallet": {"balance_credits": 10000, "can_pay": True}, "key": {"remaining_credits": 700, "within_limit": True}}
151
+ bound.on("POST", "/api/v1/dmgen/assemble/estimate/", body=server_estimate)
152
+ est, _ = call("estimate_model", {"title": "Vitals", "tree": TREE})
153
+ _, err = call("build_model", {"estimate_id": est["estimate_id"], "title": "Vitals", "tree": TREE})
154
+ assert "Component not found or not published" in err and "abc123abc123abc123abc123" in err
155
+ assert "defect" not in err
156
+ assert not any(c.url.path.endswith("/assemble/") for c in bound.calls)
File without changes
File without changes
File without changes
File without changes