From 4ba87d85487b8954ef00fd532e0175b96e879090 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Thu, 22 Apr 2021 22:22:54 +0200 Subject: [PATCH 1/3] python3Packages.aiopvpc: init at 2.0.2 --- .../python-modules/aiopvpc/default.nix | 66 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 68 insertions(+) create mode 100644 pkgs/development/python-modules/aiopvpc/default.nix diff --git a/pkgs/development/python-modules/aiopvpc/default.nix b/pkgs/development/python-modules/aiopvpc/default.nix new file mode 100644 index 000000000000..489ca5d6f6fb --- /dev/null +++ b/pkgs/development/python-modules/aiopvpc/default.nix @@ -0,0 +1,66 @@ +{ lib +, aiohttp +, async-timeout +, buildPythonPackage +, fetchFromGitHub +, fetchpatch +, poetry-core +, pytest-asyncio +, pytest-timeout +, pytestCheckHook +, pythonOlder +, pytz +}: + +buildPythonPackage rec { + pname = "aiopvpc"; + version = "2.0.2"; + disabled = pythonOlder "3.7"; + format = "pyproject"; + + src = fetchFromGitHub { + owner = "azogue"; + repo = pname; + rev = "v${version}"; + sha256 = "1ajs4kbdlfn4h7f3d6lwkp4yl1rl7zyvj997nhsz93jjwxbajkpv"; + }; + + nativeBuildInputs = [ + poetry-core + ]; + + propagatedBuildInputs = [ + aiohttp + pytz + async-timeout + ]; + + checkInputs = [ + pytest-asyncio + pytest-timeout + pytestCheckHook + ]; + + patches = [ + # Switch to poetry-core, https://github.com/azogue/aiopvpc/pull/10 + (fetchpatch { + name = "use-peotry-core.patch"; + url = "https://github.com/azogue/aiopvpc/commit/4bc2740ffd485a60acf579b4f3eb5ee6a353245c.patch"; + sha256 = "0ynj7pqq3akdvdrvqcwnnslay3mn1q92qhk8fg95ppflzscixli6"; + }) + ]; + + postPatch = '' + substituteInPlace pytest.ini --replace \ + " --cov --cov-report term --cov-report html" "" + ''; + + pythonImportsCheck = [ "aiopvpc" ]; + + meta = with lib; { + description = "Python module to download Spanish electricity hourly prices (PVPC)"; + homepage = "https://github.com/azogue/aiopvpc"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index f22df1c35d93..ed458b5166cc 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -319,6 +319,8 @@ in { aiopulse = callPackage ../development/python-modules/aiopulse { }; + aiopvpc = callPackage ../development/python-modules/aiopvpc { }; + aiopylgtv = callPackage ../development/python-modules/aiopylgtv { }; aiorecollect = callPackage ../development/python-modules/aiorecollect { }; From 812b801c8aef010347bb0b1e4cd7298697aecca3 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Thu, 22 Apr 2021 22:23:48 +0200 Subject: [PATCH 2/3] home-assistant: update component-packages --- pkgs/servers/home-assistant/component-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/servers/home-assistant/component-packages.nix b/pkgs/servers/home-assistant/component-packages.nix index 4d86e743d151..4646d6efa970 100644 --- a/pkgs/servers/home-assistant/component-packages.nix +++ b/pkgs/servers/home-assistant/component-packages.nix @@ -653,7 +653,7 @@ "pushover" = ps: with ps; [ pushover-complete ]; "pushsafer" = ps: with ps; [ ]; "pvoutput" = ps: with ps; [ jsonpath xmltodict ]; - "pvpc_hourly_pricing" = ps: with ps; [ ]; # missing inputs: aiopvpc + "pvpc_hourly_pricing" = ps: with ps; [ aiopvpc ]; "pyload" = ps: with ps; [ ]; "python_script" = ps: with ps; [ restrictedpython ]; "qbittorrent" = ps: with ps; [ ]; # missing inputs: python-qbittorrent From a0a064afa1f44ba435afeae14bca539165a6ef49 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Thu, 22 Apr 2021 22:24:39 +0200 Subject: [PATCH 3/3] home-assistant: enable pvpc_hourly_pricing tests --- pkgs/servers/home-assistant/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/servers/home-assistant/default.nix b/pkgs/servers/home-assistant/default.nix index ea9a7f5d150c..95d1bd529c32 100644 --- a/pkgs/servers/home-assistant/default.nix +++ b/pkgs/servers/home-assistant/default.nix @@ -318,6 +318,7 @@ in with py.pkgs; buildPythonApplication rec { "prometheus" "proximity" "push" + "pvpc_hourly_pricing" "python_script" "random" "recorder"