1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 nix-update-script,
6 chromadb,
7 langchain-core,
8 langchain-tests,
9 numpy,
10 pdm-backend,
11 pytestCheckHook,
12 pytest-asyncio,
13}:
14
15buildPythonPackage rec {
16 pname = "langchain-chroma";
17 version = "0.2.3";
18 pyproject = true;
19
20 src = fetchFromGitHub {
21 owner = "langchain-ai";
22 repo = "langchain";
23 tag = "langchain-chroma==${version}";
24 hash = "sha256-6WOViBKXZ844g2M6pYohHsXnzJiWbTNgj9EjN+z+B+4=";
25 };
26
27 sourceRoot = "${src.name}/libs/partners/chroma";
28
29 patches = [ ./001-async-test.patch ];
30
31 build-system = [ pdm-backend ];
32
33 pythonRelaxDeps = [
34 # Each component release requests the exact latest core.
35 # That prevents us from updating individul components.
36 "langchain-core"
37 "numpy"
38 ];
39
40 dependencies = [
41 chromadb
42 langchain-core
43 numpy
44 ];
45
46 pythonImportsCheck = [ "langchain_chroma" ];
47
48 nativeCheckInputs = [
49 langchain-tests
50 pytest-asyncio
51 pytestCheckHook
52 ];
53
54 disabledTests = [
55 # Bad integration test, not used or vetted by the langchain team
56 "test_chroma_update_document"
57 ];
58
59 passthru.updateScript = nix-update-script {
60 extraArgs = [
61 "--version-regex"
62 "langchain-chroma==([0-9.]+)"
63 ];
64 };
65
66 meta = {
67 changelog = "https://github.com/langchain-ai/langchain/releases/tag/langchain-chroma==${version}";
68 description = "Integration package connecting Chroma and LangChain";
69 homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/partners/chroma";
70 license = lib.licenses.mit;
71 maintainers = with lib.maintainers; [
72 natsukium
73 sarahec
74 ];
75 };
76}