diff --git a/.github/containers/test-installation/Dockerfile b/.github/containers/test-installation/Dockerfile index bc71d610a..4926f157b 100644 --- a/.github/containers/test-installation/Dockerfile +++ b/.github/containers/test-installation/Dockerfile @@ -5,7 +5,12 @@ FROM --platform=${TARGETPLATFORM} python:3.11-slim -RUN python -m pip install --upgrade --no-cache-dir pip +RUN apt-get update -y && \ + apt-get install --no-install-recommends -y \ + git && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + python -m pip install --upgrade --no-cache-dir pip COPY dist dist RUN pip install dist/*.whl && \ diff --git a/pyproject.toml b/pyproject.toml index 28da8fa3a..63a85a4af 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ requires = [ "setuptools == 69.0.3", "setuptools_scm[toml] == 8.0.4", - "frequenz-repo-config[lib] == 0.7.4", + "frequenz-repo-config[lib] == 0.9.1", ] build-backend = "setuptools.build_meta" @@ -55,47 +55,47 @@ dev-flake8 = [ "flake8 == 7.0.0", "flake8-docstrings == 1.7.0", "flake8-pyproject == 1.2.3", # For reading the flake8 config from pyproject.toml - "pydoclint == 0.3.8", + "pydoclint == 0.4.1", "pydocstyle == 6.3.0", ] -dev-examples = ["polars == 0.20.2"] -dev-formatting = ["black == 24.1.1", "isort == 5.13.2"] +dev-examples = ["polars == 0.20.18"] +dev-formatting = ["black == 24.3.0", "isort == 5.13.2"] dev-mkdocs = [ - "black == 24.1.1", - "Markdown==3.5.1", + "black == 24.3.0", + "Markdown==3.6", "mike == 2.0.0", "mkdocs-gen-files == 0.5.0", "mkdocs-literate-nav == 0.6.1", "mkdocs-macros-plugin == 1.0.5", - "mkdocs-material == 9.5.3", - "mkdocstrings[python] == 0.24.0", - "frequenz-repo-config[lib] == 0.7.4", + "mkdocs-material == 9.5.16", + "mkdocstrings[python] == 0.24.1", + "frequenz-repo-config[lib] == 0.9.1", ] dev-mypy = [ - "mypy == 1.8.0", + "mypy == 1.9.0", "grpc-stubs == 1.24.12", # This dependency introduces breaking changes in patch releases - "types-Markdown == 3.5.0.20240129", + "types-Markdown == 3.6.0.20240316", "types-protobuf == 4.24.0.20240129", - "types-setuptools == 69.0.0.20240125", + "types-setuptools == 69.2.0.20240317", # For checking the noxfile, docs/ script, and tests "frequenz-sdk[dev-mkdocs,dev-noxfile,dev-pytest]", ] -dev-noxfile = ["nox == 2023.4.22", "frequenz-repo-config[lib] == 0.7.4"] +dev-noxfile = ["nox == 2023.4.22", "frequenz-repo-config[lib] == 0.9.1"] dev-pylint = [ - "pylint == 3.0.3", + "pylint == 3.1.0", # For checking the noxfile, docs/ script, and tests "frequenz-sdk[dev-mkdocs,dev-noxfile,dev-pytest]", ] dev-pytest = [ - "pytest == 7.4.4", - "frequenz-repo-config[extra-lint-examples] == 0.7.4", - "pytest-mock == 3.12.0", - "pytest-asyncio == 0.23.3", + "pytest == 8.1.1", + "frequenz-repo-config[extra-lint-examples] == 0.9.1", + "pytest-mock == 3.14.0", + "pytest-asyncio == 0.23.6", "time-machine == 2.12.0", - "async-solipsism == 0.5", + "async-solipsism == 0.6", # For checking docstring code examples "frequenz-sdk[dev-examples]", - "hypothesis == 6.92.1", + "hypothesis == 6.100.0", ] dev = [ "frequenz-sdk[dev-mkdocs,dev-flake8,dev-formatting,dev-mkdocs,dev-mypy,dev-noxfile,dev-pylint,dev-pytest]", @@ -144,6 +144,7 @@ min-similarity-lines = 40 [tool.pylint.messages_control] disable = [ "too-few-public-methods", + "too-many-return-statements", # disabled because it conflicts with isort "wrong-import-order", "ungrouped-imports", @@ -151,6 +152,8 @@ disable = [ # it is a type-check, for which we already have mypy. "unsubscriptable-object", # Checked by flake8 + "redefined-outer-name", + "unused-import", "line-too-long", "redefined-outer-name", "unnecessary-lambda-assignment", @@ -191,8 +194,6 @@ module = [ # The available stubs packages are outdated or incomplete (WIP/experimental): # https://github.com/frequenz-floss/frequenz-sdk-python/issues/430 "networkx", - "sybil", - "sybil.*", ] ignore_missing_imports = true diff --git a/src/frequenz/sdk/actor/power_distributing/_component_managers/_ev_charger_manager/_ev_charger_manager.py b/src/frequenz/sdk/actor/power_distributing/_component_managers/_ev_charger_manager/_ev_charger_manager.py index 9fa1c75a0..c5dcf2e9f 100644 --- a/src/frequenz/sdk/actor/power_distributing/_component_managers/_ev_charger_manager/_ev_charger_manager.py +++ b/src/frequenz/sdk/actor/power_distributing/_component_managers/_ev_charger_manager/_ev_charger_manager.py @@ -389,8 +389,7 @@ def _deallocate_unused_power(self, to_deallocate: Power) -> dict[int, Power]: ev_to_deallocate = evc.last_allocation - evc.power if ev_to_deallocate <= Power.zero(): continue - if ev_to_deallocate >= to_deallocate - deallocated_power: - ev_to_deallocate = to_deallocate - deallocated_power + ev_to_deallocate = min(ev_to_deallocate, to_deallocate - deallocated_power) tgt_power = evc.last_allocation - ev_to_deallocate if tgt_power < min_power: tgt_power = Power.zero()