1{ lib
2, android-backup
3, appdirs
4, attrs
5, buildPythonPackage
6, click
7, construct
8, croniter
9, cryptography
10, defusedxml
11, fetchPypi
12, importlib-metadata
13, micloud
14, netifaces
15, poetry-core
16, pytest-mock
17, pytestCheckHook
18, pythonOlder
19, pytz
20, pyyaml
21, tqdm
22, zeroconf
23}:
24
25
26buildPythonPackage rec {
27 pname = "python-miio";
28 version = "0.5.12";
29 format = "pyproject";
30
31 disabled = pythonOlder "3.7";
32
33 src = fetchPypi {
34 inherit pname version;
35 hash = "sha256-BJw1Gg3FO2R6WWKjkrpxDN4fTMTug5AIj0SNq1gEbBY=";
36 };
37
38 nativeBuildInputs = [
39 poetry-core
40 ];
41
42 propagatedBuildInputs = [
43 android-backup
44 appdirs
45 attrs
46 click
47 construct
48 croniter
49 cryptography
50 defusedxml
51 micloud
52 netifaces
53 pytz
54 pyyaml
55 tqdm
56 zeroconf
57 ] ++ lib.optionals (pythonOlder "3.8") [
58 importlib-metadata
59 ];
60
61 checkInputs = [
62 pytest-mock
63 pytestCheckHook
64 ];
65
66 postPatch = ''
67 substituteInPlace pyproject.toml \
68 --replace 'defusedxml = "^0"' 'defusedxml = "*"'
69 # Will be fixed with the next release, https://github.com/rytilahti/python-miio/pull/1378
70 substituteInPlace miio/integrations/vacuum/roborock/vacuum_cli.py \
71 --replace "resultcallback" "result_callback"
72 '';
73
74 pythonImportsCheck = [
75 "miio"
76 ];
77
78 meta = with lib; {
79 description = "Python library for interfacing with Xiaomi smart appliances";
80 homepage = "https://github.com/rytilahti/python-miio";
81 license = licenses.gpl3Only;
82 maintainers = with maintainers; [ flyfloh ];
83 };
84}