synergyplus 0.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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SynergyPlus contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,100 @@
1
+ Metadata-Version: 2.4
2
+ Name: synergyplus
3
+ Version: 0.2.0
4
+ Summary: Python client for the SynergyPlus distributed EnergyPlus runner.
5
+ Author-email: SynergyPlus contributors <tanryan777@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/City-Syntax/SynergyPlus
8
+ Project-URL: Repository, https://github.com/City-Syntax/SynergyPlus
9
+ Project-URL: Issues, https://github.com/City-Syntax/SynergyPlus/issues
10
+ Keywords: energyplus,simulation,building-energy,sdk,client
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Topic :: Scientific/Engineering
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Requires-Python: >=3.9
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: requests>=2.31
22
+ Provides-Extra: s3
23
+ Requires-Dist: boto3>=1.34; extra == "s3"
24
+ Dynamic: license-file
25
+
26
+ # SynergyPlus Python SDK
27
+
28
+ `synergyplus` is the official Python client for the [SynergyPlus](https://github.com/City-Syntax/SynergyPlus)
29
+ distributed EnergyPlus runner. It wraps the apiserver's HTTP API for submitting
30
+ simulations and parametric batches, polling their state, and fetching results.
31
+
32
+ ## Install
33
+
34
+ ```bash
35
+ pip install synergyplus
36
+
37
+ # Optional: enable SynergyClient.upload_input() for pushing local model/weather
38
+ # files to S3-compatible storage (MinIO, AWS S3, ...).
39
+ pip install "synergyplus[s3]"
40
+ ```
41
+
42
+ Requires Python 3.9+.
43
+
44
+ ## Quickstart
45
+
46
+ ```python
47
+ from synergyplus import SynergyClient, ArtifactRef
48
+
49
+ sp = SynergyClient("http://localhost:8090", token="synergy-dev-key")
50
+
51
+ sim = sp.submit_simulation(
52
+ engine_version="24.1.0",
53
+ model=ArtifactRef("s3://models/sample/baseline.idf"),
54
+ weather=ArtifactRef("s3://weather/sample/chicago.epw"),
55
+ )
56
+
57
+ sp.wait(sim["id"])
58
+ print(sp.get_results(sim["id"]))
59
+ ```
60
+
61
+ ## API
62
+
63
+ ### `SynergyClient(base_url, token=None, timeout=30.0)`
64
+
65
+ | Method | Description |
66
+ | --- | --- |
67
+ | `healthz()` | `GET /healthz` — returns `True` if the apiserver is up. |
68
+ | `submit_simulation(*, engine_version, model, weather, priority=None, extraction_spec=None)` | `POST /v1/simulations` → `{id, state}`. |
69
+ | `get_simulation(sim_id)` | `GET /v1/simulations/{id}` → `{id, state, verdict?, result?}`. |
70
+ | `get_results(sim_id)` | `GET /v1/results/{simId}` → `{verdict, metrics, artifactUri}`. |
71
+ | `wait(sim_id, *, poll=2.0, deadline=None)` | Block until the simulation reaches a terminal state (`succeeded`/`failed`). |
72
+ | `submit_batch(*, engine_version, weather, variants, priority=None, max_parallelism=None, idempotency_key=None)` | `POST /v1/batches` → `{batchId, state}`. |
73
+ | `get_batch(batch_id)` | `GET /v1/batches/{id}` → `{id, state, total, succeeded, failed}`. |
74
+ | `list_batch_simulations(batch_id, *, limit=100, offset=0)` | `GET /v1/batches/{id}/simulations` → `{items, total}`. |
75
+ | `upload_input(local_path, ref, *, s3_endpoint=None, s3_region="us-east-1", s3_access_key=None, s3_secret_key=None)` | Upload a local file to an `s3://` ref and return an `ArtifactRef` with its sha256. Requires the `s3` extra. |
76
+
77
+ `model`/`weather` accept either an `s3://...` string or an `ArtifactRef`.
78
+
79
+ ### Batch example
80
+
81
+ ```python
82
+ from synergyplus import SynergyClient, ArtifactRef, Variant
83
+
84
+ sp = SynergyClient("http://localhost:8090", token="synergy-dev-key")
85
+
86
+ batch = sp.submit_batch(
87
+ engine_version="24.1.0",
88
+ weather=ArtifactRef("s3://weather/sample/chicago.epw"),
89
+ variants=[
90
+ Variant(model=ArtifactRef("s3://models/a.idf")),
91
+ Variant(model=ArtifactRef("s3://models/b.idf")),
92
+ ],
93
+ max_parallelism=8,
94
+ )
95
+ print(batch["batchId"])
96
+ ```
97
+
98
+ ## License
99
+
100
+ MIT — see [LICENSE](./LICENSE).
@@ -0,0 +1,75 @@
1
+ # SynergyPlus Python SDK
2
+
3
+ `synergyplus` is the official Python client for the [SynergyPlus](https://github.com/City-Syntax/SynergyPlus)
4
+ distributed EnergyPlus runner. It wraps the apiserver's HTTP API for submitting
5
+ simulations and parametric batches, polling their state, and fetching results.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install synergyplus
11
+
12
+ # Optional: enable SynergyClient.upload_input() for pushing local model/weather
13
+ # files to S3-compatible storage (MinIO, AWS S3, ...).
14
+ pip install "synergyplus[s3]"
15
+ ```
16
+
17
+ Requires Python 3.9+.
18
+
19
+ ## Quickstart
20
+
21
+ ```python
22
+ from synergyplus import SynergyClient, ArtifactRef
23
+
24
+ sp = SynergyClient("http://localhost:8090", token="synergy-dev-key")
25
+
26
+ sim = sp.submit_simulation(
27
+ engine_version="24.1.0",
28
+ model=ArtifactRef("s3://models/sample/baseline.idf"),
29
+ weather=ArtifactRef("s3://weather/sample/chicago.epw"),
30
+ )
31
+
32
+ sp.wait(sim["id"])
33
+ print(sp.get_results(sim["id"]))
34
+ ```
35
+
36
+ ## API
37
+
38
+ ### `SynergyClient(base_url, token=None, timeout=30.0)`
39
+
40
+ | Method | Description |
41
+ | --- | --- |
42
+ | `healthz()` | `GET /healthz` — returns `True` if the apiserver is up. |
43
+ | `submit_simulation(*, engine_version, model, weather, priority=None, extraction_spec=None)` | `POST /v1/simulations` → `{id, state}`. |
44
+ | `get_simulation(sim_id)` | `GET /v1/simulations/{id}` → `{id, state, verdict?, result?}`. |
45
+ | `get_results(sim_id)` | `GET /v1/results/{simId}` → `{verdict, metrics, artifactUri}`. |
46
+ | `wait(sim_id, *, poll=2.0, deadline=None)` | Block until the simulation reaches a terminal state (`succeeded`/`failed`). |
47
+ | `submit_batch(*, engine_version, weather, variants, priority=None, max_parallelism=None, idempotency_key=None)` | `POST /v1/batches` → `{batchId, state}`. |
48
+ | `get_batch(batch_id)` | `GET /v1/batches/{id}` → `{id, state, total, succeeded, failed}`. |
49
+ | `list_batch_simulations(batch_id, *, limit=100, offset=0)` | `GET /v1/batches/{id}/simulations` → `{items, total}`. |
50
+ | `upload_input(local_path, ref, *, s3_endpoint=None, s3_region="us-east-1", s3_access_key=None, s3_secret_key=None)` | Upload a local file to an `s3://` ref and return an `ArtifactRef` with its sha256. Requires the `s3` extra. |
51
+
52
+ `model`/`weather` accept either an `s3://...` string or an `ArtifactRef`.
53
+
54
+ ### Batch example
55
+
56
+ ```python
57
+ from synergyplus import SynergyClient, ArtifactRef, Variant
58
+
59
+ sp = SynergyClient("http://localhost:8090", token="synergy-dev-key")
60
+
61
+ batch = sp.submit_batch(
62
+ engine_version="24.1.0",
63
+ weather=ArtifactRef("s3://weather/sample/chicago.epw"),
64
+ variants=[
65
+ Variant(model=ArtifactRef("s3://models/a.idf")),
66
+ Variant(model=ArtifactRef("s3://models/b.idf")),
67
+ ],
68
+ max_parallelism=8,
69
+ )
70
+ print(batch["batchId"])
71
+ ```
72
+
73
+ ## License
74
+
75
+ MIT — see [LICENSE](./LICENSE).
@@ -0,0 +1,40 @@
1
+ [project]
2
+ name = "synergyplus"
3
+ version = "0.2.0"
4
+ description = "Python client for the SynergyPlus distributed EnergyPlus runner."
5
+ readme = "README.md"
6
+ requires-python = ">=3.9"
7
+ license = "MIT"
8
+ license-files = ["LICENSE"]
9
+ authors = [
10
+ { name = "SynergyPlus contributors", email = "tanryan777@gmail.com" },
11
+ ]
12
+ keywords = ["energyplus", "simulation", "building-energy", "sdk", "client"]
13
+ classifiers = [
14
+ "Development Status :: 4 - Beta",
15
+ "Intended Audience :: Developers",
16
+ "Intended Audience :: Science/Research",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3 :: Only",
19
+ "Topic :: Scientific/Engineering",
20
+ "Topic :: Software Development :: Libraries :: Python Modules",
21
+ ]
22
+ dependencies = [
23
+ "requests>=2.31",
24
+ ]
25
+
26
+ [project.optional-dependencies]
27
+ # Needed only for SynergyClient.upload_input (imported lazily otherwise).
28
+ s3 = ["boto3>=1.34"]
29
+
30
+ [project.urls]
31
+ Homepage = "https://github.com/City-Syntax/SynergyPlus"
32
+ Repository = "https://github.com/City-Syntax/SynergyPlus"
33
+ Issues = "https://github.com/City-Syntax/SynergyPlus/issues"
34
+
35
+ [build-system]
36
+ requires = ["setuptools>=77"]
37
+ build-backend = "setuptools.build_meta"
38
+
39
+ [tool.setuptools]
40
+ packages = ["synergyplus"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,19 @@
1
+ """SynergyPlus Python SDK (CONTRACT §3).
2
+
3
+ from synergyplus import SynergyClient, ArtifactRef
4
+
5
+ sp = SynergyClient("http://localhost:8090", token="synergy-dev-key")
6
+ sim = sp.submit_simulation(
7
+ engine_version="24.1.0",
8
+ model=ArtifactRef("s3://models/sample/baseline.idf"),
9
+ weather=ArtifactRef("s3://weather/sample/chicago.epw"),
10
+ )
11
+ sp.wait(sim["id"])
12
+ print(sp.get_results(sim["id"]))
13
+ """
14
+
15
+ from .client import SynergyClient
16
+ from .models import ArtifactRef, Variant, sha256_file
17
+
18
+ __all__ = ["SynergyClient", "ArtifactRef", "Variant", "sha256_file"]
19
+ __version__ = "0.2.0"
@@ -0,0 +1,179 @@
1
+ """HTTP client for the SynergyPlus apiserver (CONTRACT §3).
2
+
3
+ from synergyplus import SynergyClient, ArtifactRef
4
+
5
+ sp = SynergyClient("http://localhost:8090", token="synergy-dev-key")
6
+ sim = sp.submit_simulation(
7
+ engine_version="24.1.0",
8
+ model=ArtifactRef("s3://models/sample/baseline.idf"),
9
+ weather=ArtifactRef("s3://weather/sample/chicago.epw"),
10
+ )
11
+ sp.wait(sim["id"])
12
+ print(sp.get_results(sim["id"]))
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ import time
18
+ from typing import Optional, Sequence, Union
19
+ from urllib.parse import urlparse
20
+
21
+ import requests
22
+
23
+ from .models import ArtifactRef, Variant, as_ref, sha256_file
24
+
25
+ _TERMINAL = {"succeeded", "failed"}
26
+
27
+
28
+ class SynergyClient:
29
+ def __init__(self, base_url: str, token: Optional[str] = None, timeout: float = 30.0):
30
+ self.base_url = base_url.rstrip("/")
31
+ self.timeout = timeout
32
+ self._session = requests.Session()
33
+ if token:
34
+ self._session.headers["Authorization"] = f"Bearer {token}"
35
+
36
+ # -- health ----------------------------------------------------------------
37
+
38
+ def healthz(self) -> bool:
39
+ resp = self._session.get(f"{self.base_url}/healthz", timeout=self.timeout)
40
+ return resp.ok
41
+
42
+ # -- simulations -----------------------------------------------------------
43
+
44
+ def submit_simulation(
45
+ self,
46
+ *,
47
+ engine_version: str,
48
+ model: Union[str, ArtifactRef],
49
+ weather: Union[str, ArtifactRef],
50
+ priority: Optional[int] = None,
51
+ extraction_spec: Optional[dict] = None,
52
+ ) -> dict:
53
+ """POST /v1/simulations → ``{id, state}`` (CONTRACT §3)."""
54
+ body: dict = {
55
+ "engineVersion": engine_version,
56
+ "model": as_ref(model),
57
+ "weather": as_ref(weather),
58
+ }
59
+ if priority is not None:
60
+ body["priority"] = priority
61
+ if extraction_spec is not None:
62
+ body["extractionSpec"] = extraction_spec
63
+
64
+ resp = self._session.post(
65
+ f"{self.base_url}/v1/simulations", json=body, timeout=self.timeout
66
+ )
67
+ resp.raise_for_status()
68
+ return resp.json()
69
+
70
+ def get_simulation(self, sim_id: str) -> dict:
71
+ """GET /v1/simulations/{id} → ``{id, state, verdict?, result?}``."""
72
+ resp = self._session.get(
73
+ f"{self.base_url}/v1/simulations/{sim_id}", timeout=self.timeout
74
+ )
75
+ resp.raise_for_status()
76
+ return resp.json()
77
+
78
+ def get_results(self, sim_id: str) -> dict:
79
+ """GET /v1/results/{simId} → ``{verdict, metrics, artifactUri}``."""
80
+ resp = self._session.get(
81
+ f"{self.base_url}/v1/results/{sim_id}", timeout=self.timeout
82
+ )
83
+ resp.raise_for_status()
84
+ return resp.json()
85
+
86
+ def wait(self, sim_id: str, *, poll: float = 2.0, deadline: Optional[float] = None) -> dict:
87
+ """Block until the simulation reaches a terminal state (or the deadline)."""
88
+ start = time.monotonic()
89
+ while True:
90
+ sim = self.get_simulation(sim_id)
91
+ state = (sim.get("state") or "").lower()
92
+ if state in _TERMINAL:
93
+ return sim
94
+ if deadline is not None and time.monotonic() - start > deadline:
95
+ raise TimeoutError(f"simulation {sim_id} still {state!r} after {deadline}s")
96
+ time.sleep(poll)
97
+
98
+ # -- batches ---------------------------------------------------------------
99
+
100
+ def submit_batch(
101
+ self,
102
+ *,
103
+ engine_version: str,
104
+ weather: Union[str, ArtifactRef],
105
+ variants: Sequence[Union[Variant, dict]],
106
+ priority: Optional[int] = None,
107
+ max_parallelism: Optional[int] = None,
108
+ idempotency_key: Optional[str] = None,
109
+ ) -> dict:
110
+ """POST /v1/batches → ``{batchId, state:"expanding"}`` (CONTRACT §3)."""
111
+ body: dict = {
112
+ "engineVersion": engine_version,
113
+ "weather": as_ref(weather),
114
+ "variants": [v.to_dict() if isinstance(v, Variant) else v for v in variants],
115
+ }
116
+ if priority is not None:
117
+ body["priority"] = priority
118
+ if max_parallelism is not None:
119
+ body["maxParallelism"] = max_parallelism
120
+ if idempotency_key is not None:
121
+ body["idempotencyKey"] = idempotency_key
122
+
123
+ resp = self._session.post(
124
+ f"{self.base_url}/v1/batches", json=body, timeout=self.timeout
125
+ )
126
+ resp.raise_for_status()
127
+ return resp.json()
128
+
129
+ def get_batch(self, batch_id: str) -> dict:
130
+ """GET /v1/batches/{id} → ``{id, state, total, succeeded, failed}``."""
131
+ resp = self._session.get(
132
+ f"{self.base_url}/v1/batches/{batch_id}", timeout=self.timeout
133
+ )
134
+ resp.raise_for_status()
135
+ return resp.json()
136
+
137
+ def list_batch_simulations(self, batch_id: str, *, limit: int = 100, offset: int = 0) -> dict:
138
+ """GET /v1/batches/{id}/simulations → ``{items:[...], total}``."""
139
+ resp = self._session.get(
140
+ f"{self.base_url}/v1/batches/{batch_id}/simulations",
141
+ params={"limit": limit, "offset": offset},
142
+ timeout=self.timeout,
143
+ )
144
+ resp.raise_for_status()
145
+ return resp.json()
146
+
147
+ # -- input upload convenience ---------------------------------------------
148
+
149
+ def upload_input(
150
+ self,
151
+ local_path: str,
152
+ ref: str,
153
+ *,
154
+ s3_endpoint: Optional[str] = None,
155
+ s3_region: str = "us-east-1",
156
+ s3_access_key: Optional[str] = None,
157
+ s3_secret_key: Optional[str] = None,
158
+ ) -> ArtifactRef:
159
+ """Upload a local model/weather file to ``ref`` (``s3://bucket/key``) via
160
+ boto3 and return an :class:`ArtifactRef` carrying its sha256.
161
+
162
+ boto3 is imported lazily so the rest of the SDK has no hard dependency.
163
+ """
164
+ import boto3 # lazy
165
+
166
+ parsed = urlparse(ref)
167
+ if parsed.scheme != "s3":
168
+ raise ValueError(f"upload_input requires an s3:// ref, got {ref!r}")
169
+ bucket, key = parsed.netloc, parsed.path.lstrip("/")
170
+
171
+ client = boto3.client(
172
+ "s3",
173
+ endpoint_url=s3_endpoint,
174
+ region_name=s3_region,
175
+ aws_access_key_id=s3_access_key,
176
+ aws_secret_access_key=s3_secret_key,
177
+ )
178
+ client.upload_file(local_path, bucket, key)
179
+ return ArtifactRef(ref=ref, sha256=sha256_file(local_path))
@@ -0,0 +1,60 @@
1
+ """Lightweight request/response models for the SynergyPlus API (CONTRACT §3)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import hashlib
6
+ import os
7
+ from dataclasses import dataclass
8
+ from typing import Optional, Union
9
+
10
+
11
+ @dataclass
12
+ class ArtifactRef:
13
+ """A model or weather blob in object storage (``s3://bucket/key``).
14
+
15
+ ``sha256`` feeds the deterministic content hash (CONTRACT §2.1). If you have
16
+ the local file, use :meth:`from_file` to compute it.
17
+ """
18
+
19
+ ref: str
20
+ sha256: Optional[str] = None
21
+
22
+ def to_dict(self) -> dict:
23
+ d = {"ref": self.ref}
24
+ if self.sha256:
25
+ d["sha256"] = self.sha256
26
+ return d
27
+
28
+ @classmethod
29
+ def from_file(cls, ref: str, local_path: str) -> "ArtifactRef":
30
+ """Build a ref whose sha256 is hashed from a local copy of the object."""
31
+ return cls(ref=ref, sha256=sha256_file(local_path))
32
+
33
+
34
+ def sha256_file(path: str) -> str:
35
+ h = hashlib.sha256()
36
+ with open(path, "rb") as fh:
37
+ for chunk in iter(lambda: fh.read(1024 * 1024), b""):
38
+ h.update(chunk)
39
+ return h.hexdigest()
40
+
41
+
42
+ def as_ref(value: Union[str, ArtifactRef], sha256: Optional[str] = None) -> dict:
43
+ """Accept either a bare ``s3://`` string or an :class:`ArtifactRef`."""
44
+ if isinstance(value, ArtifactRef):
45
+ return value.to_dict()
46
+ return ArtifactRef(ref=value, sha256=sha256).to_dict()
47
+
48
+
49
+ @dataclass
50
+ class Variant:
51
+ """One model variant in a batch submission."""
52
+
53
+ model: Union[str, ArtifactRef]
54
+ name: Optional[str] = None
55
+
56
+ def to_dict(self) -> dict:
57
+ d: dict = {"model": as_ref(self.model)}
58
+ if self.name:
59
+ d["name"] = self.name
60
+ return d
@@ -0,0 +1,100 @@
1
+ Metadata-Version: 2.4
2
+ Name: synergyplus
3
+ Version: 0.2.0
4
+ Summary: Python client for the SynergyPlus distributed EnergyPlus runner.
5
+ Author-email: SynergyPlus contributors <tanryan777@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/City-Syntax/SynergyPlus
8
+ Project-URL: Repository, https://github.com/City-Syntax/SynergyPlus
9
+ Project-URL: Issues, https://github.com/City-Syntax/SynergyPlus/issues
10
+ Keywords: energyplus,simulation,building-energy,sdk,client
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Topic :: Scientific/Engineering
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Requires-Python: >=3.9
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: requests>=2.31
22
+ Provides-Extra: s3
23
+ Requires-Dist: boto3>=1.34; extra == "s3"
24
+ Dynamic: license-file
25
+
26
+ # SynergyPlus Python SDK
27
+
28
+ `synergyplus` is the official Python client for the [SynergyPlus](https://github.com/City-Syntax/SynergyPlus)
29
+ distributed EnergyPlus runner. It wraps the apiserver's HTTP API for submitting
30
+ simulations and parametric batches, polling their state, and fetching results.
31
+
32
+ ## Install
33
+
34
+ ```bash
35
+ pip install synergyplus
36
+
37
+ # Optional: enable SynergyClient.upload_input() for pushing local model/weather
38
+ # files to S3-compatible storage (MinIO, AWS S3, ...).
39
+ pip install "synergyplus[s3]"
40
+ ```
41
+
42
+ Requires Python 3.9+.
43
+
44
+ ## Quickstart
45
+
46
+ ```python
47
+ from synergyplus import SynergyClient, ArtifactRef
48
+
49
+ sp = SynergyClient("http://localhost:8090", token="synergy-dev-key")
50
+
51
+ sim = sp.submit_simulation(
52
+ engine_version="24.1.0",
53
+ model=ArtifactRef("s3://models/sample/baseline.idf"),
54
+ weather=ArtifactRef("s3://weather/sample/chicago.epw"),
55
+ )
56
+
57
+ sp.wait(sim["id"])
58
+ print(sp.get_results(sim["id"]))
59
+ ```
60
+
61
+ ## API
62
+
63
+ ### `SynergyClient(base_url, token=None, timeout=30.0)`
64
+
65
+ | Method | Description |
66
+ | --- | --- |
67
+ | `healthz()` | `GET /healthz` — returns `True` if the apiserver is up. |
68
+ | `submit_simulation(*, engine_version, model, weather, priority=None, extraction_spec=None)` | `POST /v1/simulations` → `{id, state}`. |
69
+ | `get_simulation(sim_id)` | `GET /v1/simulations/{id}` → `{id, state, verdict?, result?}`. |
70
+ | `get_results(sim_id)` | `GET /v1/results/{simId}` → `{verdict, metrics, artifactUri}`. |
71
+ | `wait(sim_id, *, poll=2.0, deadline=None)` | Block until the simulation reaches a terminal state (`succeeded`/`failed`). |
72
+ | `submit_batch(*, engine_version, weather, variants, priority=None, max_parallelism=None, idempotency_key=None)` | `POST /v1/batches` → `{batchId, state}`. |
73
+ | `get_batch(batch_id)` | `GET /v1/batches/{id}` → `{id, state, total, succeeded, failed}`. |
74
+ | `list_batch_simulations(batch_id, *, limit=100, offset=0)` | `GET /v1/batches/{id}/simulations` → `{items, total}`. |
75
+ | `upload_input(local_path, ref, *, s3_endpoint=None, s3_region="us-east-1", s3_access_key=None, s3_secret_key=None)` | Upload a local file to an `s3://` ref and return an `ArtifactRef` with its sha256. Requires the `s3` extra. |
76
+
77
+ `model`/`weather` accept either an `s3://...` string or an `ArtifactRef`.
78
+
79
+ ### Batch example
80
+
81
+ ```python
82
+ from synergyplus import SynergyClient, ArtifactRef, Variant
83
+
84
+ sp = SynergyClient("http://localhost:8090", token="synergy-dev-key")
85
+
86
+ batch = sp.submit_batch(
87
+ engine_version="24.1.0",
88
+ weather=ArtifactRef("s3://weather/sample/chicago.epw"),
89
+ variants=[
90
+ Variant(model=ArtifactRef("s3://models/a.idf")),
91
+ Variant(model=ArtifactRef("s3://models/b.idf")),
92
+ ],
93
+ max_parallelism=8,
94
+ )
95
+ print(batch["batchId"])
96
+ ```
97
+
98
+ ## License
99
+
100
+ MIT — see [LICENSE](./LICENSE).
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ synergyplus/__init__.py
5
+ synergyplus/client.py
6
+ synergyplus/models.py
7
+ synergyplus.egg-info/PKG-INFO
8
+ synergyplus.egg-info/SOURCES.txt
9
+ synergyplus.egg-info/dependency_links.txt
10
+ synergyplus.egg-info/requires.txt
11
+ synergyplus.egg-info/top_level.txt
@@ -0,0 +1,4 @@
1
+ requests>=2.31
2
+
3
+ [s3]
4
+ boto3>=1.34
@@ -0,0 +1 @@
1
+ synergyplus