Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump the required group across 1 directory with 19 updates #95

Merged
merged 6 commits into from
Oct 3, 2024
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
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
## Upgrading

* `Client.stream()` will now raise an Exception when the connection is lost.
* `Client.create()` and `Client.list() now take all optional arguments as keyword-only arguments.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Damn! Missing closing backtick for Create.list().

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe fix it the next time we update the release notes or before the next release.


## New Features

Expand Down
44 changes: 22 additions & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
requires = [
"setuptools == 68.1.0",
"setuptools_scm[toml] == 7.1.0",
"frequenz-repo-config[lib] == 0.9.2",
"frequenz-repo-config[lib] == 0.10.0",
]
build-backend = "setuptools.build_meta"

Expand Down Expand Up @@ -52,49 +52,49 @@ name = "Frequenz Energy-as-a-Service GmbH"
email = "floss@frequenz.com"

[project.optional-dependencies]
cli = ["asyncclick == 8.1.7.2", "prompt-toolkit == 3.0.47", "parsedatetime==2.6", "tzlocal==5.2"]
cli = ["asyncclick == 8.1.7.2", "prompt-toolkit == 3.0.48", "parsedatetime==2.6", "tzlocal==5.2"]

dev-flake8 = [
"flake8 == 7.1.0",
"flake8 == 7.1.1",
"flake8-docstrings == 1.7.0",
"flake8-pyproject == 1.2.3", # For reading the flake8 config from pyproject.toml
"pydoclint == 0.5.3",
"pydoclint == 0.5.9",
"pydocstyle == 6.3.0",
]
dev-formatting = ["black == 24.4.2", "isort == 5.13.2"]
dev-formatting = ["black == 24.8.0", "isort == 5.13.2"]
dev-mkdocs = [
"black == 24.4.2",
"Markdown==3.6",
"mike == 2.1.2",
"black == 24.8.0",
"Markdown==3.7",
"mike == 2.1.3",
"mkdocs-gen-files == 0.5.0",
"mkdocs-literate-nav == 0.6.1",
"mkdocs-macros-plugin == 1.0.5",
"mkdocs-material == 9.5.27",
"mkdocstrings[python] == 0.25.1",
"frequenz-repo-config[lib] == 0.9.2",
"mkdocs-macros-plugin == 1.2.0",
"mkdocs-material == 9.5.39",
"mkdocstrings[python] == 0.26.1",
"frequenz-repo-config[lib] == 0.10.0",
]
dev-mypy = [
"mypy == 1.10.1",
"types-Markdown == 3.6.0.20240316",
"mypy == 1.11.2",
"types-Markdown == 3.7.0.20240822",
# For checking the noxfile, docs/ script, and tests
"frequenz-client-dispatch[cli,dev-mkdocs,dev-noxfile,dev-pytest]",
"grpc-stubs == 1.53.0.5",
"types-protobuf == 5.27.0.20240626",
"types-protobuf == 5.28.0.20240924",
]
dev-noxfile = ["nox == 2024.4.15", "frequenz-repo-config[lib] == 0.9.2"]
dev-noxfile = ["nox == 2024.4.15", "frequenz-repo-config[lib] == 0.10.0"]
dev-pylint = [
"pylint == 3.2.5",
"pylint == 3.3.1",
# For checking the noxfile, docs/ script, and tests
"frequenz-client-dispatch[cli,dev-mkdocs,dev-noxfile,dev-pytest]",
"frequenz-api-dispatch >= 0.15.1, < 0.16",
]
dev-pytest = [
"pytest == 8.2.2",
"frequenz-repo-config[extra-lint-examples] == 0.9.2",
"pytest == 8.3.3",
"frequenz-repo-config[extra-lint-examples] == 0.10.0",
"pytest-mock == 3.14.0",
"pytest-asyncio == 0.23.7",
"async-solipsism == 0.6",
"hypothesis == 6.104.2",
"pytest-asyncio == 0.24.0",
"async-solipsism == 0.7",
"hypothesis == 6.112.2",
"frequenz-client-dispatch[cli]",
]
dev = [
Expand Down
5 changes: 3 additions & 2 deletions src/frequenz/client/dispatch/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def __init__(
async def list(
self,
microgrid_id: int,
*,
component_selectors: Iterator[ComponentSelector] = iter(()),
start_from: datetime | None = None,
start_to: datetime | None = None,
Expand Down Expand Up @@ -231,13 +232,14 @@ def _get_stream(

return broadcaster

async def create(
async def create( # pylint: disable=too-many-positional-arguments
self,
microgrid_id: int,
type: str, # pylint: disable=redefined-builtin
start_time: datetime,
duration: timedelta | None,
selector: ComponentSelector,
*,
active: bool = True,
dry_run: bool = False,
payload: dict[str, Any] | None = None,
Expand Down Expand Up @@ -265,7 +267,6 @@ async def create(
Raises:
ValueError: If start_time is in the past.
ValueError: If the created dispatch could not be found.
"""
if start_time <= datetime.now(tz=start_time.tzinfo):
raise ValueError("start_time must not be in the past")
Expand Down
14 changes: 10 additions & 4 deletions tests/test_dispatch_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ def mock_client(fake_client: FakeClient) -> Generator[None, None, None]:
yield


# For test functions we want to disable some pylint checks, we need many (positional)
# arguments to pass fixtures, these functions are not meant to be called directly, and
# having too many locals in tests is not a problem either.
# pylint: disable=too-many-arguments,too-many-positional-arguments,too-many-locals


@pytest.mark.asyncio
@pytest.mark.parametrize(
"dispatches, microgrid_id, expected_output, expected_return_code",
Expand Down Expand Up @@ -142,7 +148,7 @@ def mock_client(fake_client: FakeClient) -> Generator[None, None, None]:
),
],
)
async def test_list_command( # pylint: disable=too-many-arguments
async def test_list_command(
runner: CliRunner,
fake_client: FakeClient,
dispatches: dict[int, list[Dispatch]],
Expand Down Expand Up @@ -305,7 +311,7 @@ async def test_list_command( # pylint: disable=too-many-arguments
),
],
)
async def test_create_command( # pylint: disable=too-many-arguments,too-many-locals
async def test_create_command(
runner: CliRunner,
fake_client: FakeClient,
args: list[str],
Expand Down Expand Up @@ -529,7 +535,7 @@ async def test_create_command( # pylint: disable=too-many-arguments,too-many-lo
),
],
)
async def test_update_command( # pylint: disable=too-many-arguments
async def test_update_command(
runner: CliRunner,
fake_client: FakeClient,
dispatches: list[Dispatch],
Expand Down Expand Up @@ -631,7 +637,7 @@ async def test_get_command(
),
],
)
async def test_delete_command( # pylint: disable=too-many-arguments
async def test_delete_command(
runner: CliRunner,
fake_client: FakeClient,
dispatches: list[Dispatch],
Expand Down
2 changes: 1 addition & 1 deletion tests/test_dispatch_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_component_selector() -> None:
[ComponentCategory.METER],
[ComponentCategory.EV_CHARGER, ComponentCategory.BATTERY],
):
protobuf = component_selector_to_protobuf(selector) # type: ignore
protobuf = component_selector_to_protobuf(selector)
assert component_selector_from_protobuf(protobuf) == selector


Expand Down
Loading