Skip to content

Commit 71ab293

Browse files
authored
Update to api-assets v0.4.0 / api-common v0.8.11 (#128)
The common API renamed and moved `market.MarketLocation` to `grip.MarketLocationRef` between v0.8.9 and v0.8.11. The assets API update the common API dependency in v0.4.0. This commit bring the client up to date with those changes, renaming the `MarketLocation` wrapper to `MarketLocationRef` to match the upstream changes.
2 parents 169a15d + 982f279 commit 71ab293

8 files changed

Lines changed: 26 additions & 36 deletions

File tree

RELEASE_NOTES.md

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11
# Frequenz Assets API Client Release Notes
22

3-
## Summary
4-
5-
<!-- Here goes a general summary of what this release is about -->
6-
73
## Upgrading
84

9-
<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->
10-
11-
## New Features
12-
13-
<!-- Here goes the main new features and examples or instructions on how to use them -->
14-
15-
## Bug Fixes
16-
17-
<!-- Here goes notable bug fixes that are worth a special mention or explanation -->
5+
- Bumped `frequenz-api-common` from `v0.8.9` to `v0.8.11` and `frequenz-api-assets` from `v0.3.0` to `v0.4.0`.
6+
- Renamed `MarketLocation` to `MarketLocationRef` to match the upstream protobuf rename in `frequenz-api-common` v0.8.11. The `market_location_from_proto` helper was renamed to `market_location_ref_from_proto` accordingly.
7+
- Renamed the `MarketTopologyRelation.market_location` field to `market_location_ref` to match the upstream protobuf field rename in `frequenz-api-assets` v0.4.0.

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ classifiers = [
3737
requires-python = ">= 3.11, < 4"
3838
dependencies = [
3939
"typing-extensions >= 4.13.0, < 5",
40-
"frequenz-api-assets >= 0.3.0, < 0.4.0",
41-
"frequenz-api-common >= 0.8.9, < 1",
40+
"frequenz-api-assets >= 0.4.0, < 0.5.0",
41+
"frequenz-api-common >= 0.8.11, < 1",
4242
"frequenz-client-base >= 0.11.0, < 0.12.0",
4343
"frequenz-client-common >= 0.3.8, < 0.5.0",
44-
"grpcio >= 1.81.0, < 2",
44+
"grpcio >= 1.81.1, < 2",
4545
]
4646
dynamic = ["version"]
4747

src/frequenz/client/assets/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from ._interval import Interval
1717
from ._lifetime import Lifetime
1818
from ._location import Location
19-
from ._market_location import MarketLocation, MarketLocationId, MarketLocationIdType
19+
from ._market_location import MarketLocationId, MarketLocationIdType, MarketLocationRef
2020
from ._market_topology import (
2121
MarketParticipation,
2222
MarketParticipationType,
@@ -40,9 +40,9 @@
4040
"MicrogridStatus",
4141
"Location",
4242
"Lifetime",
43-
"MarketLocation",
4443
"MarketLocationId",
4544
"MarketLocationIdType",
45+
"MarketLocationRef",
4646
"MarketParticipation",
4747
"MarketParticipationType",
4848
"MarketTopologyRelation",

src/frequenz/client/assets/_market_location.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ class MarketLocationId:
6868

6969

7070
@dataclass(frozen=True, kw_only=True)
71-
class MarketLocation:
72-
"""A market-facing metering point in a specific market area."""
71+
class MarketLocationRef:
72+
"""A reference to a market-facing metering point in a specific market area."""
7373

7474
market_area: int
7575
"""The market area in which this market location is registered."""

src/frequenz/client/assets/_market_location_proto.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# License: MIT
22
# Copyright © 2026 Frequenz Energy-as-a-Service GmbH
33

4-
"""Conversion of MarketLocation objects to/from protobuf messages."""
4+
"""Conversion of MarketLocationRef objects to/from protobuf messages."""
55

66
from frequenz.api.common.v1alpha8.grid import market_location_pb2
77
from frequenz.client.common.proto import enum_from_proto
88

9-
from ._market_location import MarketLocation, MarketLocationId, MarketLocationIdType
9+
from ._market_location import MarketLocationId, MarketLocationIdType, MarketLocationRef
1010

1111

1212
def market_location_id_from_proto(
@@ -19,11 +19,11 @@ def market_location_id_from_proto(
1919
)
2020

2121

22-
def market_location_from_proto(
23-
message: market_location_pb2.MarketLocation,
24-
) -> MarketLocation:
25-
"""Convert a protobuf market location message to a domain object."""
26-
return MarketLocation(
22+
def market_location_ref_from_proto(
23+
message: market_location_pb2.MarketLocationRef,
24+
) -> MarketLocationRef:
25+
"""Convert a protobuf market location ref message to a domain object."""
26+
return MarketLocationRef(
2727
market_area=message.market_area,
2828
market_location_id=(
2929
market_location_id_from_proto(message.market_location_id)

src/frequenz/client/assets/_market_topology.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
from ._delivery_area import DeliveryArea
1313
from ._interval import Interval
14-
from ._market_location import MarketLocation
14+
from ._market_location import MarketLocationRef
1515

1616

1717
@enum.unique
@@ -46,7 +46,7 @@ class MarketTopologyRelation:
4646
microgrid_id: MicrogridId | None
4747
"""The microgrid associated with this relation."""
4848

49-
market_location: MarketLocation | None
49+
market_location_ref: MarketLocationRef | None
5050
"""The market location associated with this relation."""
5151

5252
gridpool_id: int | None

src/frequenz/client/assets/_market_topology_proto.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from ._delivery_area_proto import delivery_area_from_proto
1111
from ._interval_proto import interval_from_proto
12-
from ._market_location_proto import market_location_from_proto
12+
from ._market_location_proto import market_location_ref_from_proto
1313
from ._market_topology import (
1414
MarketParticipation,
1515
MarketParticipationType,
@@ -41,9 +41,9 @@ def market_topology_relation_from_proto(
4141
if message.HasField("microgrid_id")
4242
else None
4343
),
44-
market_location=(
45-
market_location_from_proto(message.market_location)
46-
if message.HasField("market_location")
44+
market_location_ref=(
45+
market_location_ref_from_proto(message.market_location_ref)
46+
if message.HasField("market_location_ref")
4747
else None
4848
),
4949
gridpool_id=message.gridpool_id if message.HasField("gridpool_id") else None,

tests/client_test_cases/list_market_topology_relations/success_case.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
DeliveryArea,
1818
EnergyMarketCodeType,
1919
Interval,
20-
MarketLocation,
2120
MarketLocationId,
2221
MarketLocationIdType,
22+
MarketLocationRef,
2323
MarketParticipation,
2424
MarketParticipationType,
2525
MarketTopologyRelation,
@@ -64,7 +64,7 @@ def assert_stub_method_call(stub_method: Any) -> None:
6464
relations=[
6565
assets_pb2.MarketTopologyRelation(
6666
microgrid_id=1234,
67-
market_location=market_location_pb2.MarketLocation(
67+
market_location_ref=market_location_pb2.MarketLocationRef(
6868
market_area=market_area_pb2.MarketArea.ValueType(1),
6969
market_location_id=market_location_pb2.MarketLocationId(
7070
id=market_location_pb2.MarketLocationIdValue(value="DE001"),
@@ -94,7 +94,7 @@ def assert_client_result(result: Any) -> None:
9494
assert result == [
9595
MarketTopologyRelation(
9696
microgrid_id=MicrogridId(1234),
97-
market_location=MarketLocation(
97+
market_location_ref=MarketLocationRef(
9898
market_area=1,
9999
market_location_id=MarketLocationId(
100100
value="DE001", type=MarketLocationIdType.MALO_ID

0 commit comments

Comments
 (0)