1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 fetchpatch,
7
8 # build-system
9 setuptools,
10
11 # dependencies
12 certifi,
13 python-dateutil,
14 requests,
15 six,
16 urllib3,
17 events,
18
19 # optional-dependencies
20 aiohttp,
21
22 # tests
23 botocore,
24 mock,
25 pytest-asyncio,
26 pytest-mock,
27 pytestCheckHook,
28 pyyaml,
29 pytz,
30}:
31
32buildPythonPackage rec {
33 pname = "opensearch-py";
34 version = "3.0.0";
35 pyproject = true;
36
37 src = fetchFromGitHub {
38 owner = "opensearch-project";
39 repo = "opensearch-py";
40 tag = "v${version}";
41 hash = "sha256-IAEh+rB26Zqv7j5g2YIRZRCAtFbBngoh+w8Z4e2bY+M=";
42 };
43
44 patches = [
45 # Remove delete event_loop fixture to fix test with pytest-asyncio 1.x
46 # reference: https://github.com/opensearch-project/opensearch-py/pull/936
47 ./remove-delete-event-loop-fixture.patch
48 ];
49
50 nativeBuildInputs = [ setuptools ];
51
52 propagatedBuildInputs = [
53 certifi
54 python-dateutil
55 requests
56 six
57 urllib3
58 events
59 ];
60
61 optional-dependencies.async = [ aiohttp ];
62
63 nativeCheckInputs = [
64 botocore
65 mock
66 pytest-asyncio
67 pytest-mock
68 pytestCheckHook
69 pyyaml
70 pytz
71 ]
72 ++ optional-dependencies.async;
73
74 __darwinAllowLocalNetworking = true;
75
76 disabledTestPaths = [
77 # require network
78 "test_opensearchpy/test_async/test_connection.py"
79 "test_opensearchpy/test_async/test_server"
80 "test_opensearchpy/test_server"
81 "test_opensearchpy/test_server_secured"
82 ];
83
84 disabledTests = [
85 # finds our ca-bundle, but expects something else (/path/to/clientcert/dir or None)
86 "test_ca_certs_ssl_cert_dir"
87 "test_no_ca_certs"
88
89 # Failing tests, issue opened at https://github.com/opensearch-project/opensearch-py/issues/849
90 "test_basicauth_in_request_session"
91 "test_callable_in_request_session"
92 ]
93 ++ lib.optionals stdenv.hostPlatform.isDarwin [
94 # Flaky tests: OSError: [Errno 48] Address already in use
95 "test_redirect_failure_when_allow_redirect_false"
96 "test_redirect_success_when_allow_redirect_true"
97 ];
98
99 meta = {
100 description = "Python low-level client for OpenSearch";
101 homepage = "https://github.com/opensearch-project/opensearch-py";
102 changelog = "https://github.com/opensearch-project/opensearch-py/releases/tag/${src.tag}";
103 license = lib.licenses.asl20;
104 maintainers = with lib.maintainers; [ mcwitt ];
105 };
106}