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.10.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-cgcoxDTfXeP2w1k8Miw8zY1Bln0XpTdtUY13SSvrHXw=";
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 [
48 # Timeouts
49 "ClientTLS"
50 # AssertionError
51 "test_fetch_n"
52 "test_kv_simple"
53 "test_pull_subscribe_limits"
54 "test_stream_management"
55 "test_subscribe_no_echo"
56 # Tests fail on hydra, often Time-out
57 "test_subscribe_iterate_next_msg"
58 "test_ordered_consumer_larger_streams"
59 "test_object_file_basics"
60 ]
61 ++ lib.optionals stdenv.hostPlatform.isDarwin [
62 "test_subscribe_iterate_next_msg"
63 "test_buf_size_force_flush_timeout"
64 ];
65
66 pythonImportsCheck = [ "nats" ];
67
68 meta = with lib; {
69 description = "Python client for NATS.io";
70 homepage = "https://github.com/nats-io/nats.py";
71 changelog = "https://github.com/nats-io/nats.py/releases/tag/v${version}";
72 license = with licenses; [ asl20 ];
73 maintainers = with maintainers; [ fab ];
74 };
75}