nixos-option: rewrite as a nix script, 2nd try (#369151)
[NixPkgs.git] / pkgs / development / python-modules / python-arango / default.nix
blobac9b3e62c53f53155e5c46af50b8b22d610bdd19
2   lib,
3   buildPythonPackage,
4   fetchFromGitHub,
5   pythonOlder,
6   pytestCheckHook,
8   # build-system
9   setuptools,
10   setuptools-scm,
12   # dependencies
13   urllib3,
14   requests,
15   requests-toolbelt,
16   pyjwt,
17   importlib-metadata,
18   packaging,
20   # tests
21   arangodb,
22   mock,
25 let
26   testDBOpts = {
27     host = "127.0.0.1";
28     port = "8529";
29     password = "test";
30     secret = "secret";
31   };
34 buildPythonPackage rec {
35   pname = "python-arango";
36   version = "8.1.4";
37   format = "pyproject";
39   disabled = pythonOlder "3.7";
41   src = fetchFromGitHub {
42     owner = "arangodb";
43     repo = "python-arango";
44     tag = version;
45     hash = "sha256-NAFleaZaZFWwhAPsuJG9S81w/FlkHgefqVWg5F+lhUo=";
46   };
48   nativeBuildInputs = [
49     setuptools
50     setuptools-scm
51   ];
53   propagatedBuildInputs = [
54     importlib-metadata
55     requests
56     requests-toolbelt
57     packaging
58     pyjwt
59     setuptools
60     urllib3
61   ];
63   nativeCheckInputs = [
64     arangodb
65     mock
66     pytestCheckHook
67   ];
69   # arangodb is compiled only for particular target architectures
70   # (i.e. "haswell"). Thus, these tests may not pass reproducibly,
71   # failing with: `166: Illegal instruction` if not run on arangodb's
72   # specified architecture.
73   #
74   # nonetheless, the client library should remain in nixpkgs - since
75   # the client library will talk to arangodb across the network and
76   # architecture issues will be irrelevant.
77   doCheck = false;
79   preCheck = lib.optionalString doCheck ''
80     # Start test DB
81     mkdir -p .nix-test/{data,work}
83     ICU_DATA=${arangodb}/share/arangodb3 \
84     GLIBCXX_FORCE_NEW=1 \
85     TZ=UTC \
86     TZ_DATA=${arangodb}/share/arangodb3/tzdata \
87     ARANGO_ROOT_PASSWORD=${testDBOpts.password} \
88     ${arangodb}/bin/arangod \
89       --server.uid=$(id -u) \
90       --server.gid=$(id -g) \
91       --server.authentication=true \
92       --server.endpoint=http+tcp://${testDBOpts.host}:${testDBOpts.port} \
93       --server.descriptors-minimum=4096 \
94       --server.jwt-secret=${testDBOpts.secret} \
95       --javascript.app-path=.nix-test/app \
96       --log.file=.nix-test/log \
97       --database.directory=.nix-test/data \
98       --foxx.api=false &
99   '';
101   pytestFlagsArray = [
102     "--host"
103     testDBOpts.host
104     "--port"
105     testDBOpts.port
106     "--passwd"
107     testDBOpts.password
108     "--secret"
109     testDBOpts.secret
110   ];
112   disabledTests = [
113     # AssertionError geo-related - try enabling later
114     "test_document_find_in_box"
116     # maybe arangod misconfig - try enabling later
117     # arango.exceptions.JWTAuthError: [HTTP 401][ERR 401] Wrong credentials
118     "test_auth_jwt"
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"
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"
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"
147     # no replication configured via arangod invocation
148     "test_replication_applier"
149   ];
151   pythonImportsCheck = [ "arango" ];
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/${version}";
157     license = licenses.mit;
158     maintainers = with maintainers; [ jsoo1 ];
159   };