summary refs log tree commit diff
path: root/pkgs/development/python-modules/pyunifiprotect/default.nix
blob: be333ee9d04523a7a94ccec584cdeb4ea5e10c03 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
{ lib
, aiohttp
, aioshutil
, buildPythonPackage
, fetchFromGitHub
, packaging
, pillow
, poetry-core
, pydantic
, pyjwt
, pytest-aiohttp
, pytest-asyncio
, pytest-benchmark
, pytest-timeout
, pytest-xdist
, pytestCheckHook
, python-dotenv
, pythonOlder
, pytz
, typer
}:

buildPythonPackage rec {
  pname = "pyunifiprotect";
  version = "3.7.0";
  format = "pyproject";

  disabled = pythonOlder "3.9";

  src = fetchFromGitHub {
    owner = "briis";
    repo = pname;
    rev = "v${version}";
    hash = "sha256-0adbUKTkbgA4pKrIVFGowD4Wf8brjfkLpfCT/+Mw6vs=";
  };

  propagatedBuildInputs = [
    aiohttp
    aioshutil
    packaging
    pillow
    pydantic
    pyjwt
    python-dotenv
    pytz
    typer
  ];

  checkInputs = [
    pytest-aiohttp
    pytest-asyncio
    pytest-benchmark
    pytest-timeout
    pytest-xdist
    pytestCheckHook
  ];

  postPatch = ''
    # https://github.com/briis/pyunifiprotect/pull/176
    substituteInPlace setup.cfg \
      --replace "asyncio" "aiohttp"
    substituteInPlace pyproject.toml \
      --replace "--cov=pyunifiprotect --cov-append" ""
  '';

  pythonImportsCheck = [
    "pyunifiprotect"
  ];

  pytestFlagsArray = [
    "--benchmark-disable"
  ];

  disabledTests = [
    # Tests require ffprobe
    "test_get_camera_video"
  ];

  meta = with lib; {
    description = "Library for interacting with the Unifi Protect API";
    homepage = "https://github.com/briis/pyunifiprotect";
    license = with licenses; [ mit ];
    maintainers = with maintainers; [ fab ];
  };
}