33 stdenv ,
44 buildPythonPackage ,
55 fetchFromGitHub ,
6-
7- # build-system
8- setuptools-scm ,
9- setuptools ,
6+ fetchurl ,
107
118 # build inputs
129 cargo ,
1310 pkg-config ,
1411 protobuf ,
1512 rustc ,
1613 rustPlatform ,
14+ pkgs , # zstd hidden by python3Packages.zstd
1715 openssl ,
1816
1917 # dependencies
2321 grpcio ,
2422 httpx ,
2523 importlib-resources ,
24+ jsonschema ,
2625 kubernetes ,
2726 mmh3 ,
2827 numpy ,
4544 typer ,
4645 typing-extensions ,
4746 uvicorn ,
48- zstd ,
4947
5048 # optional dependencies
5149 chroma-hnswlib ,
5250
5351 # tests
52+ hnswlib ,
5453 hypothesis ,
54+ pandas ,
5555 psutil ,
5656 pytest-asyncio ,
57+ pytest-xdist ,
5758 pytestCheckHook ,
59+ sqlite ,
60+ starlette ,
5861
5962 # passthru
6063 nixosTests ,
6366
6467buildPythonPackage rec {
6568 pname = "chromadb" ;
66- version = "0.6.3 " ;
69+ version = "1.0.12 " ;
6770 pyproject = true ;
6871
6972 src = fetchFromGitHub {
7073 owner = "chroma-core" ;
7174 repo = "chroma" ;
7275 tag = version ;
73- hash = "sha256-yvAX8buETsdPvMQmRK5+WFz4fVaGIdNlfhSadtHwU5U =" ;
76+ hash = "sha256-Q4PhJTRNzJeVx6DIPWirnI9KksNb8vfOtqb/q9tSK3c =" ;
7477 } ;
7578
7679 cargoDeps = rustPlatform . fetchCargoVendor {
7780 inherit src ;
78- name = "${ pname } -${ version } " ;
79- hash = "sha256-lHRBXJa/OFNf4x7afEJw9XcuDveTBIy3XpQ3+19JXn4=" ;
81+ name = "${ pname } -${ version } -vendor" ;
82+ hash = "sha256-+Ea2aRrsBGfVCLdOF41jeMehJhMurc8d0UKrpR6ndag=" ;
83+ } ;
84+
85+ # Can't use fetchFromGitHub as the build expects a zipfile
86+ swagger-ui = fetchurl {
87+ url = "https://github.com/swagger-api/swagger-ui/archive/refs/tags/v5.22.0.zip" ;
88+ hash = "sha256-H+kXxA/6rKzYA19v7Zlx2HbIg/DGicD5FDIs0noVGSk=" ;
8089 } ;
8190
91+ patches = [
92+ # The fastapi servers can't set up their networking in the test environment, so disable for testing
93+ ./disable-fastapi-fixtures.patch
94+ ] ;
95+
96+ postPatch = ''
97+ # Nixpkgs is taking the version from `chromadb_rust_bindings` which is versioned independently
98+ substituteInPlace pyproject.toml \
99+ --replace-fail "dynamic = [\"version\"]" "version = \"${ version } \""
100+ '' ;
101+
82102 pythonRelaxDeps = [
83- "chroma-hnswlib"
84- "orjson"
85- "tokenizers"
103+ "fastapi"
86104 ] ;
87105
88106 build-system = [
89- setuptools
90- setuptools-scm
107+ rustPlatform . maturinBuildHook
91108 ] ;
92109
93110 nativeBuildInputs = [
@@ -100,17 +117,17 @@ buildPythonPackage rec {
100117
101118 buildInputs = [
102119 openssl
103- zstd
120+ pkgs . zstd
104121 ] ;
105122
106123 dependencies = [
107124 bcrypt
108125 build
109- chroma-hnswlib
110126 fastapi
111127 grpcio
112128 httpx
113129 importlib-resources
130+ jsonschema
114131 kubernetes
115132 mmh3
116133 numpy
@@ -135,11 +152,21 @@ buildPythonPackage rec {
135152 uvicorn
136153 ] ;
137154
155+ optional-dependencies = {
156+ dev = [ chroma-hnswlib ] ;
157+ } ;
158+
138159 nativeCheckInputs = [
160+ chroma-hnswlib
161+ hnswlib
139162 hypothesis
163+ pandas
140164 psutil
141165 pytest-asyncio
166+ pytest-xdist
142167 pytestCheckHook
168+ sqlite
169+ starlette
143170 ] ;
144171
145172 # Disable on aarch64-linux due to broken onnxruntime
@@ -151,11 +178,16 @@ buildPythonPackage rec {
151178
152179 env = {
153180 ZSTD_SYS_USE_PKG_CONFIG = true ;
181+ SWAGGER_UI_DOWNLOAD_URL = "file://${ swagger-ui } " ;
154182 } ;
155183
156184 pytestFlagsArray = [
157185 "-x" # these are slow tests, so stop on the first failure
158186 "-v"
187+ "-W"
188+ "ignore:DeprecationWarning"
189+ "-W"
190+ "ignore:PytestCollectionWarning"
159191 ] ;
160192
161193 preCheck = ''
@@ -173,28 +205,43 @@ buildPythonPackage rec {
173205
174206 # httpx ReadError
175207 "test_not_existing_collection_delete"
208+
209+ # Tests launch a server and try to connect to it
210+ # These either have https connection errors or name resolution errors
211+ "test_collection_query_with_invalid_collection_throws"
212+ "test_collection_update_with_invalid_collection_throws"
213+ "test_default_embedding"
214+ "test_invalid_index_params"
215+ "test_peek"
216+ "test_persist_index_loading"
217+ "test_query_id_filtering_e2e"
218+ "test_query_id_filtering_medium_dataset"
219+ "test_query_id_filtering_small_dataset"
220+ "test_ssl_self_signed_without_ssl_verify"
221+ "test_ssl_self_signed"
222+
223+ # Apparent race condition with sqlite
224+ # See https://github.com/chroma-core/chroma/issues/4661
225+ "test_multithreaded_get_or_create"
176226 ] ;
177227
178228 disabledTestPaths = [
179229 # Tests require network access
180- "chromadb/test/auth/test_simple_rbac_authz .py"
181- "chromadb/test/db/test_system .py"
230+ "bin/rust_python_compat_test .py"
231+ "chromadb/test/configurations/test_collection_configuration .py"
182232 "chromadb/test/ef/test_default_ef.py"
233+ "chromadb/test/ef/test_onnx_mini_lm_l6_v2.py"
234+ "chromadb/test/ef/test_voyageai_ef.py"
183235 "chromadb/test/property/"
184236 "chromadb/test/property/test_cross_version_persist.py"
185237 "chromadb/test/stress/"
186238 "chromadb/test/test_api.py"
187239
188- # httpx failures
189- "chromadb/test/api/test_delete_database .py"
240+ # Tests time out (waiting for server)
241+ "chromadb/test/test_cli .py"
190242
191- # Cannot be loaded by pytest without path hacks (fixed in 1.0.0)
192- "chromadb/test/test_logservice.py"
193- "chromadb/test/proto/test_utils.py"
194- "chromadb/test/segment/distributed/test_protobuf_translation.py"
195-
196- # Hypothesis FailedHealthCheck due to nested @given tests
197- "chromadb/test/cache/test_cache.py"
243+ # Cannot find protobuf file while loading test
244+ "chromadb/test/distributed/test_log_failover.py"
198245 ] ;
199246
200247 __darwinAllowLocalNetworking = true ;
@@ -212,17 +259,17 @@ buildPythonPackage rec {
212259 "([0-9].+)"
213260 ] ;
214261 } ;
262+ } ;
215263
216- meta = {
217- description = "AI-native open-source embedding database" ;
218- homepage = "https://github.com/chroma-core/chroma" ;
219- changelog = "https://github.com/chroma-core/chroma/releases/tag/${ version } " ;
220- license = lib . licenses . asl20 ;
221- maintainers = with lib . maintainers ; [
222- fab
223- sarahec
224- ] ;
225- mainProgram = "chroma" ;
226- } ;
264+ meta = {
265+ description = "AI-native open-source embedding database" ;
266+ homepage = "https://github.com/chroma-core/chroma" ;
267+ changelog = "https://github.com/chroma-core/chroma/releases/tag/${ version } " ;
268+ license = lib . licenses . asl20 ;
269+ maintainers = with lib . maintainers ; [
270+ fab
271+ sarahec
272+ ] ;
273+ mainProgram = "chroma" ;
227274 } ;
228275}
0 commit comments