1{
2 lib,
3 android-backup,
4 appdirs,
5 attrs,
6 buildPythonPackage,
7 click,
8 construct,
9 croniter,
10 cryptography,
11 defusedxml,
12 fetchPypi,
13 fetchpatch,
14 importlib-metadata,
15 micloud,
16 netifaces,
17 poetry-core,
18 pytest-asyncio,
19 pytest-mock,
20 pytestCheckHook,
21 pythonOlder,
22 pytz,
23 pyyaml,
24 tqdm,
25 zeroconf,
26}:
27
28buildPythonPackage rec {
29 pname = "python-miio";
30 version = "0.5.12";
31 format = "pyproject";
32
33 disabled = pythonOlder "3.7";
34
35 src = fetchPypi {
36 inherit pname version;
37 hash = "sha256-BJw1Gg3FO2R6WWKjkrpxDN4fTMTug5AIj0SNq1gEbBY=";
38 };
39
40 pythonRelaxDeps = [ "defusedxml" ];
41
42 build-system = [ poetry-core ];
43
44 patches = [
45 (fetchpatch {
46 # Fix pytest 7.2 compat
47 url = "https://github.com/rytilahti/python-miio/commit/67d9d771d04d51f5bd97f361ca1c15ae4a18c274.patch";
48 hash = "sha256-Os9vCSKyieCqHs63oX6gcLrtv1N7hbX5WvEurelEp8w=";
49 })
50 (fetchpatch {
51 # Python 3.13 compat
52 url = "https://github.com/rytilahti/python-miio/commit/0aa4df3ab1e47d564c8312016fbcfb3a9fc06c6c.patch";
53 hash = "sha256-Zydv3xqCliA/oAnjNmqh0vDrlZFPcTAIyW6vIZzijZY=";
54 })
55 ];
56
57 dependencies = [
58 android-backup
59 appdirs
60 attrs
61 click
62 construct
63 croniter
64 cryptography
65 defusedxml
66 micloud
67 netifaces
68 pytz
69 pyyaml
70 tqdm
71 zeroconf
72 ]
73 ++ lib.optionals (pythonOlder "3.8") [ importlib-metadata ];
74
75 nativeCheckInputs = [
76 pytest-asyncio
77 pytest-mock
78 pytestCheckHook
79 ];
80
81 pythonImportsCheck = [ "miio" ];
82
83 meta = with lib; {
84 description = "Python library for interfacing with Xiaomi smart appliances";
85 homepage = "https://github.com/rytilahti/python-miio";
86 license = licenses.gpl3Only;
87 maintainers = with maintainers; [ flyfloh ];
88 };
89}