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 importlib-resources,
15 jsonschema,
16 pycryptodome,
17 pyserial-asyncio,
18 pytest-asyncio,
19 pytest-timeout,
20 pytestCheckHook,
21 pythonOlder,
22 setuptools,
23 typing-extensions,
24 voluptuous,
25}:
26
27buildPythonPackage rec {
28 pname = "zigpy";
29 version = "0.64.0";
30 pyproject = true;
31
32 disabled = pythonOlder "3.8";
33
34 src = fetchFromGitHub {
35 owner = "zigpy";
36 repo = "zigpy";
37 rev = "refs/tags/${version}";
38 hash = "sha256-4p/CUAZQLiADWzjXMOeYUX0OJgZczHrI2/sVRuXiFSI=";
39 };
40
41 postPatch = ''
42 substituteInPlace pyproject.toml \
43 --replace-fail '"setuptools-git-versioning<2"' "" \
44 --replace-fail 'dynamic = ["version"]' 'version = "${version}"'
45 '';
46
47 build-system = [ setuptools ];
48
49 dependencies =
50 [
51 attrs
52 aiohttp
53 aiosqlite
54 crccheck
55 cryptography
56 jsonschema
57 pyserial-asyncio
58 typing-extensions
59 pycryptodome
60 voluptuous
61 ]
62 ++ lib.optionals (pythonOlder "3.9") [ importlib-resources ]
63 ++ lib.optionals (pythonOlder "3.11") [ async-timeout ];
64
65 nativeCheckInputs = [
66 aioresponses
67 freezegun
68 pytest-asyncio
69 pytest-timeout
70 pytestCheckHook
71 ];
72
73 disabledTests = [
74 # assert quirked.quirk_metadata.quirk_location.endswith("zigpy/tests/test_quirks_v2.py]-line:104") is False
75 "test_quirks_v2"
76 ] ++ lib.optionals (stdenv.isLinux && stdenv.isx86_64) [ "test_periodic_scan_priority" ];
77
78 disabledTestPaths = [
79 # Tests require network access
80 "tests/ota/test_ota_providers.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}