Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at gcc-offload 182 lines 3.5 kB view raw
1{ 2 lib, 3 stdenv, 4 bcrypt, 5 build, 6 buildPythonPackage, 7 cargo, 8 chroma-hnswlib, 9 darwin, 10 fastapi, 11 fetchFromGitHub, 12 grpcio, 13 httpx, 14 hypothesis, 15 importlib-resources, 16 kubernetes, 17 mmh3, 18 nixosTests, 19 numpy, 20 onnxruntime, 21 openssl, 22 opentelemetry-api, 23 opentelemetry-exporter-otlp-proto-grpc, 24 opentelemetry-instrumentation-fastapi, 25 opentelemetry-sdk, 26 orjson, 27 overrides, 28 pkg-config, 29 posthog, 30 protobuf, 31 psutil, 32 pulsar-client, 33 pydantic, 34 pypika, 35 pytest-asyncio, 36 pytestCheckHook, 37 pythonOlder, 38 pyyaml, 39 requests, 40 rustc, 41 rustPlatform, 42 setuptools-scm, 43 setuptools, 44 tenacity, 45 tokenizers, 46 tqdm, 47 typer, 48 typing-extensions, 49 uvicorn, 50 zstd, 51}: 52 53buildPythonPackage rec { 54 pname = "chromadb"; 55 version = "0.5.20"; 56 pyproject = true; 57 58 disabled = pythonOlder "3.9"; 59 60 src = fetchFromGitHub { 61 owner = "chroma-core"; 62 repo = "chroma"; 63 rev = "refs/tags/${version}"; 64 hash = "sha256-DQHkgCHtrn9xi7Kp7TZ5NP1EtFtTH5QOvne9PUvxsWc="; 65 }; 66 67 cargoDeps = rustPlatform.fetchCargoTarball { 68 inherit src; 69 name = "${pname}-${version}"; 70 hash = "sha256-vHH7Uq4Jf8/5Vc8oZ5nvAeq/dFVWywsQYbp7yJkfX7Q="; 71 }; 72 73 pythonRelaxDeps = [ 74 "chroma-hnswlib" 75 "orjson" 76 ]; 77 78 build-system = [ 79 setuptools 80 setuptools-scm 81 ]; 82 83 nativeBuildInputs = [ 84 cargo 85 pkg-config 86 protobuf 87 rustc 88 rustPlatform.cargoSetupHook 89 ]; 90 91 buildInputs = [ 92 openssl 93 zstd 94 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.Security ]; 95 96 dependencies = [ 97 bcrypt 98 build 99 chroma-hnswlib 100 fastapi 101 grpcio 102 httpx 103 importlib-resources 104 kubernetes 105 mmh3 106 numpy 107 onnxruntime 108 opentelemetry-api 109 opentelemetry-exporter-otlp-proto-grpc 110 opentelemetry-instrumentation-fastapi 111 opentelemetry-sdk 112 orjson 113 overrides 114 posthog 115 pulsar-client 116 pydantic 117 pypika 118 pyyaml 119 requests 120 tenacity 121 tokenizers 122 tqdm 123 typer 124 typing-extensions 125 uvicorn 126 ]; 127 128 nativeCheckInputs = [ 129 hypothesis 130 psutil 131 pytest-asyncio 132 pytestCheckHook 133 ]; 134 135 pythonImportsCheck = [ "chromadb" ]; 136 137 env = { 138 ZSTD_SYS_USE_PKG_CONFIG = true; 139 }; 140 141 pytestFlagsArray = [ "-x" ]; 142 143 preCheck = '' 144 (($(ulimit -n) < 1024)) && ulimit -n 1024 145 export HOME=$(mktemp -d) 146 ''; 147 148 disabledTests = [ 149 # Tests are laky / timing sensitive 150 "test_fastapi_server_token_authn_allows_when_it_should_allow" 151 "test_fastapi_server_token_authn_rejects_when_it_should_reject" 152 # Issue with event loop 153 "test_http_client_bw_compatibility" 154 ]; 155 156 disabledTestPaths = [ 157 # Tests require network access 158 "chromadb/test/auth/test_simple_rbac_authz.py" 159 "chromadb/test/db/test_system.py" 160 "chromadb/test/ef/test_default_ef.py" 161 "chromadb/test/property/" 162 "chromadb/test/property/test_cross_version_persist.py" 163 "chromadb/test/stress/" 164 "chromadb/test/test_api.py" 165 ]; 166 167 __darwinAllowLocalNetworking = true; 168 169 passthru.tests = { 170 inherit (nixosTests) chromadb; 171 }; 172 173 meta = with lib; { 174 description = "AI-native open-source embedding database"; 175 homepage = "https://github.com/chroma-core/chroma"; 176 changelog = "https://github.com/chroma-core/chroma/releases/tag/${version}"; 177 license = licenses.asl20; 178 maintainers = with maintainers; [ fab ]; 179 mainProgram = "chroma"; 180 broken = stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64; 181 }; 182}