1{ lib
2, stdenv
3, aiohttp
4, buildPythonPackage
5, ed25519
6, fetchFromGitHub
7, nats-server
8, pytestCheckHook
9, pythonOlder
10, uvloop
11}:
12
13buildPythonPackage rec {
14 pname = "nats-py";
15 version = "2.2.0";
16 format = "setuptools";
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchFromGitHub {
21 owner = "nats-io";
22 repo = "nats.py";
23 rev = "refs/tags/v${version}";
24 hash = "sha256-w+YySX9RNXUttt7iLg/Efh8bNzmhIQTKMXcoPO1k4lI=";
25 };
26
27 propagatedBuildInputs = [
28 aiohttp
29 ed25519
30 ];
31
32 checkInputs = [
33 nats-server
34 pytestCheckHook
35 uvloop
36 ];
37
38 postPatch = ''
39 substituteInPlace setup.cfg \
40 --replace "--cov=nats --cov-report html" ""
41 '';
42
43 disabledTests = [
44 # AssertionError: assert 5 == 0
45 "test_pull_subscribe_limits"
46 "test_fetch_n"
47 "test_subscribe_no_echo"
48 ] ++ lib.optionals stdenv.isDarwin [
49 "test_subscribe_iterate_next_msg"
50 "test_buf_size_force_flush_timeout"
51 ];
52
53 pythonImportsCheck = [
54 "nats"
55 ];
56
57 meta = with lib; {
58 description = "Python client for NATS.io";
59 homepage = "https://github.com/nats-io/nats.py";
60 license = with licenses; [ asl20 ];
61 maintainers = with maintainers; [ fab ];
62 };
63}