Merge pull request #210297 from mweinelt/hass-matters

This commit is contained in:
Martin Weinelt 2023-01-14 21:34:56 +00:00 committed by GitHub
commit 76fed81234
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 280 additions and 1 deletions

View file

@ -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 ];
};
}

View file

@ -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 ];
};
}

View file

@ -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 ];
};
}

View file

@ -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;
};
}

View file

@ -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"

View file

@ -17933,6 +17933,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 { };

View file

@ -4311,6 +4311,10 @@ 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 { };
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 { };
@ -5910,6 +5914,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 { };
@ -9253,6 +9259,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 { };