1{ 2 lib, 3 aiofiles, 4 aiohttp, 5 aioshutil, 6 async-timeout, 7 buildPythonPackage, 8 dateparser, 9 fetchFromGitHub, 10 ffmpeg, 11 hatch-vcs, 12 hatchling, 13 ipython, 14 orjson, 15 packaging, 16 pillow, 17 platformdirs, 18 poetry-core, 19 py, 20 pydantic, 21 pyjwt, 22 pytest-aiohttp, 23 pytest-asyncio, 24 pytest-benchmark, 25 pytest-timeout, 26 pytest-xdist, 27 pytestCheckHook, 28 python-dotenv, 29 pythonOlder, 30 pytz, 31 termcolor, 32 typer, 33}: 34 35buildPythonPackage rec { 36 pname = "pyunifiprotect"; 37 version = "5.1.2"; 38 pyproject = true; 39 40 disabled = pythonOlder "3.9"; 41 42 src = fetchFromGitHub { 43 owner = "briis"; 44 repo = "pyunifiprotect"; 45 rev = "refs/tags/v${version}"; 46 hash = "sha256-DtQm6u3O0kdVJ23Ch+hJQ6HTOt5iAMdhCzC1K/oICWk="; 47 }; 48 49 env.SETUPTOOLS_SCM_PRETEND_VERSION = version; 50 51 postPatch = '' 52 substituteInPlace pyproject.toml \ 53 --replace-fail "--strict-markers -ra -Wd --ignore=.* --no-cov-on-fail --cov=pyunifiprotect --cov-append --maxfail=10 -n=auto" "" 54 ''; 55 56 build-system = [ 57 hatch-vcs 58 hatchling 59 ]; 60 61 dependencies = [ 62 aiofiles 63 aiohttp 64 aioshutil 65 dateparser 66 orjson 67 packaging 68 pillow 69 platformdirs 70 pydantic 71 pyjwt 72 pytz 73 typer 74 ] ++ typer.optional-dependencies.all ++ lib.optionals (pythonOlder "3.11") [ async-timeout ]; 75 76 passthru.optional-dependencies = { 77 shell = [ 78 ipython 79 python-dotenv 80 termcolor 81 ]; 82 }; 83 84 nativeCheckInputs = [ 85 ffmpeg # Required for command ffprobe 86 py 87 pytest-aiohttp 88 pytest-asyncio 89 pytest-benchmark 90 pytest-timeout 91 pytest-xdist 92 pytestCheckHook 93 ]; 94 95 pythonImportsCheck = [ "pyunifiprotect" ]; 96 97 pytestFlagsArray = [ "--benchmark-disable" ]; 98 99 meta = with lib; { 100 description = "Library for interacting with the Unifi Protect API"; 101 mainProgram = "unifi-protect"; 102 homepage = "https://github.com/briis/pyunifiprotect"; 103 changelog = "https://github.com/AngellusMortis/pyunifiprotect/releases/tag/v${version}"; 104 license = with licenses; [ mit ]; 105 maintainers = with maintainers; [ fab ]; 106 }; 107}