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