summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/opensearch-py/default.nix
blob: 8c881bf5ba71e8bc05f2704f14179202ab5d1414 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchFromGitHub,
  fetchpatch,

  # build-system
  setuptools,

  # dependencies
  certifi,
  python-dateutil,
  requests,
  six,
  urllib3,
  events,

  # optional-dependencies
  aiohttp,

  # tests
  botocore,
  mock,
  pytest-asyncio,
  pytest-mock,
  pytestCheckHook,
  pyyaml,
  pytz,
}:

buildPythonPackage rec {
  pname = "opensearch-py";
  version = "3.0.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "opensearch-project";
    repo = "opensearch-py";
    tag = "v${version}";
    hash = "sha256-IAEh+rB26Zqv7j5g2YIRZRCAtFbBngoh+w8Z4e2bY+M=";
  };

  patches = [
    # Remove delete event_loop fixture to fix test with pytest-asyncio 1.x
    # reference: https://github.com/opensearch-project/opensearch-py/pull/936
    ./remove-delete-event-loop-fixture.patch
  ];

  nativeBuildInputs = [ setuptools ];

  propagatedBuildInputs = [
    certifi
    python-dateutil
    requests
    six
    urllib3
    events
  ];

  optional-dependencies.async = [ aiohttp ];

  nativeCheckInputs = [
    botocore
    mock
    pytest-asyncio
    pytest-mock
    pytestCheckHook
    pyyaml
    pytz
  ]
  ++ optional-dependencies.async;

  __darwinAllowLocalNetworking = true;

  disabledTestPaths = [
    # require network
    "test_opensearchpy/test_async/test_connection.py"
    "test_opensearchpy/test_async/test_server"
    "test_opensearchpy/test_server"
    "test_opensearchpy/test_server_secured"
  ];

  disabledTests = [
    # finds our ca-bundle, but expects something else (/path/to/clientcert/dir or None)
    "test_ca_certs_ssl_cert_dir"
    "test_no_ca_certs"

    # Failing tests, issue opened at https://github.com/opensearch-project/opensearch-py/issues/849
    "test_basicauth_in_request_session"
    "test_callable_in_request_session"
  ]
  ++ lib.optionals stdenv.hostPlatform.isDarwin [
    # Flaky tests: OSError: [Errno 48] Address already in use
    "test_redirect_failure_when_allow_redirect_false"
    "test_redirect_success_when_allow_redirect_true"
  ];

  meta = {
    description = "Python low-level client for OpenSearch";
    homepage = "https://github.com/opensearch-project/opensearch-py";
    changelog = "https://github.com/opensearch-project/opensearch-py/releases/tag/${src.tag}";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ mcwitt ];
  };
}