From 200653e275c10ea7a1df9bf5c720d8beab144852 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Apr 2024 18:47:49 +0000 Subject: [PATCH 1/7] Bump the optional group with 16 updates Updates the requirements on [pydoclint](https://github.com/jsh9/pydoclint), [polars](https://github.com/pola-rs/polars), [black](https://github.com/psf/black), [markdown](https://github.com/Python-Markdown/markdown), [mkdocs-material](https://github.com/squidfunk/mkdocs-material), [mkdocstrings[python]](https://github.com/mkdocstrings/mkdocstrings), [frequenz-repo-config[lib]](https://github.com/frequenz-floss/frequenz-repo-config-python), [mypy](https://github.com/python/mypy), [types-markdown](https://github.com/python/typeshed), [types-setuptools](https://github.com/python/typeshed), [pylint](https://github.com/pylint-dev/pylint), [frequenz-repo-config[extra-lint-examples]](https://github.com/frequenz-floss/frequenz-repo-config-python), [pytest-mock](https://github.com/pytest-dev/pytest-mock), [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio), [async-solipsism](https://github.com/bmerry/async-solipsism) and [hypothesis](https://github.com/HypothesisWorks/hypothesis) to permit the latest version. Updates `pydoclint` from 0.3.8 to 0.4.1 - [Release notes](https://github.com/jsh9/pydoclint/releases) - [Changelog](https://github.com/jsh9/pydoclint/blob/main/CHANGELOG.md) - [Commits](https://github.com/jsh9/pydoclint/compare/0.3.8...0.4.1) Updates `polars` from 0.20.2 to 0.20.18 - [Release notes](https://github.com/pola-rs/polars/releases) - [Commits](https://github.com/pola-rs/polars/compare/py-0.20.2...py-0.20.18) Updates `black` from 24.1.1 to 24.3.0 - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](https://github.com/psf/black/compare/24.1.1...24.3.0) Updates `markdown` from 3.5.1 to 3.6 - [Release notes](https://github.com/Python-Markdown/markdown/releases) - [Changelog](https://github.com/Python-Markdown/markdown/blob/master/docs/changelog.md) - [Commits](https://github.com/Python-Markdown/markdown/compare/3.5.1...3.6) Updates `mkdocs-material` from 9.5.3 to 9.5.16 - [Release notes](https://github.com/squidfunk/mkdocs-material/releases) - [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG) - [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.5.3...9.5.16) Updates `mkdocstrings[python]` from 0.24.0 to 0.24.1 - [Release notes](https://github.com/mkdocstrings/mkdocstrings/releases) - [Changelog](https://github.com/mkdocstrings/mkdocstrings/blob/main/CHANGELOG.md) - [Commits](https://github.com/mkdocstrings/mkdocstrings/compare/0.24.0...0.24.1) Updates `frequenz-repo-config[lib]` from 0.7.4 to 0.9.1 - [Release notes](https://github.com/frequenz-floss/frequenz-repo-config-python/releases) - [Changelog](https://github.com/frequenz-floss/frequenz-repo-config-python/blob/v0.x.x/RELEASE_NOTES.md) - [Commits](https://github.com/frequenz-floss/frequenz-repo-config-python/compare/v0.7.4...v0.9.1) Updates `mypy` from 1.8.0 to 1.9.0 - [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md) - [Commits](https://github.com/python/mypy/compare/v1.8.0...1.9.0) Updates `types-markdown` from 3.5.0.20240129 to 3.6.0.20240316 - [Commits](https://github.com/python/typeshed/commits) Updates `types-setuptools` from 69.0.0.20240125 to 69.2.0.20240317 - [Commits](https://github.com/python/typeshed/commits) Updates `pylint` from 3.0.3 to 3.1.0 - [Release notes](https://github.com/pylint-dev/pylint/releases) - [Commits](https://github.com/pylint-dev/pylint/compare/v3.0.3...v3.1.0) Updates `frequenz-repo-config[extra-lint-examples]` from 0.7.4 to 0.9.1 - [Release notes](https://github.com/frequenz-floss/frequenz-repo-config-python/releases) - [Changelog](https://github.com/frequenz-floss/frequenz-repo-config-python/blob/v0.x.x/RELEASE_NOTES.md) - [Commits](https://github.com/frequenz-floss/frequenz-repo-config-python/compare/v0.7.4...v0.9.1) Updates `pytest-mock` from 3.12.0 to 3.14.0 - [Release notes](https://github.com/pytest-dev/pytest-mock/releases) - [Changelog](https://github.com/pytest-dev/pytest-mock/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest-mock/compare/v3.12.0...v3.14.0) Updates `pytest-asyncio` from 0.23.3 to 0.23.6 - [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases) - [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.23.3...v0.23.6) Updates `async-solipsism` from 0.5 to 0.6 - [Commits](https://github.com/bmerry/async-solipsism/compare/0.5...0.6) Updates `hypothesis` from 6.92.1 to 6.100.0 - [Release notes](https://github.com/HypothesisWorks/hypothesis/releases) - [Commits](https://github.com/HypothesisWorks/hypothesis/compare/hypothesis-python-6.92.1...hypothesis-python-6.100.0) --- updated-dependencies: - dependency-name: pydoclint dependency-type: direct:production update-type: version-update:semver-minor dependency-group: optional - dependency-name: polars dependency-type: direct:production update-type: version-update:semver-patch dependency-group: optional - dependency-name: black dependency-type: direct:production update-type: version-update:semver-minor dependency-group: optional - dependency-name: markdown dependency-type: direct:production update-type: version-update:semver-minor dependency-group: optional - dependency-name: mkdocs-material dependency-type: direct:production update-type: version-update:semver-patch dependency-group: optional - dependency-name: mkdocstrings[python] dependency-type: direct:production update-type: version-update:semver-patch dependency-group: optional - dependency-name: frequenz-repo-config[lib] dependency-type: direct:production update-type: version-update:semver-minor dependency-group: optional - dependency-name: mypy dependency-type: direct:production update-type: version-update:semver-minor dependency-group: optional - dependency-name: types-markdown dependency-type: direct:production update-type: version-update:semver-minor dependency-group: optional - dependency-name: types-setuptools dependency-type: direct:production update-type: version-update:semver-minor dependency-group: optional - dependency-name: pylint dependency-type: direct:production update-type: version-update:semver-minor dependency-group: optional - dependency-name: frequenz-repo-config[extra-lint-examples] dependency-type: direct:production update-type: version-update:semver-minor dependency-group: optional - dependency-name: pytest-mock dependency-type: direct:production update-type: version-update:semver-minor dependency-group: optional - dependency-name: pytest-asyncio dependency-type: direct:production update-type: version-update:semver-patch dependency-group: optional - dependency-name: async-solipsism dependency-type: direct:production update-type: version-update:semver-minor dependency-group: optional - dependency-name: hypothesis dependency-type: direct:production update-type: version-update:semver-minor dependency-group: optional ... Signed-off-by: dependabot[bot] # This is the commit message #2: # fixup! Bump the optional group with 17 updates --- pyproject.toml | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 28da8fa3a..db7714014 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", + "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]", From c0878292ad0aab43607c5dd01c8d6523f54fb1d3 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Tue, 9 Apr 2024 11:10:38 -0300 Subject: [PATCH 2/7] Use min() instead of if to calculate ev_to_deallocate This accepts a suggestion made by pylint. Signed-off-by: Leandro Lucarella --- .../_ev_charger_manager/_ev_charger_manager.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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() From 483b5ebe3e1d39b5f78b70b0dc839e3a0652c4af Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Wed, 10 Apr 2024 10:26:49 -0300 Subject: [PATCH 3/7] Disable `too-many-return-statements` pylint check This is part of the upgrade from repo-config v0.7 to v0.8. See: https://github.com/frequenz-floss/frequenz-repo-config-python/releases/tag/v0.8.0 Signed-off-by: Leandro Lucarella --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index db7714014..18c27df54 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", From 00e4f100cc750993cab6867df6d77c3c32a2d7c7 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Wed, 10 Apr 2024 10:35:52 -0300 Subject: [PATCH 4/7] ci: Support using git URLs in test-installation job This is part of the upgrade of repo-config from v0.8 to v0.9. See: https://github.com/frequenz-floss/frequenz-repo-config-python/releases/tag/v0.9.0 Signed-off-by: Leandro Lucarella --- .github/containers/test-installation/Dockerfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 && \ From 5082cd7ce98e2487a3fb13ceb50eba8cdf704243 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Wed, 10 Apr 2024 10:36:25 -0300 Subject: [PATCH 5/7] Upgrade `pytest` to v8 Now that repo-config is upgrade to v0.9, we can also upgrade `pytest`. See: https://github.com/frequenz-floss/frequenz-repo-config-python/releases/tag/v0.9.0 Signed-off-by: Leandro Lucarella --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 18c27df54..4ccd43d9a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,7 +87,7 @@ dev-pylint = [ "frequenz-sdk[dev-mkdocs,dev-noxfile,dev-pytest]", ] dev-pytest = [ - "pytest == 7.4.4", + "pytest == 8.1.1", "frequenz-repo-config[extra-lint-examples] == 0.9.1", "pytest-mock == 3.14.0", "pytest-asyncio == 0.23.6", From 2cd982e0a37fe3451bdeb49c5b9b7d7965404c13 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Wed, 10 Apr 2024 10:37:38 -0300 Subject: [PATCH 6/7] Remove `mypy` exclusion for `sybil` Now that `pytest` is upgraded to v8, `sybil` will be upgraded to v6, which provides type information, so we can remove the exclusion from `mypy`. This is part of the upgrade of repo-config from v0.8 to v0.9. See: https://github.com/frequenz-floss/frequenz-repo-config-python/releases/tag/v0.9.0 Signed-off-by: Leandro Lucarella --- pyproject.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4ccd43d9a..9290eca8b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -192,8 +192,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 From 174af1f64df57541ea43e46bf22d55100d1d29eb Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Wed, 10 Apr 2024 10:37:56 -0300 Subject: [PATCH 7/7] Remove `pylint` checks also done by `flake8` This is part of the upgrade of repo-config from v0.8 to v0.9. See: https://github.com/frequenz-floss/frequenz-repo-config-python/releases/tag/v0.9.0 Signed-off-by: Leandro Lucarella --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 9290eca8b..63a85a4af 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -152,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",