about summary refs log tree commit diff
path: root/pkgs/development/python-modules
diff options
context:
space:
mode:
authorMartin Weinelt <mweinelt@users.noreply.github.com>2022-06-04 02:28:06 +0200
committerGitHub <noreply@github.com>2022-06-04 02:28:06 +0200
commit403db8d41c795d5db1bdb7ffe709897114a4907e (patch)
treec79a79e3882719a145e88f24fcbeb3e4744be90c /pkgs/development/python-modules
parent8109bda325b17bc908c257319cdd8ebe0aa7eeb4 (diff)
parentdd61f287f405507bd4051940ed9e114bb2891202 (diff)
Merge pull request #176143 from fabaff/pyunifiprotect
python310Packages.pyunifiprotect: init at 3.7.0, python310Packages.unifi-discovery: init at 1.1.3
Diffstat (limited to 'pkgs/development/python-modules')
-rw-r--r--pkgs/development/python-modules/aioshutil/default.nix50
-rw-r--r--pkgs/development/python-modules/pyunifiprotect/default.nix85
-rw-r--r--pkgs/development/python-modules/unifi-discovery/default.nix57
3 files changed, 192 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/aioshutil/default.nix b/pkgs/development/python-modules/aioshutil/default.nix
new file mode 100644
index 0000000000000..a76bba9c0ac27
--- /dev/null
+++ b/pkgs/development/python-modules/aioshutil/default.nix
@@ -0,0 +1,50 @@
+{ lib
+, buildPythonPackage
+, fetchFromGitHub
+, pytest-asyncio
+, pytestCheckHook
+, pythonOlder
+, setuptools-scm
+}:
+
+buildPythonPackage rec {
+  pname = "aioshutil";
+  version = "1.1";
+  format = "pyproject";
+
+  disabled = pythonOlder "3.7";
+
+  src = fetchFromGitHub {
+    owner = "kumaraditya303";
+    repo = pname;
+    rev = "v${version}";
+    hash = "sha256-CQIzNu1NrGDOh2uVif/EzB5C5t/Y/h9oT56Gp6jrOPQ=";
+  };
+
+  SETUPTOOLS_SCM_PRETEND_VERSION = version;
+
+  nativeBuildInputs = [
+    setuptools-scm
+  ];
+
+  checkInputs = [
+    pytest-asyncio
+    pytestCheckHook
+  ];
+
+  postPatch = ''
+    substituteInPlace setup.cfg \
+      --replace " --cov aioshutil --cov-report xml" ""
+  '';
+
+  pythonImportsCheck = [
+    "aioshutil"
+  ];
+
+  meta = with lib; {
+    description = "Asynchronous version of function of shutil module";
+    homepage = "https://github.com/kumaraditya303/aioshutil";
+    license = with licenses; [ bsd3 ];
+    maintainers = with maintainers; [ fab ];
+  };
+}
diff --git a/pkgs/development/python-modules/pyunifiprotect/default.nix b/pkgs/development/python-modules/pyunifiprotect/default.nix
new file mode 100644
index 0000000000000..be333ee9d0452
--- /dev/null
+++ b/pkgs/development/python-modules/pyunifiprotect/default.nix
@@ -0,0 +1,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 ];
+  };
+}
diff --git a/pkgs/development/python-modules/unifi-discovery/default.nix b/pkgs/development/python-modules/unifi-discovery/default.nix
new file mode 100644
index 0000000000000..511fd26132b77
--- /dev/null
+++ b/pkgs/development/python-modules/unifi-discovery/default.nix
@@ -0,0 +1,57 @@
+{ lib
+, aiohttp
+, aioresponses
+, buildPythonPackage
+, fetchFromGitHub
+, poetry-core
+, pyroute2
+, pytest-asyncio
+, pytestCheckHook
+, pythonOlder
+}:
+
+buildPythonPackage rec {
+  pname = "unifi-discovery";
+  version = "1.1.3";
+  format = "pyproject";
+
+  disabled = pythonOlder "3.9";
+
+  src = fetchFromGitHub {
+    owner = "bdraco";
+    repo = pname;
+    rev = "v${version}";
+    hash = "sha256-++5Rg3cCyH4h6zzEXbsQM5tRnUsnV3RCzuOctcjA/x4=";
+  };
+
+  nativeBuildInputs = [
+    poetry-core
+  ];
+
+  propagatedBuildInputs = [
+    aiohttp
+    pyroute2
+  ];
+
+  checkInputs = [
+    aioresponses
+    pytest-asyncio
+    pytestCheckHook
+  ];
+
+  postPatch = ''
+    substituteInPlace pyproject.toml \
+      --replace "--cov=unifi_discovery --cov-report=term-missing:skip-covered" ""
+  '';
+
+  pythonImportsCheck = [
+    "unifi_discovery"
+  ];
+
+  meta = with lib; {
+    description = "Module to discover Unifi devices";
+    homepage = "https://github.com/bdraco/unifi-discovery";
+    license = with licenses; [ asl20 ];
+    maintainers = with maintainers; [ fab ];
+  };
+}