2024-05-15 15:35:15 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
bcrypt,
|
|
|
|
build,
|
|
|
|
buildPythonPackage,
|
|
|
|
cargo,
|
|
|
|
chroma-hnswlib,
|
|
|
|
darwin,
|
|
|
|
fastapi,
|
|
|
|
fetchFromGitHub,
|
2024-09-19 14:19:46 +00:00
|
|
|
fetchpatch,
|
2024-05-15 15:35:15 +00:00
|
|
|
grpcio,
|
2024-06-20 14:57:18 +00:00
|
|
|
httpx,
|
2024-05-15 15:35:15 +00:00
|
|
|
hypothesis,
|
|
|
|
importlib-resources,
|
|
|
|
kubernetes,
|
|
|
|
mmh3,
|
|
|
|
numpy,
|
|
|
|
onnxruntime,
|
|
|
|
openssl,
|
|
|
|
opentelemetry-api,
|
|
|
|
opentelemetry-exporter-otlp-proto-grpc,
|
|
|
|
opentelemetry-instrumentation-fastapi,
|
|
|
|
opentelemetry-sdk,
|
|
|
|
orjson,
|
|
|
|
overrides,
|
|
|
|
pkg-config,
|
|
|
|
posthog,
|
|
|
|
protobuf,
|
|
|
|
pulsar-client,
|
|
|
|
pydantic,
|
|
|
|
pypika,
|
|
|
|
pytest-asyncio,
|
|
|
|
pytestCheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
pyyaml,
|
|
|
|
requests,
|
|
|
|
rustc,
|
|
|
|
rustPlatform,
|
|
|
|
setuptools,
|
|
|
|
setuptools-scm,
|
|
|
|
tenacity,
|
|
|
|
tokenizers,
|
|
|
|
tqdm,
|
|
|
|
typer,
|
|
|
|
typing-extensions,
|
|
|
|
uvicorn,
|
|
|
|
zstd,
|
2024-09-19 14:19:46 +00:00
|
|
|
nixosTests,
|
2024-02-29 20:09:43 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "chromadb";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "0.5.5";
|
2024-02-29 20:09:43 +00:00
|
|
|
pyproject = true;
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.9";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "chroma-core";
|
|
|
|
repo = "chroma";
|
|
|
|
rev = "refs/tags/${version}";
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-e6ZctUFeq9hHXWaxGdVTiqFpwaU7A+EKn2EdQPI7DHE=";
|
2024-02-29 20:09:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
cargoDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
inherit src;
|
|
|
|
name = "${pname}-${version}";
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-3FmnQEpknYNzI3WlQ3kc8qa4LFcn1zpxKDbkATU7/48=";
|
2024-02-29 20:09:43 +00:00
|
|
|
};
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
patches = [
|
|
|
|
# Remove these on the next release
|
|
|
|
(fetchpatch {
|
|
|
|
name = "pydantic19-fastapi1.patch";
|
|
|
|
url = "https://github.com/chroma-core/chroma/commit/d62c13da29b7bff77bd7dee887123e3c57e2c19e.patch";
|
|
|
|
hash = "sha256-E3xmh9vQZH3NCfG6phvzM65NGwlcHmPgfU6FERKAJ60=";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
name = "no-union-types-pydantic1.patch";
|
|
|
|
url = "https://github.com/chroma-core/chroma/commit/2fd5b27903dffcf8bdfbb781a25bcecc17b27672.patch";
|
|
|
|
hash = "sha256-nmiA/lKZVrHKXumc+J4uVRiMwrnFrz2tgMpfcay5hhw=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
pythonRelaxDeps = [
|
|
|
|
"chroma-hnswlib"
|
|
|
|
"orjson"
|
|
|
|
];
|
2024-02-29 20:09:43 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
build-system = [
|
|
|
|
setuptools
|
|
|
|
setuptools-scm
|
|
|
|
];
|
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cargo
|
|
|
|
pkg-config
|
|
|
|
protobuf
|
|
|
|
rustc
|
|
|
|
rustPlatform.cargoSetupHook
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
openssl
|
|
|
|
zstd
|
2024-05-15 15:35:15 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ];
|
2024-02-29 20:09:43 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
dependencies = [
|
2024-02-29 20:09:43 +00:00
|
|
|
bcrypt
|
|
|
|
build
|
|
|
|
chroma-hnswlib
|
|
|
|
fastapi
|
|
|
|
grpcio
|
2024-06-20 14:57:18 +00:00
|
|
|
httpx
|
2024-02-29 20:09:43 +00:00
|
|
|
importlib-resources
|
|
|
|
kubernetes
|
|
|
|
mmh3
|
|
|
|
numpy
|
|
|
|
onnxruntime
|
|
|
|
opentelemetry-api
|
|
|
|
opentelemetry-exporter-otlp-proto-grpc
|
|
|
|
opentelemetry-instrumentation-fastapi
|
|
|
|
opentelemetry-sdk
|
|
|
|
orjson
|
|
|
|
overrides
|
|
|
|
posthog
|
|
|
|
pulsar-client
|
|
|
|
pydantic
|
|
|
|
pypika
|
|
|
|
pyyaml
|
|
|
|
requests
|
|
|
|
tenacity
|
|
|
|
tokenizers
|
|
|
|
tqdm
|
|
|
|
typer
|
|
|
|
typing-extensions
|
|
|
|
uvicorn
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
hypothesis
|
|
|
|
pytest-asyncio
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
pythonImportsCheck = [ "chromadb" ];
|
2024-02-29 20:09:43 +00:00
|
|
|
|
|
|
|
env = {
|
|
|
|
ZSTD_SYS_USE_PKG_CONFIG = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
pytestFlagsArray = [ "-x" ];
|
|
|
|
|
|
|
|
preCheck = ''
|
2024-05-15 15:35:15 +00:00
|
|
|
(($(ulimit -n) < 1024)) && ulimit -n 1024
|
2024-02-29 20:09:43 +00:00
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
'';
|
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
disabledTests = [
|
2024-09-19 14:19:46 +00:00
|
|
|
# Tests are laky / timing sensitive
|
2024-06-20 14:57:18 +00:00
|
|
|
"test_fastapi_server_token_authn_allows_when_it_should_allow"
|
2024-09-19 14:19:46 +00:00
|
|
|
"test_fastapi_server_token_authn_rejects_when_it_should_reject"
|
2024-06-20 14:57:18 +00:00
|
|
|
];
|
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
disabledTestPaths = [
|
|
|
|
# Tests require network access
|
|
|
|
"chromadb/test/auth/test_simple_rbac_authz.py"
|
2024-06-20 14:57:18 +00:00
|
|
|
"chromadb/test/db/test_system.py"
|
2024-02-29 20:09:43 +00:00
|
|
|
"chromadb/test/ef/test_default_ef.py"
|
|
|
|
"chromadb/test/property/"
|
2024-06-20 14:57:18 +00:00
|
|
|
"chromadb/test/property/test_cross_version_persist.py"
|
2024-02-29 20:09:43 +00:00
|
|
|
"chromadb/test/stress/"
|
2024-06-20 14:57:18 +00:00
|
|
|
"chromadb/test/test_api.py"
|
2024-02-29 20:09:43 +00:00
|
|
|
];
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit (nixosTests) chromadb;
|
|
|
|
};
|
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "AI-native open-source embedding database";
|
2024-02-29 20:09:43 +00:00
|
|
|
homepage = "https://github.com/chroma-core/chroma";
|
|
|
|
changelog = "https://github.com/chroma-core/chroma/releases/tag/${version}";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ fab ];
|
2024-06-05 15:53:02 +00:00
|
|
|
mainProgram = "chroma";
|
|
|
|
broken = stdenv.isLinux && stdenv.isAarch64;
|
2024-02-29 20:09:43 +00:00
|
|
|
};
|
|
|
|
}
|