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 pydantic-extra-types,
24 pyjwt,
25 rich,
26 typer,
27 yarl,
28
29 # tests
30 aiosqlite,
31 asttokens,
32 ffmpeg,
33 pytest-asyncio,
34 pytest-benchmark,
35 pytest-cov-stub,
36 pytest-timeout,
37 pytest-xdist,
38 pytestCheckHook,
39}:
40
41buildPythonPackage rec {
42 pname = "uiprotect";
43 version = "7.21.1";
44 pyproject = true;
45
46 disabled = pythonOlder "3.10";
47
48 src = fetchFromGitHub {
49 owner = "uilibs";
50 repo = "uiprotect";
51 tag = "v${version}";
52 hash = "sha256-8OxEEQuCMKHTYIpa9pfgyAhgkCMy6wpvJDMcckbV8wY=";
53 };
54
55 build-system = [ poetry-core ];
56
57 pythonRelaxDeps = [
58 "aiofiles"
59 "pydantic"
60 ];
61
62 dependencies = [
63 aiofiles
64 aiohttp
65 aioshutil
66 async-timeout
67 convertertools
68 dateparser
69 orjson
70 packaging
71 pillow
72 platformdirs
73 propcache
74 pydantic
75 pydantic-extra-types
76 pyjwt
77 rich
78 typer
79 yarl
80 ];
81
82 nativeCheckInputs = [
83 aiosqlite
84 asttokens
85 ffmpeg # Required for command ffprobe
86 pytest-asyncio
87 pytest-benchmark
88 pytest-cov-stub
89 pytest-timeout
90 pytest-xdist
91 pytestCheckHook
92 ];
93
94 pytestFlags = [ "--benchmark-disable" ];
95
96 disabledTests = [
97 # https://127.0.0.1 vs https://127.0.0.1:0
98 "test_base_url"
99 "test_bootstrap"
100 ];
101
102 disabledTestPaths = [
103 # hangs the test suite
104 "tests/test_api_ws.py"
105 ];
106
107 pythonImportsCheck = [ "uiprotect" ];
108
109 meta = with lib; {
110 description = "Python API for UniFi Protect (Unofficial)";
111 homepage = "https://github.com/uilibs/uiprotect";
112 changelog = "https://github.com/uilibs/uiprotect/blob/${src.tag}/CHANGELOG.md";
113 license = licenses.mit;
114 maintainers = with maintainers; [ hexa ];
115 };
116}