diff --git a/pkgs/development/python-modules/pubnub/default.nix b/pkgs/development/python-modules/pubnub/default.nix new file mode 100644 index 00000000000..e4bab25fd9c --- /dev/null +++ b/pkgs/development/python-modules/pubnub/default.nix @@ -0,0 +1,57 @@ +{ lib +, aiohttp +, buildPythonPackage +, cbor2 +, fetchFromGitHub +, pycryptodomex +, pytestCheckHook +, pyyaml +, pytest-vcr +, pytest-asyncio +, requests +, six +}: + +buildPythonPackage rec { + pname = "pubnub"; + version = "4.8.0"; + + src = fetchFromGitHub { + owner = pname; + repo = "python"; + rev = "v${version}"; + sha256 = "16wjal95042kh5fxhvji0rwmw892pacqcnyms520mw15wcwilqir"; + }; + + propagatedBuildInputs = [ + cbor2 + pycryptodomex + requests + six + ]; + + checkInputs = [ + aiohttp + pycryptodomex + pytest-asyncio + pytestCheckHook + pytest-vcr + + ]; + + # Some tests don't pass with recent releases of tornado/twisted + pytestFlagsArray = [ + "--ignore tests/integrational" + "--ignore tests/manual/asyncio" + "--ignore tests/manual/tornado/test_reconnections.py" + ]; + + pythonImportsCheck = [ "pubnub" ]; + + meta = with lib; { + description = "Python-based APIs for PubNub"; + homepage = "https://github.com/pubnub/python"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/development/python-modules/pubnubsub-handler/default.nix b/pkgs/development/python-modules/pubnubsub-handler/default.nix new file mode 100644 index 00000000000..32ad2a8e1b8 --- /dev/null +++ b/pkgs/development/python-modules/pubnubsub-handler/default.nix @@ -0,0 +1,34 @@ +{ lib +, buildPythonPackage +, fetchPypi +, pubnub +, pycryptodomex +, requests +}: + +buildPythonPackage rec { + pname = "pubnubsub-handler"; + version = "1.0.9"; + + src = fetchPypi { + inherit pname version; + sha256 = "sha256:1c44x19zi709sazgl060nkqa7vbaf3iyhwcnwdykhsbipvp6bscy"; + }; + + propagatedBuildInputs = [ + pubnub + pycryptodomex + requests + ]; + + # Project has no tests + doCheck = false; + pythonImportsCheck = [ "pubnubsubhandler" ]; + + meta = with lib; { + description = "PubNub subscription between PubNub and Home Assistant"; + homepage = "https://github.com/w1ll1am23/pubnubsub-handler"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/development/python-modules/pytest-vcr/default.nix b/pkgs/development/python-modules/pytest-vcr/default.nix new file mode 100644 index 00000000000..9373c597b36 --- /dev/null +++ b/pkgs/development/python-modules/pytest-vcr/default.nix @@ -0,0 +1,36 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pytestCheckHook +, pytest +, vcrpy +}: + +buildPythonPackage rec { + pname = "pytest-vcr"; + version = "1.0.2"; + + src = fetchFromGitHub { + owner = "ktosiek"; + repo = pname; + rev = version; + sha256 = "1i6fin91mklvbi8jzfiswvwf1m91f43smpj36a17xrzk4gisfs6i"; + }; + + propagatedBuildInputs = [ + pytest + vcrpy + ]; + + # Tests are using an obsolete attribute 'config' + # https://github.com/ktosiek/pytest-vcr/issues/43 + doCheck = false; + pythonImportsCheck = [ "pytest_vcr" ]; + + meta = with lib; { + description = "Integration VCR.py into pytest"; + homepage = "https://github.com/ktosiek/pytest-vcr"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/servers/home-assistant/component-packages.nix b/pkgs/servers/home-assistant/component-packages.nix index 3d7431a65c6..c47e3b680fa 100644 --- a/pkgs/servers/home-assistant/component-packages.nix +++ b/pkgs/servers/home-assistant/component-packages.nix @@ -927,7 +927,7 @@ "whois" = ps: with ps; [ python-whois ]; "wiffi" = ps: with ps; [ ]; # missing inputs: wiffi "wilight" = ps: with ps; [ pywilight ]; - "wink" = ps: with ps; [ aiohttp-cors ]; # missing inputs: pubnubsub-handler python-wink + "wink" = ps: with ps; [ aiohttp-cors pubnubsub-handler ]; # missing inputs: python-wink "wirelesstag" = ps: with ps; [ ]; # missing inputs: wirelesstagpy "withings" = ps: with ps; [ aiohttp-cors ]; # missing inputs: withings-api "wled" = ps: with ps; [ wled ]; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 91ecda9f732..5c041de8db0 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -5035,6 +5035,10 @@ in { publicsuffix = callPackage ../development/python-modules/publicsuffix { }; + pubnub = callPackage ../development/python-modules/pubnub { }; + + pubnubsub-handler = callPackage ../development/python-modules/pubnubsub-handler { }; + pudb = callPackage ../development/python-modules/pudb { }; pulp = callPackage ../development/python-modules/pulp { }; @@ -6087,6 +6091,8 @@ in { pytest-twisted = callPackage ../development/python-modules/pytest-twisted { }; + pytest-vcr = callPackage ../development/python-modules/pytest-vcr { }; + pytest-virtualenv = callPackage ../development/python-modules/pytest-virtualenv { }; pytest-warnings = callPackage ../development/python-modules/pytest-warnings { };