From 7991fc0740469b85b48dcde70d362c5f133875d7 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Thu, 12 Jan 2023 02:12:10 +0100 Subject: [PATCH 1/5] python3Packages.home-assistant-chip-clusters: init at 2022.12.0 --- .../home-assistant-chip-clusters/default.nix | 37 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 39 insertions(+) create mode 100644 pkgs/development/python-modules/home-assistant-chip-clusters/default.nix diff --git a/pkgs/development/python-modules/home-assistant-chip-clusters/default.nix b/pkgs/development/python-modules/home-assistant-chip-clusters/default.nix new file mode 100644 index 000000000000..0cf52ad3d08f --- /dev/null +++ b/pkgs/development/python-modules/home-assistant-chip-clusters/default.nix @@ -0,0 +1,37 @@ +{ lib +, buildPythonPackage +, fetchPypi +, dacite +}: + +buildPythonPackage rec { + pname = "home-assistant-chip-clusters"; + version = "2022.12.0"; + format = "wheel"; + + src = fetchPypi { + inherit format version; + pname = "home_assistant_chip_clusters"; + dist = "py3"; + python = "py3"; + hash = "sha256-zo54lRNyKXCCUUoYIiZmHZMqISim9QKEOnFbM/iBRqE="; + }; + + propagatedBuildInputs = [ + dacite + ]; + + pythonImportsCheck = [ + "chip.clusters" + ]; + + doCheck = false; # no tests + + meta = with lib; { + description = "Python-base APIs and tools for CHIP"; + homepage = "https://github.com/home-assistant-libs/chip-wheels"; + license = licenses.asl20; + maintainers = teams.home-assistant.members; + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 0fc94994a679..2832d26d069c 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4297,6 +4297,8 @@ self: super: with self; { home-assistant-bluetooth = callPackage ../development/python-modules/home-assistant-bluetooth { }; + home-assistant-chip-clusters = callPackage ../development/python-modules/home-assistant-chip-clusters { }; + homeassistant-pyozw = callPackage ../development/python-modules/homeassistant-pyozw { }; homeconnect = callPackage ../development/python-modules/homeconnect { }; From 76e064820342405771ef6336b30f70f59457e1a7 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Thu, 12 Jan 2023 02:27:07 +0100 Subject: [PATCH 2/5] python3Packages.mobly: init at 1.12 --- .../python-modules/mobly/default.nix | 51 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 53 insertions(+) create mode 100644 pkgs/development/python-modules/mobly/default.nix diff --git a/pkgs/development/python-modules/mobly/default.nix b/pkgs/development/python-modules/mobly/default.nix new file mode 100644 index 000000000000..76f4e4fd9f29 --- /dev/null +++ b/pkgs/development/python-modules/mobly/default.nix @@ -0,0 +1,51 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub + +# runtime +, portpicker +, pyserial +, pyyaml +, timeout-decorator +, typing-extensions + +# tests +, procps +, pytestCheckHook +, pytz +}: + +buildPythonPackage rec { + pname = "mobly"; + version = "1.12"; + format = "setuptools"; + + src = fetchFromGitHub { + owner = "google"; + repo = "mobly"; + rev = "refs/tags/${version}"; + hash = "sha256-HAXm0/h5jbgVuIwP7IZ1ffUs92gcpOPiM2VgT38r8Go="; + }; + + propagatedBuildInputs = [ + portpicker + pyserial + pyyaml + timeout-decorator + typing-extensions + ]; + + checkInputs = [ + procps + pytestCheckHook + pytz + ]; + + meta = with lib; { + changelog = "https://github.com/google/mobly/blob/"; + description = "Automation framework for special end-to-end test cases"; + homepage = "https://github.com/google/mobly"; + license = licenses.asl20; + maintainers = with maintainers; [ hexa ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 2832d26d069c..20cf8fcdce23 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -5888,6 +5888,8 @@ self: super: with self; { moat-ble = callPackage ../development/python-modules/moat-ble { }; + mobly = callPackage ../development/python-modules/mobly { }; + mocket = callPackage ../development/python-modules/mocket { }; mock = callPackage ../development/python-modules/mock { }; From 2ec1b3609aed22f2efe58769acdad20dfeaac05d Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Thu, 12 Jan 2023 03:37:04 +0100 Subject: [PATCH 3/5] python3Packages.home-assistant-chip-core: init at 2022.12.0 --- .../home-assistant-chip-core/default.nix | 93 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 95 insertions(+) create mode 100644 pkgs/development/python-modules/home-assistant-chip-core/default.nix diff --git a/pkgs/development/python-modules/home-assistant-chip-core/default.nix b/pkgs/development/python-modules/home-assistant-chip-core/default.nix new file mode 100644 index 000000000000..1394eef5cbdb --- /dev/null +++ b/pkgs/development/python-modules/home-assistant-chip-core/default.nix @@ -0,0 +1,93 @@ +{ lib +, stdenv +, buildPythonPackage +, fetchPypi +, pythonOlder + +# build +, autoPatchelfHook + +# runtime +, openssl_1_1 + +# propagates +, coloredlogs +, construct +, dacite +, rich +, pyyaml +, ipdb +, deprecation +, mobly +, pygobject3 +}: + +buildPythonPackage rec { + pname = "home-assistant-chip-core"; + version = "2022.12.0"; + format = "wheel"; + + disabled = pythonOlder "3.7"; + + src = let + system = { + "aarch64-linux" = { + name = "aarch64"; + hash = "sha256-oNqrvbzXeXpMG3v9RK6kppONH4n7xLVaJCEFXxVj2jE="; + }; + "x86_64-linux" = { + name = "x86_64"; + hash = "sha256-S5n1MUig8ZDSLgWeVmu+5qLZ4kfHQUC9qZcVfM8rPvw="; + }; + }.${stdenv.system} or (throw "Unsupported system"); + in fetchPypi { + pname = "home_assistant_chip_core"; + inherit version format; + dist = "cp37"; + python = "cp37"; + abi = "abi3"; + platform = "manylinux_2_31_${system.name}"; + hash = system.hash; + }; + + nativeBuildInputs = [ + autoPatchelfHook + ]; + + buildInputs = [ + openssl_1_1 + ]; + + propagatedBuildInputs = [ + coloredlogs + construct + dacite + rich + pyyaml + ipdb + deprecation + mobly + pygobject3 + ]; + + pythonImportsCheck = [ + "chip" + "chip.ble" + # https://github.com/project-chip/connectedhomeip/pull/24376 + #"chip.configuration" + "chip.discovery" + "chip.native" + "chip.storage" + ]; + + doCheck = false; # no tests + + meta = with lib; { + description = "Python-base APIs and tools for CHIP"; + homepage = "https://github.com/home-assistant-libs/chip-wheels"; + license = licenses.asl20; + maintainers = teams.home-assistant.members; + platforms = platforms.linux; + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 20cf8fcdce23..d29101025ae0 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4299,6 +4299,8 @@ self: super: with self; { home-assistant-chip-clusters = callPackage ../development/python-modules/home-assistant-chip-clusters { }; + home-assistant-chip-core = callPackage ../development/python-modules/home-assistant-chip-core { }; + homeassistant-pyozw = callPackage ../development/python-modules/homeassistant-pyozw { }; homeconnect = callPackage ../development/python-modules/homeconnect { }; From b2a31645aad4f300076baf1b37ef20543de1d8d3 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Thu, 12 Jan 2023 04:24:14 +0100 Subject: [PATCH 4/5] python3Packages.python-matter-server: init at 1.0.8 --- .../python-matter-server/default.nix | 86 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + pkgs/top-level/python-packages.nix | 2 + 3 files changed, 90 insertions(+) create mode 100644 pkgs/development/python-modules/python-matter-server/default.nix diff --git a/pkgs/development/python-modules/python-matter-server/default.nix b/pkgs/development/python-modules/python-matter-server/default.nix new file mode 100644 index 000000000000..06d96a6d6dfc --- /dev/null +++ b/pkgs/development/python-modules/python-matter-server/default.nix @@ -0,0 +1,86 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pythonOlder + +# build +, setuptools + +# propagates +, aiohttp +, aiorun +, coloredlogs +, dacite +, orjson +, home-assistant-chip-clusters + +# optionals +, home-assistant-chip-core + +# tests +, python +, pytest +, pytest-aiohttp +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "python-matter-server"; + version = "1.0.8"; + format = "pyproject"; + + disabled = pythonOlder "3.9"; + + src = fetchFromGitHub { + owner = "home-assistant-libs"; + repo = "python-matter-server"; + rev = "refs/tags/${version}"; + hash = "sha256-7w2Gg70Sl84zs55z6Hg8JPtkY9dNzyb1iBC6O4ulr1M="; + }; + + nativeBuildInputs = [ + setuptools + ]; + + propagatedBuildInputs = [ + aiohttp + aiorun + coloredlogs + dacite + orjson + home-assistant-chip-clusters + ]; + + passthru.optional-dependencies = { + server = [ + home-assistant-chip-core + ]; + }; + + checkInputs = [ + pytest-aiohttp + pytestCheckHook + ] + ++ lib.flatten (builtins.attrValues passthru.optional-dependencies); + + preCheck = let + pythonEnv = python.withPackages (_: propagatedBuildInputs ++ checkInputs ++ [ pytest ]); + in + '' + export PYTHONPATH=${pythonEnv}/${python.sitePackages} + ''; + + pytestFlagsArray = [ + # Upstream theymselves limit the test scope + # https://github.com/home-assistant-libs/python-matter-server/blob/main/.github/workflows/test.yml#L65 + "tests/server" + ]; + + meta = with lib; { + changelog = "https://github.com/home-assistant-libs/python-matter-server/releases/tag/${version}"; + description = "Python server to interact with Matter"; + homepage = "https://github.com/home-assistant-libs/python-matter-server"; + license = licenses.asl20; + maintainers = teams.home-assistant.members; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d1034c5c363c..726005ac20aa 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17845,6 +17845,8 @@ with pkgs; python-language-server = callPackage ../development/dotnet-modules/python-language-server { }; + python-matter-server = with python3Packages; toPythonApplication python-matter-server; + minify = callPackage ../development/web/minify { }; minizinc = callPackage ../development/tools/minizinc { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index d29101025ae0..9463b4734a26 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -9227,6 +9227,8 @@ self: super: with self; { python-markdown-math = callPackage ../development/python-modules/python-markdown-math { }; + python-matter-server = callPackage ../development/python-modules/python-matter-server { }; + python-miio = callPackage ../development/python-modules/python-miio { }; python-mimeparse = callPackage ../development/python-modules/python-mimeparse { }; From a078ed88c25f486f7ae72cbeec300009f634aac5 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Thu, 12 Jan 2023 04:25:06 +0100 Subject: [PATCH 5/5] home-assistant: update component packages --- pkgs/servers/home-assistant/component-packages.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/servers/home-assistant/component-packages.nix b/pkgs/servers/home-assistant/component-packages.nix index 46d10548161b..610f5ff25eca 100644 --- a/pkgs/servers/home-assistant/component-packages.nix +++ b/pkgs/servers/home-assistant/component-packages.nix @@ -2020,8 +2020,9 @@ "matter" = ps: with ps; [ aiohttp-cors fnvhash + python-matter-server sqlalchemy - ]; # missing inputs: python-matter-server + ]; "maxcube" = ps: with ps; [ maxcube-api ]; @@ -4439,6 +4440,7 @@ "mailgun" "manual" "manual_mqtt" + "matter" "maxcube" "mazda" "meater"