Skip to content

Commit d5614a8

Browse files
Remove pandas(-stubs) dependencies (#261)
2 parents 7f04fd9 + c4bd97e commit d5614a8

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

RELEASE_NOTES.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
* Remove `_soc` formula from the LogicalMeter. This feature has been moved to the BatteryPool.
88
* Upgrade PowerDistributingActor to handle components with the NaN metrics (#247):
9-
* if power bounds are NaN, then it tries to replace them with corresponding power bounds from adjacent component. If these components are also NaN, then it ignores battery.
10-
* if other metrics metrics are NaN then it ignores battery.
9+
* if power bounds are NaN, then it tries to replace them with corresponding power bounds from adjacent component. If these components are also NaN, then it ignores battery.
10+
* if other metrics metrics are NaN then it ignores battery.
1111
* BatteryStatus to track that a component stopped sending messages. If the battery or its adjacent inverter stopped sending messages, then the battery would be considered as not working. (#207)
1212
* PowerDistributing to send battery status to subscribed users (#205)
1313
* Rename microgrid.Microgrid to microgrid.ConnectionManager (#208)
@@ -21,12 +21,13 @@
2121
* BatteryPool implementation for aggregating battery-inverter metrics into higher level metrics. (#205)
2222
* Add EV power and current streams to `EVChargerPool` (#201)
2323

24-
2524
## Bug Fixes
2625

2726
* The resampler now correctly produces resampling windows of exact *resampling period* size, which only include samples emitted during the resampling window (see #170)
2827

2928
## Removing
29+
3030
* Deprecated code (#232):
31-
* frequenz.sdk._data_ingestion
32-
* frequenz.sdk._data_handling
31+
* frequenz.sdk._data_ingestion
32+
* frequenz.sdk._data_handling
33+
* The pandas(-stubs) and pytz dependencies are no longer needed (#261).

pyproject.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ dependencies = [
3131
"grpcio >= 1.51.1, < 2",
3232
"grpcio-tools >= 1.51.1, < 2",
3333
"networkx >= 2.8, < 3",
34-
"pandas >= 1.5.2, < 2",
34+
"numpy >= 1.24.2, < 2",
3535
"protobuf >= 4.21.6, < 5",
3636
"pydantic >= 1.9",
3737
"sympy >= 1.10.1, < 2",
@@ -78,7 +78,6 @@ pytest = [
7878
]
7979
mypy = [
8080
"mypy >= 1.0.1, < 2",
81-
"pandas-stubs == 1.5.3.230304",
8281
"grpc-stubs == 1.24.12", # This dependency introduces breaking changes in patch releases
8382
# For checking the noxfile, docs/ script, and tests
8483
"frequenz-sdk[docs-gen,nox,pytest]",

src/frequenz/sdk/microgrid/component/_component_data.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66

77
from abc import ABC, abstractmethod
88
from dataclasses import dataclass, field
9-
from datetime import datetime
9+
from datetime import datetime, timezone
1010
from typing import List, Optional, Tuple
1111

1212
import frequenz.api.microgrid.battery_pb2 as battery_pb
1313
import frequenz.api.microgrid.inverter_pb2 as inverter_pb
1414
import frequenz.api.microgrid.microgrid_pb2 as microgrid_pb
15-
import pytz
1615

1716
from ._component_states import EVChargerCableState, EVChargerComponentState
1817

@@ -93,7 +92,7 @@ def from_proto(cls, raw: microgrid_pb.ComponentData) -> MeterData:
9392
"""
9493
meter_data = cls(
9594
component_id=raw.id,
96-
timestamp=raw.ts.ToDatetime(tzinfo=pytz.UTC),
95+
timestamp=raw.ts.ToDatetime(tzinfo=timezone.utc),
9796
active_power=raw.meter.data.ac.power_active.value,
9897
current_per_phase=(
9998
raw.meter.data.ac.phase_1.current.value,
@@ -166,7 +165,7 @@ def from_proto(cls, raw: microgrid_pb.ComponentData) -> BatteryData:
166165
"""
167166
battery_data = cls(
168167
component_id=raw.id,
169-
timestamp=raw.ts.ToDatetime(tzinfo=pytz.UTC),
168+
timestamp=raw.ts.ToDatetime(tzinfo=timezone.utc),
170169
soc=raw.battery.data.soc.avg,
171170
soc_lower_bound=raw.battery.data.soc.system_bounds.lower,
172171
soc_upper_bound=raw.battery.data.soc.system_bounds.upper,
@@ -221,7 +220,7 @@ def from_proto(cls, raw: microgrid_pb.ComponentData) -> InverterData:
221220
"""
222221
inverter_data = cls(
223222
component_id=raw.id,
224-
timestamp=raw.ts.ToDatetime(tzinfo=pytz.UTC),
223+
timestamp=raw.ts.ToDatetime(tzinfo=timezone.utc),
225224
active_power=raw.inverter.data.ac.power_active.value,
226225
active_power_lower_bound=raw.inverter.data.ac.power_active.system_bounds.lower,
227226
active_power_upper_bound=raw.inverter.data.ac.power_active.system_bounds.upper,
@@ -272,7 +271,7 @@ def from_proto(cls, raw: microgrid_pb.ComponentData) -> EVChargerData:
272271
"""
273272
ev_charger_data = cls(
274273
component_id=raw.id,
275-
timestamp=raw.ts.ToDatetime(tzinfo=pytz.UTC),
274+
timestamp=raw.ts.ToDatetime(tzinfo=timezone.utc),
276275
active_power=raw.ev_charger.data.ac.power_active.value,
277276
current_per_phase=(
278277
raw.ev_charger.data.ac.phase_1.current.value,

tests/actor/test_battery_status.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def battery_data(
5353
Args:
5454
component_id: component id
5555
timestamp: Timestamp of the component message.
56-
Defaults to datetime.now(tz=pytz.utc).
56+
Defaults to datetime.now(tz=timezone.utc).
5757
relay_state: Battery relay state.
5858
Defaults to BatteryRelayState.RELAY_STATE_CLOSED.
5959
component_state: Component state.
@@ -88,7 +88,7 @@ def inverter_data(
8888
Args:
8989
component_id: component id
9090
timestamp: Timestamp of the component message.
91-
Defaults to datetime.now(tz=pytz.utc).
91+
Defaults to datetime.now(tz=timezone.utc).
9292
component_state: Component state.
9393
Defaults to InverterState.CHARGING.
9494
errors: List of the components error. By default empty list will be created.

0 commit comments

Comments
 (0)