From c8b27b818f418ec76bdbe9286e573d9b1a4c419e Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 5 Apr 2021 12:53:26 +0200 Subject: [PATCH 1/2] python3Packages.asyncio-nats-client: init at 0.11.4 --- .../asyncio-nats-client/default.nix | 50 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 4 ++ 2 files changed, 54 insertions(+) create mode 100644 pkgs/development/python-modules/asyncio-nats-client/default.nix diff --git a/pkgs/development/python-modules/asyncio-nats-client/default.nix b/pkgs/development/python-modules/asyncio-nats-client/default.nix new file mode 100644 index 00000000000..a7feac7312f --- /dev/null +++ b/pkgs/development/python-modules/asyncio-nats-client/default.nix @@ -0,0 +1,50 @@ +{ lib +, buildPythonPackage +, ed25519 +, fetchFromGitHub +, nats-server +, pytestCheckHook +, pythonOlder +}: + +buildPythonPackage rec { + pname = "asyncio-nats-client"; + version = "0.11.4"; + disabled = pythonOlder "3.6"; + + src = fetchFromGitHub { + owner = "nats-io"; + repo = "nats.py"; + rev = "v${version}"; + sha256 = "1aj57xi2rj1xswq8air13xdsll1ybpi0nmz5f6jq01azm0zy9xyd"; + }; + + propagatedBuildInputs = [ + ed25519 + ]; + + checkInputs = [ + nats-server + pytestCheckHook + ]; + + postPatch = '' + substituteInPlace setup.cfg \ + --replace "--cov=nats --cov-report html" "" + ''; + + disabledTests = [ + # RuntimeError: Event loop is closed + "test_subscribe_no_echo" + "test_reconnect_to_new_server_with_auth" + ]; + + pythonImportsCheck = [ "nats.aio" ]; + + meta = with lib; { + description = "Python client for NATS.io"; + homepage = "https://github.com/nats-io/nats.py"; + license = with licenses; [ asl20 ]; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index c11dcd08596..97d0b412b76 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -542,6 +542,8 @@ in { asyncio-mqtt = callPackage ../development/python-modules/asyncio_mqtt { }; + asyncio-nats-client = callPackage ../development/python-modules/asyncio-nats-client { }; + asyncio-throttle = callPackage ../development/python-modules/asyncio-throttle { }; asyncpg = callPackage ../development/python-modules/asyncpg { }; @@ -4512,6 +4514,8 @@ in { nassl = callPackage ../development/python-modules/nassl { }; + nats-python = callPackage ../development/python-modules/nats-python { }; + natsort = callPackage ../development/python-modules/natsort { }; naturalsort = callPackage ../development/python-modules/naturalsort { }; From 4cdb34f8aa4283d4b78efb8ac936581e67581727 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 5 Apr 2021 15:01:24 +0200 Subject: [PATCH 2/2] python3Packages.nats-python: init at 0.8.0 --- .../python-modules/nats-python/default.nix | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 pkgs/development/python-modules/nats-python/default.nix diff --git a/pkgs/development/python-modules/nats-python/default.nix b/pkgs/development/python-modules/nats-python/default.nix new file mode 100644 index 00000000000..5bf5b2a6d21 --- /dev/null +++ b/pkgs/development/python-modules/nats-python/default.nix @@ -0,0 +1,46 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, fetchpatch +, poetry-core +, pythonOlder +}: + +buildPythonPackage rec { + pname = "nats-python"; + version = "0.8.0"; + disabled = pythonOlder "3.6"; + format = "pyproject"; + + src = fetchFromGitHub { + owner = "Gr1N"; + repo = "nats-python"; + rev = version; + sha256 = "1j7skyxldir3mphvnsyhjxmf3cimv4h7n5v58jl2gff4yd0hdw7g"; + }; + + nativeBuildInputs = [ + poetry-core + ]; + + patches = [ + # Switch to poetry-core, https://github.com/Gr1N/nats-python/pull/19 + (fetchpatch { + name = "use-poetry-core.patch"; + url = "https://github.com/Gr1N/nats-python/commit/71b25b324212dccd7fc06ba3914491adba22e83f.patch"; + sha256 = "1fip1qpzk2ka7qgkrdpdr6vnrnb1p8cwapa51xp0h26nm7yis1gl"; + }) + ]; + + # Tests require a running NATS server + doCheck = false; + + pythonImportsCheck = [ "pynats" ]; + + meta = with lib; { + description = "Python client for NATS messaging system"; + homepage = "https://github.com/Gr1N/nats-python"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ fab ]; + }; +}