Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@

## Summary

<!-- Here goes a general summary of what this release is about -->
This is a small release to allow for easier interoperability between different APIs.

## Upgrading

<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->
- Some minimum dependency versions are bumped, so you might need to update your dependencies as well.
- The IDs (`MicrogridId`, `ComponentId`, `SensorId`) are now imported from `frequenz-client-common`. Please add it to your dependencies if you haven't already, then you can replace your imports:

## New Features

<!-- Here goes the main new features and examples or instructions on how to use them -->

## Bug Fixes

<!-- Here goes notable bug fixes that are worth a special mention or explanation -->
* `from frequenz.client.microgrid import MicrogridId` -> `from frequenz.client.common.microgrid import MicrogridId`
* `from frequenz.client.microgrid import ComponentId` -> `from frequenz.client.common.microgrid.components import ComponentId`
* `from frequenz.client.microgrid import SensorId` -> `from frequenz.client.common.microgrid.sensors import SensorId`
19 changes: 14 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ classifiers = [
]
requires-python = ">= 3.11, < 4"
dependencies = [
"frequenz-api-microgrid >= 0.15.3, < 0.16.0",
"frequenz-api-microgrid >= 0.15.5, < 0.16.0",
"frequenz-channels >= 1.0.0-rc1, < 2.0.0",
"frequenz-client-base >= 0.8.0, < 0.12.0",
"grpcio >= 1.59.0, < 2",
"protobuf >= 4.21.6, < 7",
"frequenz-client-common >= 0.3.2, < 0.4.0",
"grpcio >= 1.63.0, < 2",
"protobuf >= 5.26.1, < 7",
"timezonefinder >= 6.2.0, < 7",
"typing-extensions >= 4.6.0, < 5",
"typing-extensions >= 4.13.0, < 5",
]
dynamic = ["version"]

Expand Down Expand Up @@ -161,7 +162,15 @@ disable = [
]

[tool.pytest.ini_options]
addopts = "-W=all -Werror -Wdefault::DeprecationWarning -Wdefault::PendingDeprecationWarning -vv"
addopts = "-vv"
filterwarnings = [
"error",
"once::DeprecationWarning",
"once::PendingDeprecationWarning",
# We use a raw string (single quote) to avoid the need to escape special
# chars as this is a regex
'ignore:Protobuf gencode version .*exactly one major version older.*:UserWarning',
]
testpaths = ["tests", "src"]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
Expand Down
4 changes: 3 additions & 1 deletion src/frequenz/client/microgrid/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
from frequenz.api.microgrid import microgrid_pb2, microgrid_pb2_grpc, sensor_pb2
from frequenz.channels import Receiver
from frequenz.client.base import channel, client, retry, streaming
from frequenz.client.common.microgrid import MicrogridId
from frequenz.client.common.microgrid.components import ComponentId
from frequenz.client.common.microgrid.sensors import SensorId
from google.protobuf.empty_pb2 import Empty
from typing_extensions import override

Expand All @@ -39,7 +42,6 @@
from ._exception import ApiClientError, ClientNotConnected
from ._metadata import Location, Metadata
from ._sensor_proto import sensor_data_samples_from_proto, sensor_from_proto
from .id import ComponentId, MicrogridId, SensorId
from .sensor import Sensor, SensorDataSamples, SensorMetric

DEFAULT_GRPC_CALL_TIMEOUT = 60.0
Expand Down
3 changes: 1 addition & 2 deletions src/frequenz/client/microgrid/_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

from frequenz.api.common import components_pb2
from frequenz.api.microgrid import grid_pb2, inverter_pb2

from .id import ComponentId
from frequenz.client.common.microgrid.components import ComponentId


class ComponentType(Enum):
Expand Down
2 changes: 1 addition & 1 deletion src/frequenz/client/microgrid/_component_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from typing import Self

from frequenz.api.microgrid import microgrid_pb2
from frequenz.client.common.microgrid.components import ComponentId

from ._component_error import BatteryError, InverterError
from ._component_states import (
Expand All @@ -18,7 +19,6 @@
EVChargerComponentState,
InverterComponentState,
)
from .id import ComponentId


@dataclass(frozen=True)
Expand Down
2 changes: 1 addition & 1 deletion src/frequenz/client/microgrid/_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from dataclasses import dataclass

from .id import ComponentId
from frequenz.client.common.microgrid.components import ComponentId


@dataclass(frozen=True)
Expand Down
3 changes: 1 addition & 2 deletions src/frequenz/client/microgrid/_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
from dataclasses import dataclass
from zoneinfo import ZoneInfo

from frequenz.client.common.microgrid import MicrogridId
from timezonefinder import TimezoneFinder

from .id import MicrogridId

_timezone_finder = TimezoneFinder()


Expand Down
2 changes: 1 addition & 1 deletion src/frequenz/client/microgrid/_sensor_proto.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
from frequenz.api.common import components_pb2
from frequenz.api.microgrid import common_pb2, microgrid_pb2, sensor_pb2
from frequenz.client.base import conversion
from frequenz.client.common.microgrid.sensors import SensorId

from ._lifetime import Lifetime
from ._util import enum_from_proto
from .id import SensorId
from .sensor import (
Sensor,
SensorDataSamples,
Expand Down
218 changes: 0 additions & 218 deletions src/frequenz/client/microgrid/id.py

This file was deleted.

2 changes: 1 addition & 1 deletion src/frequenz/client/microgrid/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
from typing import assert_never

from frequenz.api.microgrid import sensor_pb2
from frequenz.client.common.microgrid.sensors import SensorId

from ._lifetime import Lifetime
from .id import SensorId
from .metrics import AggregatedMetricValue, AggregationMethod


Expand Down
4 changes: 3 additions & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
from frequenz.api.common import components_pb2, metrics_pb2
from frequenz.api.microgrid import grid_pb2, inverter_pb2, microgrid_pb2, sensor_pb2
from frequenz.client.base import conversion, retry
from frequenz.client.common.microgrid import MicrogridId
from frequenz.client.common.microgrid.components import ComponentId
from frequenz.client.common.microgrid.sensors import SensorId
from google.protobuf.empty_pb2 import Empty

from frequenz.client.microgrid import (
Expand All @@ -34,7 +37,6 @@
MeterData,
MicrogridApiClient,
)
from frequenz.client.microgrid.id import ComponentId, MicrogridId, SensorId
from frequenz.client.microgrid.sensor import (
Sensor,
SensorDataSamples,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

import pytest
from frequenz.api.common import components_pb2
from frequenz.client.common.microgrid.components import ComponentId

from frequenz.client.microgrid import (
Component,
ComponentCategory,
)
from frequenz.client.microgrid._component import component_category_from_protobuf
from frequenz.client.microgrid.id import ComponentId


def test_component_category_from_protobuf() -> None:
Expand Down
Loading
Loading