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