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