1{ lib
2, arangodb
3, buildPythonPackage
4, fetchFromGitHub
5, pythonOlder
6, pytestCheckHook
7, pyjwt
8, pytest
9, mock
10, requests
11, requests-toolbelt
12, setuptools
13}:
14
15let
16 testDBOpts = {
17 host = "127.0.0.1";
18 port = "8529";
19 password = "test";
20 secret = "secret";
21 };
22in
23
24buildPythonPackage rec {
25 pname = "python-arango";
26 version = "7.5.7";
27 format = "setuptools";
28
29 disabled = pythonOlder "3.7";
30
31 src = fetchFromGitHub {
32 owner = "ArangoDB-Community";
33 repo = "python-arango";
34 rev = "refs/tags/${version}";
35 hash = "sha256-cd2xE5rYLl3NOv/DZjmHRPCe224k4XyPjo9aXV1ZhvU=";
36 };
37
38 propagatedBuildInputs = [
39 requests
40 requests-toolbelt
41 pyjwt
42 setuptools
43 ];
44
45 nativeCheckInputs = [
46 arangodb
47 mock
48 pytestCheckHook
49 ];
50
51 # arangodb is compiled only for particular target architectures
52 # (i.e. "haswell"). Thus, these tests may not pass reproducibly,
53 # failing with: `166: Illegal instruction` if not run on arangodb's
54 # specified architecture.
55 #
56 # nonetheless, the client library should remain in nixpkgs - since
57 # the client library will talk to arangodb across the network and
58 # architecture issues will be irrelevant.
59 doCheck = false;
60
61 preCheck = lib.optionalString doCheck ''
62 # Start test DB
63 mkdir -p .nix-test/{data,work}
64
65 ICU_DATA=${arangodb}/share/arangodb3 \
66 GLIBCXX_FORCE_NEW=1 \
67 TZ=UTC \
68 TZ_DATA=${arangodb}/share/arangodb3/tzdata \
69 ARANGO_ROOT_PASSWORD=${testDBOpts.password} \
70 ${arangodb}/bin/arangod \
71 --server.uid=$(id -u) \
72 --server.gid=$(id -g) \
73 --server.authentication=true \
74 --server.endpoint=http+tcp://${testDBOpts.host}:${testDBOpts.port} \
75 --server.descriptors-minimum=4096 \
76 --server.jwt-secret=${testDBOpts.secret} \
77 --javascript.app-path=.nix-test/app \
78 --log.file=.nix-test/log \
79 --database.directory=.nix-test/data \
80 --foxx.api=false &
81 '';
82
83 pytestFlagsArray = [
84 "--host"
85 testDBOpts.host
86 "--port"
87 testDBOpts.port
88 "--passwd"
89 testDBOpts.password
90 "--secret"
91 testDBOpts.secret
92 ];
93
94 disabledTests = [
95 # AssertionError geo-related - try enabling later
96 "test_document_find_in_box"
97
98 # maybe arangod misconfig - try enabling later
99 # arango.exceptions.JWTAuthError: [HTTP 401][ERR 401] Wrong credentials
100 "test_auth_jwt"
101
102 # ValueError - try enabling later
103 # maybe missed 3.9.3->3.10.0 changes
104 # most caused by key change: isNewlyCreated->new
105 "test_add_hash_index"
106 "test_add_skiplist_index"
107 "test_add_persistent_index"
108 "test_add_ttl_index"
109 "test_delete_index"
110 "test_pregel_management"
111
112 # formatting error - try enabling later
113 # maybe missed 3.9.3->3.10.0 changes
114 # caused by: body["computedValues"] = None
115 "test_permission_management"
116 "test_collection_misc_methods"
117 "test_collection_management"
118 "test_replication_inventory"
119
120 # want outgoing network to update foxx apis
121 # so foxx.api disabled in arangod startup
122 "test_foxx_service_management_file"
123 "test_foxx_service_management_json"
124 "test_foxx_config_management"
125 "test_foxx_dependency_management"
126 "test_foxx_development_toggle"
127 "test_foxx_misc_functions"
128
129 # no replication configured via arangod invocation
130 "test_replication_applier"
131 ];
132
133 pythonImportsCheck = [
134 "arango"
135 ];
136
137 meta = with lib; {
138 description = "Python Driver for ArangoDB";
139 homepage = "https://github.com/ArangoDB-Community/python-arango";
140 changelog = "https://github.com/ArangoDB-Community/python-arango/releases/tag/${version}";
141 license = licenses.mit;
142 maintainers = with maintainers; [ jsoo1 ];
143 };
144}