hydopt-client 0.2.0__tar.gz → 0.3.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 (23) hide show
  1. {hydopt_client-0.2.0 → hydopt_client-0.3.0}/PKG-INFO +1 -1
  2. {hydopt_client-0.2.0 → hydopt_client-0.3.0}/docker-compose.yml +1 -1
  3. {hydopt_client-0.2.0 → hydopt_client-0.3.0}/src/hydopt_client/client.py +6 -0
  4. {hydopt_client-0.2.0 → hydopt_client-0.3.0}/src/hydopt_client/models.py +13 -0
  5. {hydopt_client-0.2.0 → hydopt_client-0.3.0}/tests/test_client_unit.py +30 -0
  6. {hydopt_client-0.2.0 → hydopt_client-0.3.0}/.github/workflows/release.yml +0 -0
  7. {hydopt_client-0.2.0 → hydopt_client-0.3.0}/.github/workflows/test.yml +0 -0
  8. {hydopt_client-0.2.0 → hydopt_client-0.3.0}/.gitignore +0 -0
  9. {hydopt_client-0.2.0 → hydopt_client-0.3.0}/Makefile +0 -0
  10. {hydopt_client-0.2.0 → hydopt_client-0.3.0}/README.md +0 -0
  11. {hydopt_client-0.2.0 → hydopt_client-0.3.0}/examples/streamlit_app.py +0 -0
  12. {hydopt_client-0.2.0 → hydopt_client-0.3.0}/pyproject.toml +0 -0
  13. {hydopt_client-0.2.0 → hydopt_client-0.3.0}/src/hydopt_client/__init__.py +0 -0
  14. {hydopt_client-0.2.0 → hydopt_client-0.3.0}/src/hydopt_client/auth/__init__.py +0 -0
  15. {hydopt_client-0.2.0 → hydopt_client-0.3.0}/src/hydopt_client/auth/azure.py +0 -0
  16. {hydopt_client-0.2.0 → hydopt_client-0.3.0}/src/hydopt_client/auth/base.py +0 -0
  17. {hydopt_client-0.2.0 → hydopt_client-0.3.0}/src/hydopt_client/auth/iap.py +0 -0
  18. {hydopt_client-0.2.0 → hydopt_client-0.3.0}/src/hydopt_client/auth/service_account.py +0 -0
  19. {hydopt_client-0.2.0 → hydopt_client-0.3.0}/src/hydopt_client/desktop_app_secret.json +0 -0
  20. {hydopt_client-0.2.0 → hydopt_client-0.3.0}/tests/test_api.py +0 -0
  21. {hydopt_client-0.2.0 → hydopt_client-0.3.0}/tests/test_auth.py +0 -0
  22. {hydopt_client-0.2.0 → hydopt_client-0.3.0}/tests/test_azure.py +0 -0
  23. {hydopt_client-0.2.0 → hydopt_client-0.3.0}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: hydopt-client
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: Python client for the HydOpt hydropower optimization API
5
5
  Requires-Python: >=3.13
6
6
  Requires-Dist: google-auth>=2.56.3
@@ -2,7 +2,7 @@ name: hydopt-api
2
2
 
3
3
  services:
4
4
  api:
5
- image: us-central1-docker.pkg.dev/hydopt/hydopt-backend/hydopt-api:20260910T125042-abf20a2
5
+ image: us-central1-docker.pkg.dev/hydopt/hydopt-backend/hydopt-api:20260922T111447-86bcc45
6
6
  ports:
7
7
  - "${PORT:-8083}:8083"
8
8
  environment:
@@ -17,6 +17,7 @@ from hydopt_client.models import (
17
17
  GraphLayers,
18
18
  HydoptRecord,
19
19
  KeyNumbers,
20
+ Link,
20
21
  ObjectStatReport,
21
22
  Order,
22
23
  parse_records,
@@ -264,6 +265,11 @@ class Client:
264
265
  response.raise_for_status()
265
266
  return response.json()["availableDates"]
266
267
 
268
+ def links(self) -> list[Link]:
269
+ response = self._request("GET", "/v1/links")
270
+ response.raise_for_status()
271
+ return [Link.model_validate(item) for item in response.json().get("links") or []]
272
+
267
273
  def catchments(self, asof: str) -> list[CatchmentRecord]:
268
274
  response = self._request("GET", f"/v1/catchments/{asof}")
269
275
  response.raise_for_status()
@@ -45,6 +45,19 @@ def parse_records(items: list[dict]) -> list[HydoptRecord]:
45
45
  return [HydoptRecord.model_validate(item) for item in items]
46
46
 
47
47
 
48
+ class Link(BaseModel):
49
+ model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
50
+
51
+ id: str
52
+ up: str
53
+ down: str
54
+ edge_type: str = ""
55
+ lat_up: float = 0.0
56
+ lon_up: float = 0.0
57
+ lat_down: float = 0.0
58
+ lon_down: float = 0.0
59
+
60
+
48
61
  class CatchmentRecord(BaseModel):
49
62
  model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
50
63
 
@@ -129,6 +129,36 @@ def test_hierarchy_layers_parses_graph_layers() -> None:
129
129
  assert layers.point_ids == ["p1"]
130
130
 
131
131
 
132
+ def test_links_parses_watercourse_edges() -> None:
133
+ def handler(request: httpx.Request) -> httpx.Response:
134
+ assert request.url.path == "/v1/links"
135
+ return httpx.Response(
136
+ 200,
137
+ json={
138
+ "links": [
139
+ {
140
+ "id": "a//b",
141
+ "up": "A::R::Bergsdalen",
142
+ "down": "B::G::Bergsdalen",
143
+ "edgeType": "Release",
144
+ "latUp": 60.5,
145
+ "lonUp": 6.1,
146
+ "latDown": 60.4,
147
+ "lonDown": 6.0,
148
+ }
149
+ ]
150
+ },
151
+ )
152
+
153
+ client, _ = make_client(handler)
154
+ links = client.links()
155
+ assert len(links) == 1
156
+ assert links[0].up == "A::R::Bergsdalen"
157
+ assert links[0].down == "B::G::Bergsdalen"
158
+ assert links[0].edge_type == "Release"
159
+ assert links[0].lat_up == 60.5
160
+
161
+
132
162
  def test_hierarchy_layers_sends_selected_nodes() -> None:
133
163
  captured = {}
134
164
 
File without changes
File without changes
File without changes
File without changes