git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #118584 from fabaff/nats
commitf9544583b6702ec234c1f36f8cc3d6c23295c76a authorSandro <sandro.jaeckel@gmail.com> dateThu 8 Apr 2021, 15:40 (6 years ago) parent6302dc54cdb34f
3 files changed+100
pkgs/development/python-modules/asyncio-nats-client/default.nix+50 pkgs/development/python-modules/nats-python/default.nix+46 pkgs/top-level/python-packages.nix+4
pkgs/development/python-modules/asyncio-nats-client/default.nixnew file+50
@@ -0,0 +1,50 @@
1+{ lib
2+, buildPythonPackage
3+, ed25519
4+, fetchFromGitHub
5+, nats-server
6+, pytestCheckHook
7+, pythonOlder
8+}:
9+
10+buildPythonPackage rec {
11+ pname = "asyncio-nats-client";
12+ version = "0.11.4";
13+ disabled = pythonOlder "3.6";
14+
15+ src = fetchFromGitHub {
16+ owner = "nats-io";
17+ repo = "nats.py";
18+ rev = "v${version}";
19+ sha256 = "1aj57xi2rj1xswq8air13xdsll1ybpi0nmz5f6jq01azm0zy9xyd";
20+ };
21+
22+ propagatedBuildInputs = [
23+ ed25519
24+ ];
25+
26+ checkInputs = [
27+ nats-server
28+ pytestCheckHook
29+ ];
30+
31+ postPatch = ''
32+ substituteInPlace setup.cfg \
33+ --replace "--cov=nats --cov-report html" ""
34+ '';
35+
36+ disabledTests = [
37+ # RuntimeError: Event loop is closed
38+ "test_subscribe_no_echo"
39+ "test_reconnect_to_new_server_with_auth"
40+ ];
41+
42+ pythonImportsCheck = [ "nats.aio" ];
43+
44+ meta = with lib; {
45+ description = "Python client for NATS.io";
46+ homepage = "https://github.com/nats-io/nats.py";
47+ license = with licenses; [ asl20 ];
48+ maintainers = with maintainers; [ fab ];
49+ };
50+}
pkgs/development/python-modules/nats-python/default.nixnew file+46
@@ -0,0 +1,46 @@
1+{ lib
2+, buildPythonPackage
3+, fetchFromGitHub
4+, fetchpatch
5+, poetry-core
6+, pythonOlder
7+}:
8+
9+buildPythonPackage rec {
10+ pname = "nats-python";
11+ version = "0.8.0";
12+ disabled = pythonOlder "3.6";
13+ format = "pyproject";
14+
15+ src = fetchFromGitHub {
16+ owner = "Gr1N";
17+ repo = "nats-python";
18+ rev = version;
19+ sha256 = "1j7skyxldir3mphvnsyhjxmf3cimv4h7n5v58jl2gff4yd0hdw7g";
20+ };
21+
22+ nativeBuildInputs = [
23+ poetry-core
24+ ];
25+
26+ patches = [
27+ # Switch to poetry-core, https://github.com/Gr1N/nats-python/pull/19
28+ (fetchpatch {
29+ name = "use-poetry-core.patch";
30+ url = "https://github.com/Gr1N/nats-python/commit/71b25b324212dccd7fc06ba3914491adba22e83f.patch";
31+ sha256 = "1fip1qpzk2ka7qgkrdpdr6vnrnb1p8cwapa51xp0h26nm7yis1gl";
32+ })
33+ ];
34+
35+ # Tests require a running NATS server
36+ doCheck = false;
37+
38+ pythonImportsCheck = [ "pynats" ];
39+
40+ meta = with lib; {
41+ description = "Python client for NATS messaging system";
42+ homepage = "https://github.com/Gr1N/nats-python";
43+ license = with licenses; [ mit ];
44+ maintainers = with maintainers; [ fab ];
45+ };
46+}
pkgs/top-level/python-packages.nix+4
@@ -546,6 +546,8 @@ in {
546546
547547 asyncio-mqtt = callPackage ../development/python-modules/asyncio_mqtt { };
548548
549+ asyncio-nats-client = callPackage ../development/python-modules/asyncio-nats-client { };
550+
549551 asyncio-throttle = callPackage ../development/python-modules/asyncio-throttle { };
550552
551553 asyncpg = callPackage ../development/python-modules/asyncpg { };
@@ -4527,6 +4529,8 @@ in {
45274529
45284530 nassl = callPackage ../development/python-modules/nassl { };
45294531
4532+ nats-python = callPackage ../development/python-modules/nats-python { };
4533+
45304534 natsort = callPackage ../development/python-modules/natsort { };
45314535
45324536 naturalsort = callPackage ../development/python-modules/naturalsort { };