Skip to content

Commit fe029e2

Browse files
authored
Migrate MicrogridConfig from lib-notebooks repo (#18)
This pull request introduces a new, robust configuration system for microgrids, centered around the new `MicrogridConfig` class and related dataclasses. It also removes placeholder code and associated tests, and adds comprehensive unit tests for the new configuration logic. The changes improve the structure, maintainability, and test coverage of the codebase. Configuration system implementation: * Added a new `MicrogridConfig` class, along with supporting dataclasses such as `ComponentTypeConfig`, `PVConfig`, `WindConfig`, `BatteryConfig`, and `Metadata`. This system provides structured, validated configuration management for microgrids, including methods for loading from TOML files and retrieving component information. * Updated dependencies in `pyproject.toml` to include `marshmallow-dataclass`, required for schema validation in the new configuration classes. Copied from here with minimal adjustments: https://github.com/frequenz-floss/frequenz-lib-notebooks/blob/17953b89e18dadb9ece1117ca1a6cc28873aea74/src/frequenz/data/microgrid/config.py#L1
2 parents 217a3ab + 79e2a87 commit fe029e2

File tree

6 files changed

+557
-39
lines changed

6 files changed

+557
-39
lines changed

RELEASE_NOTES.md

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

1111
## New Features
1212

13-
<!-- Here goes the main new features and examples or instructions on how to use them -->
13+
* Adds a configuration class for microgrids copied from `frequenz-floss/lib-notebooks`.
1414

1515
## Bug Fixes
1616

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ classifiers = [
2828
requires-python = ">= 3.11, < 4"
2929
# TODO(cookiecutter): Remove and add more dependencies if appropriate
3030
dependencies = [
31+
"marshmallow-dataclass>=8.7.1,<9",
3132
"typing-extensions >= 4.14.1, < 5",
3233
]
3334
dynamic = ["version"]

src/frequenz/gridpool/__init__.py

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,8 @@
11
# License: MIT
22
# Copyright © 2025 Frequenz Energy-as-a-Service GmbH
33

4-
"""High-level interface to grid pools for the Frequenz platform..
4+
"""High-level interface to grid pools for the Frequenz platform."""
55

6-
TODO(cookiecutter): Add a more descriptive module description.
7-
"""
6+
from ._microgrid_config import MicrogridConfig
87

9-
10-
# TODO(cookiecutter): Remove this function
11-
def delete_me(*, blow_up: bool = False) -> bool:
12-
"""Do stuff for demonstration purposes.
13-
14-
Args:
15-
blow_up: If True, raise an exception.
16-
17-
Returns:
18-
True if no exception was raised.
19-
20-
Raises:
21-
RuntimeError: if blow_up is True.
22-
"""
23-
if blow_up:
24-
raise RuntimeError("This function should be removed!")
25-
return True
8+
__all__ = ["MicrogridConfig"]

0 commit comments

Comments
 (0)