1{
2 lib,
3 stdenv,
4 aiohttp,
5 buildPythonPackage,
6 ed25519,
7 fetchFromGitHub,
8 nats-server,
9 nkeys,
10 pytestCheckHook,
11 pythonOlder,
12 setuptools,
13 uvloop,
14}:
15
16buildPythonPackage rec {
17 pname = "nats-py";
18 version = "2.11.0";
19 pyproject = true;
20
21 disabled = pythonOlder "3.7";
22
23 src = fetchFromGitHub {
24 owner = "nats-io";
25 repo = "nats.py";
26 tag = "v${version}";
27 hash = "sha256-wILjBhdlNU8U2lyJm4CmPy4DzOjJ7cBIkawKwW5KVgg=";
28 };
29
30 build-system = [ setuptools ];
31
32 dependencies = [ ed25519 ];
33
34 optional-dependencies = {
35 aiohttp = [ aiohttp ];
36 nkeys = [ nkeys ];
37 # fast_parse = [ fast-mail-parser ];
38 };
39
40 nativeCheckInputs = [
41 nats-server
42 pytestCheckHook
43 uvloop
44 ];
45
46 disabledTests = [
47 # Timeouts
48 "ClientTLS"
49 # AssertionError
50 "test_fetch_n"
51 "test_kv_simple"
52 "test_pull_subscribe_limits"
53 "test_stream_management"
54 "test_subscribe_no_echo"
55 # Tests fail on hydra, often Time-out
56 "test_subscribe_iterate_next_msg"
57 "test_ordered_consumer_larger_streams"
58 "test_object_file_basics"
59 # Should be safe to remove on next version upgrade (from 2.11.0)
60 # https://github.com/nats-io/nats.py/pull/728
61 "test_object_list"
62 ]
63 ++ lib.optionals stdenv.hostPlatform.isDarwin [
64 "test_subscribe_iterate_next_msg"
65 "test_buf_size_force_flush_timeout"
66 ];
67
68 pythonImportsCheck = [ "nats" ];
69
70 meta = with lib; {
71 description = "Python client for NATS.io";
72 homepage = "https://github.com/nats-io/nats.py";
73 changelog = "https://github.com/nats-io/nats.py/releases/tag/${src.tag}";
74 license = with licenses; [ asl20 ];
75 maintainers = with maintainers; [ fab ];
76 };
77}