Skip to content

Commit 54735f7

Browse files
authored
Reorganize the config module (#1126)
- **Rename `_config_managing.py` to `_managing_actor.py`** - **Rename `LoggingConfigUpdater` to `LoggingConfigUpdatingActor`** - **Rename _logging_config_updater.py to _logging_actor.py** - **Fix example in `LoggingConfigUpdatingActor`**
2 parents 551158c + d1b80f3 commit 54735f7

File tree

6 files changed

+15
-13
lines changed

6 files changed

+15
-13
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 `LoggingConfigUpdater` was renamed to `LoggingConfigUpdatingActor` to follow the actor naming convention.
1010

1111
## New Features
1212

src/frequenz/sdk/config/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33

44
"""Read and update config variables."""
55

6-
from ._config_managing import ConfigManagingActor
7-
from ._logging_config_updater import LoggerConfig, LoggingConfig, LoggingConfigUpdater
6+
from ._logging_actor import LoggerConfig, LoggingConfig, LoggingConfigUpdatingActor
7+
from ._managing_actor import ConfigManagingActor
88
from ._util import load_config
99

1010
__all__ = [
1111
"ConfigManagingActor",
1212
"LoggingConfig",
1313
"LoggerConfig",
14-
"LoggingConfigUpdater",
14+
"LoggingConfigUpdatingActor",
1515
"load_config",
1616
]

src/frequenz/sdk/config/_logging_config_updater.py renamed to src/frequenz/sdk/config/_logging_actor.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def load(cls, configs: Mapping[str, Any]) -> Self: # noqa: DOC502
8585
return cast(Self, schema.load(configs, unknown=RAISE))
8686

8787

88-
class LoggingConfigUpdater(Actor):
88+
class LoggingConfigUpdatingActor(Actor):
8989
"""Actor that listens for logging configuration changes and sets them.
9090
9191
Example:
@@ -107,14 +107,16 @@ class LoggingConfigUpdater(Actor):
107107
from typing import Any
108108
109109
from frequenz.channels import Broadcast
110-
from frequenz.sdk.config import LoggingConfigUpdater, ConfigManager
110+
from frequenz.sdk.config import LoggingConfigUpdatingActor, ConfigManagingActor
111111
from frequenz.sdk.actor import run as run_actors
112112
113113
async def run() -> None:
114114
config_channel = Broadcast[Mapping[str, Any]](name="config", resend_latest=True)
115115
actors = [
116-
ConfigManager(config_paths=["config.toml"], output=config_channel.new_sender()),
117-
LoggingConfigUpdater(
116+
ConfigManagingActor(
117+
config_paths=["config.toml"], output=config_channel.new_sender()
118+
),
119+
LoggingConfigUpdatingActor(
118120
config_recv=config_channel.new_receiver(limit=1)).map(
119121
lambda app_config: app_config.get("logging", {}
120122
)
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from pytest_mock import MockerFixture
1717

1818
from frequenz.sdk.config import ConfigManagingActor
19-
from frequenz.sdk.config._config_managing import _recursive_update
19+
from frequenz.sdk.config._managing_actor import _recursive_update
2020

2121

2222
class Item:

tests/config/test_logging_config_updater.py renamed to tests/config/test_logging_actor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from marshmallow import ValidationError
1414
from pytest_mock import MockerFixture
1515

16-
from frequenz.sdk.config import LoggerConfig, LoggingConfig, LoggingConfigUpdater
16+
from frequenz.sdk.config import LoggerConfig, LoggingConfig, LoggingConfigUpdatingActor
1717

1818

1919
def test_logging_config() -> None:
@@ -60,7 +60,7 @@ def cleanup_logs() -> Any:
6060
logging.getLogger("frequenz.sdk.timeseries").setLevel(logging.NOTSET)
6161

6262

63-
async def test_logging_config_updater_actor(
63+
async def test_logging_config_updating_actor(
6464
mocker: MockerFixture,
6565
cleanup_logs: Any,
6666
) -> None:
@@ -70,11 +70,11 @@ async def test_logging_config_updater_actor(
7070
# Overriding logging.basicConfig would mess up other tests, so we mock it.
7171
# This is just for extra safety because changing root logging level in unit tests
7272
# is not working anyway - python ignores it.
73-
mocker.patch("frequenz.sdk.config._logging_config_updater.logging.basicConfig")
73+
mocker.patch("frequenz.sdk.config._logging_actor.logging.basicConfig")
7474

7575
config_channel = Broadcast[Mapping[str, Any]](name="config")
7676
config_sender = config_channel.new_sender()
77-
async with LoggingConfigUpdater(
77+
async with LoggingConfigUpdatingActor(
7878
config_recv=config_channel.new_receiver().map(
7979
lambda app_config: app_config.get("logging", {})
8080
)

0 commit comments

Comments
 (0)