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