prisma-api 0.3.2__tar.gz → 0.3.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: prisma_api
3
- Version: 0.3.2
3
+ Version: 0.3.4
4
4
  Summary: A package for interacting with PrISMa Platform APIs. PrISMa is a holistic system for numerical synthesis and assessment of Metal-Organic Frameworks and their applications, for Direct Air Capture of CO2. For more information, see: https://prisma.hw.ac.uk.
5
5
  Author-email: RCCS-CaptureTeam <team@prisma-platform.org>
6
6
  License: GNUv3
@@ -1,4 +1,4 @@
1
- __version__ = "0.3.2"
1
+ __version__ = "0.3.4"
2
2
 
3
3
 
4
4
  from prisma_api.prisma_api import prisma_api as init # Main prisma_api class for initialisation
@@ -132,6 +132,14 @@ class PrismaAPIv2:
132
132
  """
133
133
  return self._get(f"/flowsheets/{name}/")
134
134
 
135
+ def get_flowsheet_bundle(self, name: str = "dac_min") -> dict:
136
+ """
137
+ GET /api/v2/flowsheets/{name}/bundle/
138
+
139
+ Returns the bundled flowsheet payload for the named object.
140
+ """
141
+ return self._get(f"/flowsheets/{name}/bundle/")
142
+
135
143
  # ── Catalog ───────────────────────────────────────────────────────────────
136
144
 
137
145
  def list_materials(self, name: str | None = None,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: prisma_api
3
- Version: 0.3.2
3
+ Version: 0.3.4
4
4
  Summary: A package for interacting with PrISMa Platform APIs. PrISMa is a holistic system for numerical synthesis and assessment of Metal-Organic Frameworks and their applications, for Direct Air Capture of CO2. For more information, see: https://prisma.hw.ac.uk.
5
5
  Author-email: RCCS-CaptureTeam <team@prisma-platform.org>
6
6
  License: GNUv3
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "prisma_api"
7
- version = "0.3.2"
7
+ version = "0.3.4"
8
8
  description = "A package for interacting with PrISMa Platform APIs. PrISMa is a holistic system for numerical synthesis and assessment of Metal-Organic Frameworks and their applications, for Direct Air Capture of CO2. For more information, see: https://prisma.hw.ac.uk."
9
9
  authors = [
10
10
  {name = "RCCS-CaptureTeam", email = "team@prisma-platform.org"}
@@ -10,6 +10,7 @@ live network access is required. Run with:
10
10
  from __future__ import annotations
11
11
 
12
12
  import json
13
+ import os
13
14
  import pytest
14
15
  import responses as resp_lib
15
16
  from responses import matchers
@@ -1423,6 +1424,10 @@ def test_api_key_header_sent(api):
1423
1424
  # ── Flowsheets ────────────────────────────────────────────────────────────────
1424
1425
 
1425
1426
  @resp_lib.activate
1427
+ @pytest.mark.skipif(
1428
+ os.getenv("CI", "").lower() == "true",
1429
+ reason="Offline development fixture test is disabled in CI",
1430
+ )
1426
1431
  def test_get_flowsheet_matches_reference_fixture(api):
1427
1432
  fixture_path = "reference_data/01-prisma-v2--flowsheets/dac_min_db.json"
1428
1433
  with open(fixture_path, "r", encoding="utf-8") as f:
@@ -1430,7 +1435,7 @@ def test_get_flowsheet_matches_reference_fixture(api):
1430
1435
 
1431
1436
  resp_lib.add(resp_lib.GET, f"{PROD_BASE}/flowsheets/dac_min/",
1432
1437
  json=expected, status=200)
1433
- result = api.get_flowsheet(name="dac_min")
1438
+ result = api.get_flowsheet()
1434
1439
  assert result == expected
1435
1440
 
1436
1441
 
@@ -1438,5 +1443,38 @@ def test_get_flowsheet_matches_reference_fixture(api):
1438
1443
  def test_get_flowsheet_uses_dev_mode_base_url(dev_api):
1439
1444
  resp_lib.add(resp_lib.GET, f"{dev_api._base_url()}/flowsheets/dac_min/",
1440
1445
  json={"template_id": "dac_min"}, status=200)
1441
- result = dev_api.get_flowsheet(name="dac_min")
1446
+ result = dev_api.get_flowsheet()
1442
1447
  assert result["template_id"] == "dac_min"
1448
+
1449
+
1450
+ @resp_lib.activate
1451
+ def test_get_flowsheet_custom_name_routes_path(api):
1452
+ resp_lib.add(resp_lib.GET, f"{PROD_BASE}/flowsheets/custom_case/",
1453
+ json={"template_id": "custom_case"}, status=200)
1454
+ result = api.get_flowsheet(name="custom_case")
1455
+ assert result["template_id"] == "custom_case"
1456
+
1457
+
1458
+ @resp_lib.activate
1459
+ def test_get_flowsheet_bundle_returns_dict(api):
1460
+ expected = {"template_id": "dac_min", "bundle": {"nodes": [], "edges": []}}
1461
+ resp_lib.add(resp_lib.GET, f"{PROD_BASE}/flowsheets/dac_min/bundle/",
1462
+ json=expected, status=200)
1463
+ result = api.get_flowsheet_bundle()
1464
+ assert result == expected
1465
+
1466
+
1467
+ @resp_lib.activate
1468
+ def test_get_flowsheet_bundle_uses_dev_mode_base_url(dev_api):
1469
+ resp_lib.add(resp_lib.GET, f"{dev_api._base_url()}/flowsheets/dac_min/bundle/",
1470
+ json={"template_id": "dac_min"}, status=200)
1471
+ result = dev_api.get_flowsheet_bundle()
1472
+ assert result["template_id"] == "dac_min"
1473
+
1474
+
1475
+ @resp_lib.activate
1476
+ def test_get_flowsheet_bundle_custom_name_routes_path(api):
1477
+ resp_lib.add(resp_lib.GET, f"{PROD_BASE}/flowsheets/custom_case/bundle/",
1478
+ json={"template_id": "custom_case"}, status=200)
1479
+ result = api.get_flowsheet_bundle(name="custom_case")
1480
+ assert result["template_id"] == "custom_case"
File without changes
File without changes
File without changes