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