1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6
7 # build-system
8 poetry-core,
9
10 # dependencies
11 aiofiles,
12 aiohttp,
13 aioshutil,
14 async-timeout,
15 convertertools,
16 dateparser,
17 orjson,
18 packaging,
19 pillow,
20 platformdirs,
21 propcache,
22 pydantic,
23 pyjwt,
24 rich,
25 typer,
26 yarl,
27
28 # tests
29 aiosqlite,
30 asttokens,
31 ffmpeg,
32 pytest-asyncio,
33 pytest-benchmark,
34 pytest-cov-stub,
35 pytest-timeout,
36 pytest-xdist,
37 pytestCheckHook,
38}:
39
40buildPythonPackage rec {
41 pname = "uiprotect";
42 version = "6.4.0";
43 pyproject = true;
44
45 disabled = pythonOlder "3.10";
46
47 src = fetchFromGitHub {
48 owner = "uilibs";
49 repo = "uiprotect";
50 rev = "refs/tags/v${version}";
51 hash = "sha256-+BHxcwQhx4lOqS0ATk1PjLbyTu7xQakM3HMrydXeGUc=";
52 };
53
54 build-system = [ poetry-core ];
55
56 pythonRelaxDeps = [
57 "aiofiles"
58 "pydantic"
59 ];
60
61 dependencies = [
62 aiofiles
63 aiohttp
64 aioshutil
65 async-timeout
66 convertertools
67 dateparser
68 orjson
69 packaging
70 pillow
71 platformdirs
72 propcache
73 pydantic
74 pyjwt
75 rich
76 typer
77 yarl
78 ];
79
80 nativeCheckInputs = [
81 aiosqlite
82 asttokens
83 ffmpeg # Required for command ffprobe
84 pytest-asyncio
85 pytest-benchmark
86 pytest-cov-stub
87 pytest-timeout
88 pytest-xdist
89 pytestCheckHook
90 ];
91
92 pytestFlagsArray = [ "--benchmark-disable" ];
93
94 disabledTests = [
95 # https://127.0.0.1 vs https://127.0.0.1:0
96 "test_base_url"
97 "test_bootstrap"
98 ];
99
100 pythonImportsCheck = [ "uiprotect" ];
101
102 meta = with lib; {
103 description = "Python API for UniFi Protect (Unofficial)";
104 homepage = "https://github.com/uilibs/uiprotect";
105 changelog = "https://github.com/uilibs/uiprotect/blob/${src.rev}/CHANGELOG.md";
106 license = licenses.mit;
107 maintainers = with maintainers; [ hexa ];
108 };
109}