1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 nix-update-script,
6
7 # build-system
8 poetry-core,
9
10 # dependencies
11 langchain-core,
12 numpy,
13 pymongo,
14
15 freezegun,
16 httpx,
17 langchain,
18 pytest-asyncio,
19 pytestCheckHook,
20 pytest-mock,
21 syrupy,
22}:
23
24buildPythonPackage rec {
25 pname = "langchain-mongodb";
26 version = "0.2.0";
27 pyproject = true;
28
29 src = fetchFromGitHub {
30 owner = "langchain-ai";
31 repo = "langchain";
32 tag = "langchain-mongodb==${version}";
33 hash = "sha256-Jd9toXkS9dGtSIrJQ/5W+swV1z2BJOJKBtkyGzj3oSc=";
34 };
35
36 sourceRoot = "${src.name}/libs/partners/mongodb";
37
38 build-system = [ poetry-core ];
39
40 pythonRelaxDeps = [
41 # Each component release requests the exact latest core.
42 # That prevents us from updating individul components.
43 "langchain-core"
44 "numpy"
45 ];
46
47 dependencies = [
48 langchain-core
49 numpy
50 pymongo
51 ];
52
53 nativeCheckInputs = [
54 freezegun
55 httpx
56 langchain
57 pytest-asyncio
58 pytestCheckHook
59 pytest-mock
60 syrupy
61 ];
62
63 pytestFlagsArray = [ "tests/unit_tests" ];
64
65 pythonImportsCheck = [ "langchain_mongodb" ];
66
67 passthru.updateScript = nix-update-script {
68 extraArgs = [
69 "--version-regex"
70 "^langchain-mongodb==([0-9.]+)$"
71 ];
72 };
73
74 meta = {
75 changelog = "https://github.com/langchain-ai/langchain/releases/tag/langchain-mongodb==${version}";
76 description = "Integration package connecting MongoDB and LangChain";
77 homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/partners/mongodb";
78 license = lib.licenses.mit;
79 maintainers = with lib.maintainers; [
80 natsukium
81 sarahec
82 ];
83 };
84}