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