1{ lib
2, aiofiles
3, aiohttp
4, aioshutil
5, buildPythonPackage
6, dateparser
7, fetchFromGitHub
8, ipython
9, orjson
10, packaging
11, pillow
12, poetry-core
13, pydantic
14, pyjwt
15, pytest-aiohttp
16, pytest-asyncio
17, pytest-benchmark
18, pytest-timeout
19, pytest-xdist
20, pytestCheckHook
21, python-dotenv
22, pythonOlder
23, pytz
24, setuptools
25, termcolor
26, typer
27, ffmpeg
28}:
29
30buildPythonPackage rec {
31 pname = "pyunifiprotect";
32 version = "4.4.2";
33 format = "pyproject";
34
35 disabled = pythonOlder "3.9";
36
37 src = fetchFromGitHub {
38 owner = "briis";
39 repo = pname;
40 rev = "refs/tags/v${version}";
41 hash = "sha256-30nQ02UUXJHvHC+hWTWHsUeU83G8cOJHK+Tgo6AE5jc=";
42 };
43
44 postPatch = ''
45 substituteInPlace pyproject.toml \
46 --replace "--cov=pyunifiprotect --cov-append" ""
47 '';
48
49 nativeBuildInputs = [
50 setuptools
51 ];
52
53 propagatedBuildInputs = [
54 aiofiles
55 aiohttp
56 aioshutil
57 dateparser
58 orjson
59 packaging
60 pillow
61 pydantic
62 pyjwt
63 pytz
64 typer
65 ] ++ typer.optional-dependencies.all;
66
67 passthru.optional-dependencies = {
68 shell = [
69 ipython
70 python-dotenv
71 termcolor
72 ];
73 };
74
75 checkInputs = [
76 ffmpeg # Required for command ffprobe
77 pytest-aiohttp
78 pytest-asyncio
79 pytest-benchmark
80 pytest-timeout
81 pytest-xdist
82 pytestCheckHook
83 ];
84
85 pythonImportsCheck = [
86 "pyunifiprotect"
87 ];
88
89 pytestFlagsArray = [
90 "--benchmark-disable"
91 ];
92
93 meta = with lib; {
94 description = "Library for interacting with the Unifi Protect API";
95 homepage = "https://github.com/briis/pyunifiprotect";
96 changelog = "https://github.com/AngellusMortis/pyunifiprotect/releases/tag/v${version}";
97 license = with licenses; [ mit ];
98 maintainers = with maintainers; [ fab ];
99 };
100}