Skip to content

Commit 131e620

Browse files
authored
Update microgrid client (#1230)
Blocked by: * ~The release of base-client v0.11~ * ~The release of microgrid client~
2 parents affb3a3 + a3de905 commit 131e620

File tree

69 files changed

+124
-113
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+124
-113
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## Upgrading
88

9-
<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->
9+
* The microgrid client dependency has been updated to version 0.9.0
1010

1111
## New Features
1212

benchmarks/power_distribution/power_distributor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
from typing import Any
1313

1414
from frequenz.channels import Broadcast
15-
from frequenz.client.microgrid import Component, ComponentCategory, ComponentId
15+
from frequenz.client.common.microgrid.components import ComponentId
16+
from frequenz.client.microgrid import Component, ComponentCategory
1617
from frequenz.quantities import Power
1718

1819
from frequenz.sdk import microgrid

pyproject.toml

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ dependencies = [
2929
# Make sure to update the mkdocs.yml file when
3030
# changing the version
3131
# (plugins.mkdocstrings.handlers.python.import)
32-
"frequenz-client-microgrid >= 0.7.0, < 0.8.0",
33-
"frequenz-channels >= 1.6.0, < 2.0.0",
32+
"frequenz-client-microgrid >= 0.9.0, < 0.10.0",
33+
"frequenz-client-common >= 0.3.2, < 0.4.0",
34+
"frequenz-channels >= 1.6.1, < 2.0.0",
3435
"frequenz-quantities[marshmallow] >= 1.0.0, < 2.0.0",
3536
"networkx >= 2.8, < 4",
3637
"numpy >= 2, < 3",
37-
"typing_extensions >= 4.6.1, < 5",
38+
"typing_extensions >= 4.13.0, < 5",
3839
"marshmallow >= 3.19.0, < 5",
3940
"marshmallow_dataclass >= 8.7.1, < 9",
4041
]
@@ -163,21 +164,30 @@ disable = [
163164
max-attributes = 12
164165

165166
[tool.pytest.ini_options]
166-
# We need to ignore PytestUnraisableExceptionWarning because we have some
167-
# cleanup issues, and sometimes exceptions are raised in __del__ methods, for
168-
# example when trying to do async stuff and the event loop is already closed.
169-
# This could even be caused by the GC, some time after the test function that
170-
# has the issue was completed.
171-
# Please see this issue for more details:
172-
# https://github.com/frequenz-floss/frequenz-sdk-python/issues/982
173-
addopts = "-W=all -Werror -Wdefault::DeprecationWarning -Wdefault::PendingDeprecationWarning -Wdefault::pytest.PytestUnraisableExceptionWarning -vv"
167+
addopts = "-vv"
174168
testpaths = ["tests", "src"]
175169
asyncio_mode = "auto"
176170
asyncio_default_fixture_loop_scope = "function"
177171
required_plugins = ["pytest-asyncio", "pytest-mock"]
178172
markers = [
179173
"integration: integration tests (deselect with '-m \"not integration\"')",
180174
]
175+
filterwarnings = [
176+
"error",
177+
"once::DeprecationWarning",
178+
"once::PendingDeprecationWarning",
179+
# We need to ignore PytestUnraisableExceptionWarning because we have some
180+
# cleanup issues, and sometimes exceptions are raised in __del__ methods, for
181+
# example when trying to do async stuff and the event loop is already closed.
182+
# This could even be caused by the GC, some time after the test function that
183+
# has the issue was completed.
184+
# Please see this issue for more details:
185+
# https://github.com/frequenz-floss/frequenz-sdk-python/issues/982
186+
"default::pytest.PytestUnraisableExceptionWarning",
187+
# We use a raw string (single quote) to avoid the need to escape special
188+
# chars as this is a regex
189+
'ignore:Protobuf gencode version .*exactly one major version older.*:UserWarning',
190+
]
181191

182192
[tool.mypy]
183193
explicit_package_bases = true

src/frequenz/sdk/microgrid/_data_pipeline.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
from datetime import timedelta
1818

1919
from frequenz.channels import Broadcast, Sender
20-
from frequenz.client.microgrid import ComponentCategory, ComponentId, InverterType
20+
from frequenz.client.common.microgrid.components import ComponentId
21+
from frequenz.client.microgrid import ComponentCategory, InverterType
2122

2223
from frequenz.sdk.microgrid._power_managing._base_classes import Algorithm, DefaultPower
2324

src/frequenz/sdk/microgrid/_data_sourcing/_component_metric_request.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
from dataclasses import dataclass
77
from datetime import datetime
88

9-
from frequenz.client.microgrid import ComponentId, ComponentMetricId
9+
from frequenz.client.common.microgrid.components import ComponentId
10+
from frequenz.client.microgrid import ComponentMetricId
1011

1112
__all__ = ["ComponentMetricRequest", "ComponentMetricId"]
1213

src/frequenz/sdk/microgrid/_data_sourcing/microgrid_api_source.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
from typing import Any
1010

1111
from frequenz.channels import Receiver, Sender
12+
from frequenz.client.common.microgrid.components import ComponentId
1213
from frequenz.client.microgrid import (
1314
BatteryData,
1415
ComponentCategory,
15-
ComponentId,
1616
ComponentMetricId,
1717
EVChargerData,
1818
InverterData,

src/frequenz/sdk/microgrid/_power_distributing/_component_managers/_battery_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
from datetime import timedelta
1212

1313
from frequenz.channels import LatestValueCache, Receiver, Sender
14+
from frequenz.client.common.microgrid.components import ComponentId
1415
from frequenz.client.microgrid import (
1516
ApiClientError,
1617
BatteryData,
1718
ComponentCategory,
18-
ComponentId,
1919
InverterData,
2020
OperationOutOfRange,
2121
)

src/frequenz/sdk/microgrid/_power_distributing/_component_managers/_component_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import collections.abc
88

99
from frequenz.channels import Sender
10-
from frequenz.client.microgrid import ComponentId
10+
from frequenz.client.common.microgrid.components import ComponentId
1111

1212
from .._component_status import ComponentPoolStatus
1313
from ..request import Request

src/frequenz/sdk/microgrid/_power_distributing/_component_managers/_ev_charger_manager/_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from dataclasses import dataclass, field
88
from datetime import timedelta
99

10-
from frequenz.client.microgrid import ComponentId
10+
from frequenz.client.common.microgrid.components import ComponentId
1111
from frequenz.quantities import Current
1212

1313

src/frequenz/sdk/microgrid/_power_distributing/_component_managers/_ev_charger_manager/_ev_charger_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
select,
1717
selected_from,
1818
)
19+
from frequenz.client.common.microgrid.components import ComponentId
1920
from frequenz.client.microgrid import (
2021
ApiClientError,
2122
ComponentCategory,
22-
ComponentId,
2323
EVChargerData,
2424
MicrogridApiClient,
2525
)

0 commit comments

Comments
 (0)