1{
2 lib,
3 stdenv,
4 aiohttp,
5 aioresponses,
6 aiosqlite,
7 async-timeout,
8 attrs,
9 buildPythonPackage,
10 crccheck,
11 cryptography,
12 fetchFromGitHub,
13 freezegun,
14 frozendict,
15 jsonschema,
16 pyserial-asyncio,
17 pytest-asyncio_0,
18 pytest-timeout,
19 pytestCheckHook,
20 pythonOlder,
21 setuptools,
22 typing-extensions,
23 voluptuous,
24}:
25
26buildPythonPackage rec {
27 pname = "zigpy";
28 version = "0.83.0";
29 pyproject = true;
30
31 src = fetchFromGitHub {
32 owner = "zigpy";
33 repo = "zigpy";
34 tag = version;
35 hash = "sha256-rgri4aga8qTlcURypCHY1YjClz5lpQpwxd3cAG2VoOo=";
36 };
37
38 postPatch = ''
39 substituteInPlace pyproject.toml \
40 --replace-fail '"setuptools-git-versioning<2"' "" \
41 --replace-fail 'dynamic = ["version"]' 'version = "${version}"'
42 '';
43
44 build-system = [ setuptools ];
45
46 dependencies = [
47 attrs
48 aiohttp
49 aiosqlite
50 crccheck
51 cryptography
52 frozendict
53 jsonschema
54 pyserial-asyncio
55 typing-extensions
56 voluptuous
57 ]
58 ++ lib.optionals (pythonOlder "3.11") [ async-timeout ];
59
60 nativeCheckInputs = [
61 aioresponses
62 freezegun
63 pytest-asyncio_0
64 pytest-timeout
65 pytestCheckHook
66 ];
67
68 disabledTests = [
69 # assert quirked.quirk_metadata.quirk_location.endswith("zigpy/tests/test_quirks_v2.py]-line:104") is False
70 "test_quirks_v2"
71 ]
72 ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86_64) [
73 "test_periodic_scan_priority"
74 ];
75
76 disabledTestPaths = [
77 # Tests require network access
78 "tests/ota/test_ota_providers.py"
79 # All tests fail to shutdown thread during teardown
80 "tests/ota/test_ota_matching.py"
81 ];
82
83 pythonImportsCheck = [
84 "zigpy.application"
85 "zigpy.config"
86 "zigpy.exceptions"
87 "zigpy.types"
88 "zigpy.zcl"
89 ];
90
91 meta = with lib; {
92 description = "Library implementing a ZigBee stack";
93 homepage = "https://github.com/zigpy/zigpy";
94 changelog = "https://github.com/zigpy/zigpy/releases/tag/${version}";
95 license = licenses.gpl3Plus;
96 maintainers = with maintainers; [ mvnetbiz ];
97 platforms = platforms.linux;
98 };
99}