diff --git a/pkgs/development/python-modules/aioshutil/default.nix b/pkgs/development/python-modules/aioshutil/default.nix new file mode 100644 index 000000000000..a76bba9c0ac2 --- /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 000000000000..be333ee9d045 --- /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 000000000000..511fd26132b7 --- /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 ]; + }; +} diff --git a/pkgs/servers/home-assistant/component-packages.nix b/pkgs/servers/home-assistant/component-packages.nix index 03e0de29fee6..53f7cc265f23 100644 --- a/pkgs/servers/home-assistant/component-packages.nix +++ b/pkgs/servers/home-assistant/component-packages.nix @@ -2876,7 +2876,9 @@ ]; "unifiprotect" = ps: with ps; [ aiohttp-cors - ]; # missing inputs: pyunifiprotect unifi-discovery + pyunifiprotect + unifi-discovery + ]; "universal" = ps: with ps; [ ]; "upb" = ps: with ps; [ @@ -3779,6 +3781,7 @@ "ukraine_alarm" "unifi" "unifi_direct" + "unifiprotect" "universal" "upb" "upcloud" diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 771f5cec3750..307c54fbec31 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -403,6 +403,8 @@ in { aioshelly = callPackage ../development/python-modules/aioshelly { }; + aioshutil = callPackage ../development/python-modules/aioshutil { }; + aiosignal = callPackage ../development/python-modules/aiosignal { }; aioslimproto = callPackage ../development/python-modules/aioslimproto { }; @@ -8763,6 +8765,8 @@ in { pyunifi = callPackage ../development/python-modules/pyunifi { }; + pyunifiprotect = callPackage ../development/python-modules/pyunifiprotect { }; + pyupdate = callPackage ../development/python-modules/pyupdate { }; pyupgrade = callPackage ../development/python-modules/pyupgrade { }; @@ -10780,6 +10784,8 @@ in { unifi = callPackage ../development/python-modules/unifi { }; + unifi-discovery = callPackage ../development/python-modules/unifi-discovery { }; + unify = callPackage ../development/python-modules/unify { }; unifiled = callPackage ../development/python-modules/unifiled { };