about summary refs log tree commit diff
path: root/pkgs/development/python-modules/uiprotect/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/uiprotect/default.nix')
-rw-r--r--pkgs/development/python-modules/uiprotect/default.nix93
1 files changed, 93 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/uiprotect/default.nix b/pkgs/development/python-modules/uiprotect/default.nix
new file mode 100644
index 0000000000000..77a4f48428d2a
--- /dev/null
+++ b/pkgs/development/python-modules/uiprotect/default.nix
@@ -0,0 +1,93 @@
+{
+  lib,
+  buildPythonPackage,
+  fetchFromGitHub,
+
+  # build-system
+  poetry-core,
+
+  # dependencies
+  aiofiles,
+  aiohttp,
+  aioshutil,
+  async-timeout,
+  dateparser,
+  orjson,
+  packaging,
+  pillow,
+  platformdirs,
+  pydantic,
+  pyjwt,
+  rich,
+  typer,
+  yarl,
+
+  # tests
+  aiosqlite,
+  asttokens,
+  ffmpeg,
+  pytest-asyncio,
+  pytest-benchmark,
+  pytest-timeout,
+  pytest-xdist,
+  pytestCheckHook,
+}:
+
+buildPythonPackage rec {
+  pname = "uiprotect";
+  version = "1.7.2";
+  pyproject = true;
+
+  src = fetchFromGitHub {
+    owner = "uilibs";
+    repo = "uiprotect";
+    rev = "refs/tags/v${version}";
+    hash = "sha256-gr+P7V0vsmWha/Di3BGORjssCLz0lsufawzMZKOMYt0=";
+  };
+
+  postPatch = ''
+    sed -i "/addopts =/d" pyproject.toml
+  '';
+
+  build-system = [ poetry-core ];
+
+  dependencies = [
+    aiofiles
+    aiohttp
+    aioshutil
+    async-timeout
+    dateparser
+    orjson
+    packaging
+    pillow
+    platformdirs
+    pydantic
+    pyjwt
+    rich
+    typer
+    yarl
+  ];
+
+  nativeCheckInputs = [
+    aiosqlite
+    asttokens
+    ffmpeg # Required for command ffprobe
+    pytest-asyncio
+    pytest-benchmark
+    pytest-timeout
+    pytest-xdist
+    pytestCheckHook
+  ];
+
+  pytestFlagsArray = [ "--benchmark-disable" ];
+
+  pythonImportsCheck = [ "uiprotect" ];
+
+  meta = with lib; {
+    description = "Python API for UniFi Protect (Unofficial";
+    homepage = "https://github.com/uilibs/uiprotect";
+    changelog = "https://github.com/uilibs/uiprotect/blob/${src.rev}/CHANGELOG.md";
+    license = licenses.mit;
+    maintainers = with maintainers; [ hexa ];
+  };
+}